Skip to content

Commit 2d40a8d

Browse files
committed
feat: implement contest tile
1 parent 2d06292 commit 2d40a8d

20 files changed

Lines changed: 259 additions & 94 deletions
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/data/constants/assets.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class AppAssets {
33
static const String _iconsRoot = 'assets/app/icons';
44
static const String _imagesRoot = 'assets/app/images';
55
static const String _illustrationsRoot = 'assets/app/illustrations';
6+
static const String _platformIconRoot = '$_imagesRoot/platforms';
67

78
// Icons
89
static const String arrowForward = '$_iconsRoot/arrow-forward.svg';
@@ -11,6 +12,8 @@ class AppAssets {
1112
static const String lock = '$_iconsRoot/lock.svg';
1213
static const String person = '$_iconsRoot/person.svg';
1314
static const String filter = '$_iconsRoot/filter.svg';
15+
static const String bell = '$_iconsRoot/bell.svg';
16+
static const String selectedBell = '$_iconsRoot/selected_bell.svg';
1417

1518
// Images
1619
static const String circle1 = '$_imagesRoot/circle1.svg';
@@ -30,4 +33,12 @@ class AppAssets {
3033
static const String contest = '$_iconsRoot/contest.svg';
3134
static const String search = '$_iconsRoot/search.svg';
3235
static const String profile = '$_iconsRoot/profile.svg';
36+
37+
/// Platform Icons
38+
static const String codechef = '$_platformIconRoot/codechef.png';
39+
static const String codeforces = '$_platformIconRoot/codeforces.png';
40+
static const String hackerRank = '$_platformIconRoot/hacker_rank.png';
41+
static const String hackerEarth = '$_platformIconRoot/hacker_earth.png';
42+
static const String spoj = '$_platformIconRoot/spoj.png';
43+
static const String otherPlatform = '$_platformIconRoot/other_platform.jpg';
3344
}

lib/data/constants/colors.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ class AppColors {
1313

1414
static const Color primary = Color(0xFF3366FF);
1515
static const Color primaryAccent = Color(0x0D3366FF);
16+
static const Color primaryBlack = Color(0xFF242424);
1617
}

lib/data/constants/styles.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ class AppStyles {
1414
fontSize: 24.sp,
1515
fontWeight: FontWeight.w900,
1616
);
17+
static final TextStyle h4 = TextStyle(
18+
color: AppColors.primaryBlack,
19+
fontSize: 18.sp,
20+
fontWeight: FontWeight.w500,
21+
);
1722
static final TextStyle h5 = TextStyle(
1823
color: AppColors.white.withOpacity(0.85),
1924
fontSize: 16.sp,
@@ -39,6 +44,7 @@ class AppStyles {
3944
textTheme: TextTheme(
4045
headline1: h1,
4146
headline2: h2,
47+
headline4: h4,
4248
headline5: h5,
4349
headline6: h6,
4450
),

lib/domain/models/contest.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Ongoing with _$Ongoing {
2222
@JsonKey(name: 'Name') required String name,
2323
@JsonKey(name: 'Platform') required String platform,
2424
required String url,
25-
@JsonKey(name: 'challenge_type') required String challengeType,
25+
@JsonKey(name: 'challenge_type') String? challengeType,
2626
}) = _Ongoing;
2727

2828
factory Ongoing.fromJson(Map<String, dynamic> json) =>
@@ -37,8 +37,8 @@ class Upcoming with _$Upcoming {
3737
@JsonKey(name: 'Name') required String name,
3838
@JsonKey(name: 'Platform') required String platform,
3939
required String url,
40-
@JsonKey(name: 'challenge_type') required String challengeType,
41-
String? duration,
40+
@JsonKey(name: 'challenge_type') String? challengeType,
41+
@JsonKey(name: 'Duration') String? duration,
4242
}) = _Upcoming;
4343

4444
factory Upcoming.fromJson(Map<String, dynamic> json) =>

lib/domain/repositories/cp_repository.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CPRepository {
2626
}
2727

2828
static Future<Contest?> contestList() async {
29-
const endpoint = 'contest/';
29+
const endpoint = 'contests/';
3030
final headers = <String, dynamic>{};
3131

3232
ApiService.addTokenToHeaders(headers);
@@ -36,7 +36,7 @@ class CPRepository {
3636
);
3737

3838
if (response['status_code'] == 200) {
39-
return Contest.fromJson(json.decode(response['data']));
39+
return Contest.fromJson(response['data']);
4040
}
4141
return null;
4242
}

0 commit comments

Comments
 (0)