Skip to content

Commit 3655de4

Browse files
committed
feat(Exam): done do exam screen UI
1 parent 769d445 commit 3655de4

File tree

4 files changed

+100
-19
lines changed

4 files changed

+100
-19
lines changed

analysis_options.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# include: package:flutter_lints/flutter.yaml
2+
3+
# linter:
4+
# rules:
5+
# avoid_print: false
6+
# avoid_unnecessary_containers: false
7+
# avoid_web_libraries_in_flutter: false
8+
# no_logic_in_create_state: false
9+
# prefer_const_constructors: false
10+
# prefer_const_constructors_in_immutables: false
11+
# prefer_const_declarations: false
12+
# prefer_const_literals_to_create_immutables: false
13+
# sized_box_for_whitespace: false
14+
# use_full_hex_values_for_flutter_colors: false
15+
# use_key_in_widget_constructors: false
16+

lib/src/ui/classes/classes_screen.dart

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,21 @@ class _ClassesScreenState extends State<ClassesScreen> {
8787
itemBuilder: (context, index) {
8888
return index == 0
8989
? _buildCurrentClasses(context)
90-
: RecommendClassCard(
91-
imageClass: posts[index - 1].imageGroup,
92-
className: posts[index - 1].groupName,
93-
star: '4.5 / 5.0',
94-
teacher: posts[index - 1].authorName,
90+
: GestureDetector(
91+
onTap: () {
92+
AppNavigator.push(
93+
AppRoutes.DETAILS_CLASS,
94+
arguments: {
95+
'slide': SlideMode.bot,
96+
},
97+
);
98+
},
99+
child: RecommendClassCard(
100+
imageClass: posts[index - 1].imageGroup,
101+
className: posts[index - 1].groupName,
102+
star: '4.5 / 5.0',
103+
teacher: posts[index - 1].authorName,
104+
),
95105
);
96106
},
97107
),
@@ -110,7 +120,7 @@ class _ClassesScreenState extends State<ClassesScreen> {
110120
_buildTitle(
111121
yourClass.i18n,
112122
PhosphorIcons.chalkboardSimpleBold,
113-
themeService.isSavedDarkMode() ? colorAttendance : colorGreenLight,
123+
themeService.isSavedDarkMode() ? colorAttendance : colorActive,
114124
),
115125
Container(
116126
height: 164.sp,

lib/src/ui/classes/screens/class_information_screen.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ class _ClassInformationScreenState extends State<ClassInformationScreen> {
8686
right: 0,
8787
child: Row(
8888
crossAxisAlignment: CrossAxisAlignment.start,
89-
mainAxisAlignment:
90-
MainAxisAlignment.spaceBetween,
89+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
9190
children: [
9291
GestureDetector(
9392
onTap: () {
@@ -98,8 +97,7 @@ class _ClassInformationScreenState extends State<ClassInformationScreen> {
9897
margin: EdgeInsets.only(left: 10.sp),
9998
decoration: BoxDecoration(
10099
color: Colors.black.withOpacity(.15),
101-
borderRadius:
102-
BorderRadius.circular(8.sp),
100+
borderRadius: BorderRadius.circular(8.sp),
103101
),
104102
child: Icon(
105103
PhosphorIcons.arrowLeftBold,
@@ -110,16 +108,14 @@ class _ClassInformationScreenState extends State<ClassInformationScreen> {
110108
),
111109
GestureDetector(
112110
onTap: () {
113-
_scaffoldKey.currentState!
114-
.openEndDrawer();
111+
_scaffoldKey.currentState!.openEndDrawer();
115112
},
116113
child: Container(
117114
padding: EdgeInsets.all(9.25.sp),
118115
margin: EdgeInsets.only(right: 10.sp),
119116
decoration: BoxDecoration(
120117
color: Colors.black.withOpacity(.15),
121-
borderRadius:
122-
BorderRadius.circular(8.sp),
118+
borderRadius: BorderRadius.circular(8.sp),
123119
),
124120
child: Icon(
125121
PhosphorIcons.slidersHorizontal,

lib/src/ui/classes/screens/do_exam_screen.dart

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,34 @@ class DoExamScreen extends StatefulWidget {
1414
}
1515

1616
class _DoExamScreenState extends State<DoExamScreen> {
17+
List<String> _answers = ['A đúng', 'B đúng', 'C đúng', 'Tất cả đều đúng'];
18+
List<Color> _colors = [
19+
colorPrimary,
20+
colorHigh,
21+
Colors.green,
22+
Colors.deepPurpleAccent.shade200,
23+
Colors.pinkAccent.shade100,
24+
];
25+
26+
@override
27+
void initState() {
28+
super.initState();
29+
_colors.shuffle();
30+
}
31+
1732
@override
1833
Widget build(BuildContext context) {
1934
return Scaffold(
35+
floatingActionButton: FloatingActionButton(
36+
onPressed: () => null,
37+
child: Icon(
38+
PhosphorIcons.lockFill,
39+
size: 20.sp,
40+
color: mC,
41+
),
42+
backgroundColor: colorPrimary,
43+
),
44+
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
2045
body: SafeArea(
2146
child: Container(
2247
height: 100.h,
@@ -29,7 +54,7 @@ class _DoExamScreenState extends State<DoExamScreen> {
2954
LinearPercentIndicator(
3055
padding: EdgeInsets.symmetric(horizontal: 12.sp),
3156
width: 100.w,
32-
lineHeight: 10.5.sp,
57+
lineHeight: 6.sp,
3358
percent: 0.65,
3459
backgroundColor: ThemeService().isSavedDarkMode()
3560
? Colors.grey.shade800
@@ -55,20 +80,26 @@ class _DoExamScreenState extends State<DoExamScreen> {
5580
],
5681
),
5782
),
58-
SizedBox(height: 12.sp),
83+
SizedBox(height: 20.sp),
5984
Container(
6085
width: 100.w,
86+
padding: EdgeInsets.symmetric(horizontal: 20.sp),
6187
child: Text(
62-
'1. Ưu điểm của Flutter là gì?',
88+
'Ưu điểm của Flutter là gì? Ưu điểm của Flutter là gì?',
6389
textAlign: TextAlign.center,
6490
style: TextStyle(
6591
fontSize: 15.sp,
6692
fontWeight: FontWeight.w600,
6793
fontFamily: FontFamily.lato,
94+
color: Theme.of(context)
95+
.textTheme
96+
.bodyText1!
97+
.color!
98+
.withOpacity(.85),
6899
),
69100
),
70101
),
71-
SizedBox(height: 16.sp),
102+
SizedBox(height: 24.sp),
72103
_buildAnswerOption(context),
73104
],
74105
),
@@ -167,6 +198,34 @@ class _DoExamScreenState extends State<DoExamScreen> {
167198
}
168199

169200
Widget _buildAnswerOption(context) {
170-
return Expanded(child: Container());
201+
return Expanded(
202+
child: ListView.builder(
203+
physics: BouncingScrollPhysics(),
204+
itemCount: _answers.length,
205+
itemBuilder: (context, index) {
206+
return Container(
207+
margin: EdgeInsets.symmetric(
208+
horizontal: 13.75.sp,
209+
vertical: 6.sp,
210+
),
211+
padding: EdgeInsets.symmetric(vertical: 15.25.sp),
212+
decoration: BoxDecoration(
213+
borderRadius: BorderRadius.circular(5.sp),
214+
color: _colors[index % (_colors.length)],
215+
),
216+
alignment: Alignment.center,
217+
child: Text(
218+
_answers[index],
219+
style: TextStyle(
220+
fontSize: 11.sp,
221+
fontWeight: FontWeight.w600,
222+
fontFamily: FontFamily.lato,
223+
color: mC,
224+
),
225+
),
226+
);
227+
},
228+
),
229+
);
171230
}
172231
}

0 commit comments

Comments
 (0)