Skip to content

Commit

Permalink
SG UI on Quiz Upload, Quiz Mode. Bug fixes. Latex Sample Added.
Browse files Browse the repository at this point in the history
  • Loading branch information
draqunov10 committed May 2, 2024
1 parent 0068ca8 commit a435013
Show file tree
Hide file tree
Showing 36 changed files with 922 additions and 296 deletions.
Binary file added assets/logos/sg_sholars_guide_language_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logos/sg_sholars_guide_math_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logos/sg_sholars_guide_reading_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logos/sg_sholars_guide_science_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions lib/core/models/question_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Question {
DocumentReference? commentRef;
DocumentReference? questionRef;


DocumentReference? createdBy;
final Timestamp createdAt = Timestamp.now();

Expand Down Expand Up @@ -95,7 +94,7 @@ class Question {
static String SUBJ2string(SUBJ subj) {
switch (subj) {
case SUBJ.MATH:
return "Math";
return "Mathematics";
case SUBJ.SCIENCE:
return "Science";
case SUBJ.READING:
Expand All @@ -109,7 +108,7 @@ class Question {

static SUBJ string2SUBJ(String subj) {
switch (subj) {
case "Math":
case "Mathematics":
return SUBJ.MATH;
case "Science":
return SUBJ.SCIENCE;
Expand Down
27 changes: 26 additions & 1 deletion lib/features/profile/presentation/screens/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class ProfileScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircleAvatar(
backgroundColor: Colors.blue,
backgroundColor: const Color.fromRGBO(207, 0, 15, 1),
radius: 50,
child: Text(
username[0].toUpperCase(),
Expand Down Expand Up @@ -164,12 +164,37 @@ class ProfileScreen extends StatelessWidget {
'/profile/view-my-questions',
);
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
const Color.fromRGBO(207, 0, 15, 1),
),
),
child: Text(
"View My Questions",
style: TextStyle(fontSize: 16),
),
),
),
Container(
height: 128,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/logos/sg_scholars_guide_logo-transformed-960x960.png",
height: 50,
width: 50,
),
const Text(
"Scholar's Guide",
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
),
)
],
)
],
);
}),
Expand Down
146 changes: 117 additions & 29 deletions lib/features/quiz_mode/presentation/pages/finished_quiz_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,48 @@ class FinishedQuizPage extends StatelessWidget {
((score / subjectQuestionsMap[subject]!.length) * 100).round();

return Scaffold(
backgroundColor: const Color.fromRGBO(207, 0, 15, 1),
appBar: AppBar(
automaticallyImplyLeading: false,
title: const Text('Quiz Results',
style: TextStyle(fontWeight: FontWeight.bold)),
backgroundColor: const Color.fromRGBO(207, 0, 15, 1),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('Quiz Results',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
)),
SizedBox(
height: 35,
child: ElevatedButton(
onPressed: () {
GoRouter.of(context).go('/quiz-mode');
},
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
color: Colors.white,
),
),
),
backgroundColor: MaterialStateProperty.all(
const Color.fromRGBO(207, 0, 15, 1),
),
),
child: Text(
"Take Another Quiz",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
],
),
),
body: SingleChildScrollView(
child: Column(
Expand All @@ -35,19 +73,28 @@ class FinishedQuizPage extends StatelessWidget {
margin: EdgeInsets.only(top: 20, bottom: 10),
child: Text(
"Congrats on finishing! Let's see how you did",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
Card(
child: Container(
width: MediaQuery.of(context).size.width * 0.5,
margin: EdgeInsets.only(top: 20, bottom: 10),
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 10, right: 10),
child: Card(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(7.0),
),
Text(
"Score",
style:
TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
Container(
padding: EdgeInsets.all(10),
Expand All @@ -59,38 +106,79 @@ class FinishedQuizPage extends StatelessWidget {
: scorePercentage <= 80
? Colors.orange
: Colors.green,
fontSize: 20,
fontSize: 25,
fontWeight: FontWeight.bold),
),
),
TextButton(
onPressed: () {
GoRouter.of(context).go(
'/quiz-mode/solutions-quiz',
extra: {
'subjectQuestionsMap': subjectQuestionsMap,
'subject': subject
},
);
},
child: Text("Review"),
),
],
),
),
),
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 14, right: 14),
padding: EdgeInsets.only(top: 7, bottom: 10),
child: TextButton(
onPressed: () {
GoRouter.of(context).go(
'/quiz-mode/solutions-quiz',
extra: {
'subjectQuestionsMap': subjectQuestionsMap,
'subject': subject
},
);
},
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
side: MaterialStateProperty.all(
BorderSide(
color: Colors.white,
),
),
),
child: Text(
"View Solutions",
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
),
),
Text(
"* Results of unanswered questions will not be shown",
style: TextStyle(fontSize: 11, color: Colors.grey),
style: TextStyle(
fontSize: 11,
color: Colors.white,
),
),
QuestionDisplay(
subjectQuestionsMap: subjectQuestionsMap, subject: subject),
ElevatedButton(
onPressed: () {
GoRouter.of(context).go('/quiz-mode');
},
child: Text('Take Another Quiz'),
),
// Container(
// width: 200,
// child: ElevatedButton(
// onPressed: () {
// GoRouter.of(context).go('/quiz-mode');
// },
// style: ButtonStyle(
// shape: MaterialStateProperty.all<RoundedRectangleBorder>(
// RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10),
// ),
// ),
// backgroundColor:
// MaterialStateProperty.all<Color>(Colors.white),
// ),
// child: Text("Take Another Quiz",
// style: TextStyle(
// fontWeight: FontWeight.bold,
// color: const Color.fromRGBO(207, 0, 15, 1))),
// ),
// ),
SizedBox(
height: 20,
),
Expand Down
54 changes: 39 additions & 15 deletions lib/features/quiz_mode/presentation/pages/quiz_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ class _QuizPageState extends State<QuizPage> {
child: Builder(
builder: (builderContext) {
return Scaffold(
backgroundColor: const Color.fromRGBO(207, 0, 15, 1),
appBar: AppBar(
title: Text('${Question.SUBJ2string(subject)} Quiz',
style: TextStyle(fontWeight: FontWeight.bold)),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
)),
backgroundColor: const Color.fromRGBO(207, 0, 15, 1),
leading: IconButton(
icon: Icon(Icons.arrow_back),
icon: Icon(Icons.arrow_back, color: Colors.white),
onPressed: () {
showDialog<AlertDialog>(
context: context,
Expand Down Expand Up @@ -70,20 +75,39 @@ class _QuizPageState extends State<QuizPage> {
),

// * Display the submit button
ElevatedButton(
onPressed: () {
showDialog<AlertDialog>(
context: context,
builder: (BuildContext buildContext) {
return ConfirmSubmitQuizDialogue(
quizBloc:
quizBlocContext.read<QuizBloc>(),
);
},
);
},
child: Text("Submit"),
Container(
width: 200,
child: ElevatedButton(
onPressed: () {
showDialog<AlertDialog>(
context: context,
builder: (BuildContext buildContext) {
return ConfirmSubmitQuizDialogue(
quizBloc:
quizBlocContext.read<QuizBloc>(),
);
},
);
},
style: ButtonStyle(
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
backgroundColor:
MaterialStateProperty.all<Color>(
Colors.white),
),
child: Text("Submit",
style: TextStyle(
fontWeight: FontWeight.bold,
color: const Color.fromRGBO(
207, 0, 15, 1))),
),
),
Container(height: 20),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ReadyQuizPage extends StatelessWidget {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: const Text('Submit Questions',
title: const Text('Quiz Mode',
style: TextStyle(fontWeight: FontWeight.bold)),
),
body: Center(
Expand Down
26 changes: 24 additions & 2 deletions lib/features/quiz_mode/presentation/pages/solutions_quiz_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart';
import 'package:scholars_guide/core/models/question_model.dart';
import 'package:scholars_guide/features/quiz_mode/presentation/state_management/quiz_card/quiz_card_cubit.dart';
import 'package:scholars_guide/features/quiz_mode/presentation/state_management/solution_quiz/solution_quiz_cubit.dart';
import 'package:scholars_guide/features/quiz_mode/presentation/widgets/finished_quiz_page_widgets/confirm_back_to_quiz_page_dialogue.dart';
import 'package:scholars_guide/features/quiz_mode/presentation/widgets/quiz_page_widgets/question_loading_display.dart';
import 'package:scholars_guide/features/quiz_mode/presentation/widgets/solution_quiz_page_widgets/solution_card_display.dart';

Expand All @@ -25,10 +26,31 @@ class _SolutionsQuizPageState extends State<SolutionsQuizPage> {
extraMap['subjectQuestionsMap'] as Map<SUBJ, List<QuizCardCubit>>;

return Scaffold(
backgroundColor: const Color.fromRGBO(207, 0, 15, 1),
appBar: AppBar(
backgroundColor: const Color.fromRGBO(207, 0, 15, 1),
automaticallyImplyLeading: false,
title: Text('Solutions Page',
style: TextStyle(fontWeight: FontWeight.bold)),
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Colors.white,
),
onPressed: () {
showDialog<AlertDialog>(
context: context,
builder: (BuildContext buildContext) {
return ConfirmBackToQuizPageDialogue();
},
);
},
),
title: Text(
'Solutions Page',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
body: BlocProvider(
create: (providerContext) => SolutionQuizCubit()..loadSolutions(),
Expand Down
Loading

0 comments on commit a435013

Please sign in to comment.