From bb4ca7bedd3944dbf6d15eb1087d0137f9dfb787 Mon Sep 17 00:00:00 2001 From: florentianayuwono <76247368+florentianayuwono@users.noreply.github.com> Date: Wed, 26 Oct 2022 17:31:48 +0800 Subject: [PATCH] Revert "Interactive personalisation screen" --- lite_up/flutter_02.png | Bin 9944 -> 0 bytes lite_up/lib/constants/style.dart | 7 -- lite_up/lib/constants/text.dart | 52 ------------ lite_up/lib/models/quiz_model.dart | 16 ---- lite_up/lib/screens/flashcard_screen.dart | 23 +++-- .../lib/screens/personalisation_screen.dart | 80 ------------------ lite_up/lib/screens/quiz_screen.dart | 75 ---------------- lite_up/lib/widgets/blueEnd_button.dart | 28 ------ lite_up/lib/widgets/login_button.dart | 1 - .../lib/widgets/personalisation_button.dart | 60 ------------- lite_up/lib/widgets/quiz_widget.dart | 79 ----------------- lite_up/lib/widgets/signup_button.dart | 3 +- lite_up/lib/widgets/start_button.dart | 47 ---------- 13 files changed, 11 insertions(+), 460 deletions(-) delete mode 100644 lite_up/flutter_02.png delete mode 100644 lite_up/lib/models/quiz_model.dart delete mode 100644 lite_up/lib/screens/personalisation_screen.dart delete mode 100644 lite_up/lib/screens/quiz_screen.dart delete mode 100644 lite_up/lib/widgets/blueEnd_button.dart delete mode 100644 lite_up/lib/widgets/personalisation_button.dart delete mode 100644 lite_up/lib/widgets/quiz_widget.dart delete mode 100644 lite_up/lib/widgets/start_button.dart diff --git a/lite_up/flutter_02.png b/lite_up/flutter_02.png deleted file mode 100644 index 38c126c2b322debdf76fb2a424221a533a44997f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9944 zcmeI&I}QO+6vpv0F_H1^MWGOD(3*_L6a=AHD5xbuA|W(XEWipBtic8-6k-YD(Tc+3 z-VG>}^8cFqN=|Zq<;k6vin)+K>KBoan|CTAW=h1Du)ON#vEQxLVzetcTUOiHNgd3# z?N%+7zSWqB#Km>e)$Zc5F%0!OoWIsLOIITZAb7vZWe9009ILKmY**5I_I{1Q0*~fxi$)ULFMzZ%6+H_|i}-687o2fcYF;g8{uG d2q1s}0toylFq869jNZL@)&<;5(OKE`(FZh6cftSw diff --git a/lite_up/lib/constants/style.dart b/lite_up/lib/constants/style.dart index bb01a71..7298956 100644 --- a/lite_up/lib/constants/style.dart +++ b/lite_up/lib/constants/style.dart @@ -22,9 +22,6 @@ const TextStyle loginButtonTextStyle = const TextStyle signUpButtonTextStyle = TextStyle(color: deepOrange, fontSize: 16, fontWeight: FontWeight.bold); -const TextStyle personalisationTextstyle = - TextStyle(color: grayish, fontSize: 13, fontWeight: FontWeight.w500); - /* COLOR STYLE */ const Color background = Color.fromARGB(255, 249, 240, 181); const Color deepOrange = Color.fromARGB(255, 255, 123, 46); @@ -32,8 +29,6 @@ const Color softOrange = Color.fromARGB(255, 254, 189, 142); const Color deepYellow = Color.fromARGB(255, 255, 187, 1); const Color skyBlue = Color.fromARGB(255, 156, 197, 231); const Color white = Colors.white; -const Color grayish = Color.fromARGB(255, 87, 87, 87); -const Color lightGray = Color.fromARGB(255, 217, 217, 217); ButtonStyle loginButtonStyle = ButtonStyle( backgroundColor: MaterialStateProperty.all(deepOrange), @@ -50,5 +45,3 @@ const BoxDecoration primaryBackground = BoxDecoration( BoxDecoration unlockedCardBackground = BoxDecoration(color: softOrange, borderRadius: BorderRadius.circular(25)); - -var mapNumberToLetter = {1: 'a', 2: 'b', 3: 'c'}; diff --git a/lite_up/lib/constants/text.dart b/lite_up/lib/constants/text.dart index 2bc402e..09f2deb 100644 --- a/lite_up/lib/constants/text.dart +++ b/lite_up/lib/constants/text.dart @@ -1,17 +1,6 @@ // This file contains list of static texts that will be displayed in the app. import 'package:flutter/material.dart'; -const personalisation_1 = ["beginner", "bookworm", "bibliophile"]; - -const personalisation_2 = [ - "fiksi", - "politik", - "literatur", - "sejarah", - "finansial", - "Saya masih mencari genre kesukaan" -]; - const flashcards_1 = [ [ "Finansial", @@ -38,44 +27,3 @@ const flashcards_1 = [ "Jacques Pangemanann yang merupakan seorang komisaris polisi Hindia Belanda berdarah Minahasa dalam memberantas kelompok Si Pitung membuatnya ditugaskan untuk memata-matai aktivitas Minke. Tugas inilah yang membuat Jacques Pangemanann menjadi sosok yang bertanggung jawab dibalik pembuangan Minke ke pulau terpencil di Maluku Utara.[2]" ] ]; - -const quiz_1 = [ - [ - "Bulan Inklusi Keuangan ada di bulan?", - ["Oktober", "Januari", "Maret"], - 0 - ], - [ - "Sebuah kondisi dimana seseorang terlindungi secara finansial dari seluruh risiko adalah ...", - ["Financial Lock", "Financial Burden", "Financial Freedom"], - 2 - ], - [ - "Kemampuan seseorang dalam memahami pentingnya perencanaan dan penerapan tata kelola keuangan yang baik adalah ...", - ["Kecerdasan finansial", "Kecerdasan belajar", "Kepintaran membaca"], - 0 - ], - [ - "Kebijakan apa yang diluncurkan Kemenkumham RI menjelang puncak KTT G20?", - [ - "Kebijakan visa rumah kedua", - "Kebijakan kewarganegaraan kedua", - "Kebijakan passport dua negara" - ], - 0 - ], - [ - "Apa yang terjadi pada tanggal 17 - 24 Juni 1916 di alun-alun Bandung?", - [ - "Kongres Serikat Islam", - "Inflasi dan perekonomian global", - "Kelestarian lingkungan" - ], - 0 - ], - [ - "Jacques adalah karakter utama di buku?", - ["Laskar Pelangi", "Rumah Kaca", "Bumi Manusia"], - 1 - ] -]; diff --git a/lite_up/lib/models/quiz_model.dart b/lite_up/lib/models/quiz_model.dart deleted file mode 100644 index 8649110..0000000 --- a/lite_up/lib/models/quiz_model.dart +++ /dev/null @@ -1,16 +0,0 @@ -class Quiz { - final String question; - final List choices; - final int correctIndex; - - // Constructor for Book object - Quiz( - {required this.question, - required this.choices, - required this.correctIndex}); - - @override - String toString() { - return "Quiz(question: $question, correctIndex: $correctIndex)"; - } -} diff --git a/lite_up/lib/screens/flashcard_screen.dart b/lite_up/lib/screens/flashcard_screen.dart index e0ac8d3..fef6855 100644 --- a/lite_up/lib/screens/flashcard_screen.dart +++ b/lite_up/lib/screens/flashcard_screen.dart @@ -3,7 +3,6 @@ import 'dart:ffi'; import 'package:flutter/material.dart'; import 'package:flutter_sound/flutter_sound.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:lite_up/screens/quiz_screen.dart'; import 'package:lite_up/widgets/record_button.dart'; import 'package:permission_handler/permission_handler.dart'; import '../api/sound_recorder.dart'; @@ -37,8 +36,7 @@ class _FlashcardScreenState extends State { // Create a function to display the next flashcard void nextFlashcard() { if (index == flashcards.length - 1) { - Navigator.push(context, - MaterialPageRoute(builder: (context) => const QuizScreen())); + return; } else { setState(() { // Increments the index to rebuild the app to show next flashcard @@ -95,7 +93,7 @@ class _FlashcardScreenState extends State { children: [ Row(mainAxisAlignment: MainAxisAlignment.center, children: [ for (var i = 0; i < flashcards.length; i++) - if (i <= index) + if (i == index) Padding( padding: const EdgeInsets.symmetric(horizontal: 5), child: Image.asset( @@ -108,22 +106,21 @@ class _FlashcardScreenState extends State { ]), // Add the flashcard widget FlashcardWidget( - indexAction: index, - currentFlashcard: flashcards[index], - totalFlashcards: flashcards.length, - nextFlashcard: nextFlashcard, - previousFlashcard: previousFlashcard), + indexAction: index, + currentFlashcard: flashcards[index], + totalFlashcards: flashcards.length, + nextFlashcard: nextFlashcard, + previousFlashcard: previousFlashcard + ), // Add the recorder and audio button //Center(child: RecordButton(recorder: recorder)) Row(mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20, vertical: 10), + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), child: Image.asset('lib/assets/images/recorder_icon.png')), Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20, vertical: 10), + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), child: Image.asset( 'lib/assets/images/audioPlayer_icon.png')) ]) diff --git a/lite_up/lib/screens/personalisation_screen.dart b/lite_up/lib/screens/personalisation_screen.dart deleted file mode 100644 index baf5163..0000000 --- a/lite_up/lib/screens/personalisation_screen.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:lite_up/widgets/login_button.dart'; -import 'package:lite_up/widgets/signup_button.dart'; -import '../constants/style.dart'; -import '../constants/text.dart'; -import '../models/flashcard_model.dart'; -import '../widgets/flashcard_widget.dart'; -import '../widgets/next_button.dart'; -import '../widgets/personalisation_button.dart'; -import '../widgets/start_button.dart'; -import 'flashcard_screen.dart'; - -/* -PersonalisationScreen widget is stateful because it is our parent widget and therefore -all the functions and variables will be in this widget. As a consequence, we -will need to change the state of our widget. -*/ -class PersonalisationScreen extends StatefulWidget { - const PersonalisationScreen({Key? key}) : super(key: key); - - @override - State createState() => _PersonalisationScreenState(); -} - -class _PersonalisationScreenState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - body: SingleChildScrollView( - child: Container( - decoration: primaryBackground, - alignment: Alignment.center, - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - child: Column(children: [ - Container( - margin: const EdgeInsets.only(top: 157), - child: Text('Kita ingin membuat LiteUp spesial untuk kamu!', - style: GoogleFonts.poppins(textStyle: appBarTitle), - textAlign: TextAlign.center)), - Container( - alignment: Alignment.centerLeft, - margin: const EdgeInsets.only(top: 30, left: 30), - child: Text( - 'Tipe pembaca apakah kamu?', - style: - GoogleFonts.poppins(textStyle: personalisationTextstyle), - )), - Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - for (var text in personalisation_1) - Container( - margin: - const EdgeInsets.symmetric(horizontal: 5, vertical: 5), - child: PersonalisationButton(buttonText: text)) - ]), - Container( - alignment: Alignment.centerLeft, - margin: const EdgeInsets.only(top: 10, left: 30, bottom: 5), - child: Text( - 'Genre apa yang kamu suka?', - style: - GoogleFonts.poppins(textStyle: personalisationTextstyle), - )), - Wrap( - alignment: WrapAlignment.center, - children: [ - for (var text in personalisation_2) - Container( - margin: const EdgeInsets.symmetric( - horizontal: 5, vertical: 0), - child: PersonalisationButton(buttonText: text)) - ]), - Container( - margin: const EdgeInsets.only(top: 50), - child: const StartButton(buttonText: 'Masuk')) - ])), - )); - } -} diff --git a/lite_up/lib/screens/quiz_screen.dart b/lite_up/lib/screens/quiz_screen.dart deleted file mode 100644 index 97224d3..0000000 --- a/lite_up/lib/screens/quiz_screen.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'dart:ffi'; - -import 'package:flutter/material.dart'; -import 'package:flutter_sound/flutter_sound.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:lite_up/widgets/blueEnd_button.dart'; -import 'package:lite_up/widgets/record_button.dart'; -import 'package:permission_handler/permission_handler.dart'; -import '../api/sound_recorder.dart'; -import '../constants/style.dart'; -import '../constants/text.dart'; -import '../models/quiz_model.dart'; -import '../widgets/quiz_widget.dart'; -import '../widgets/next_button.dart'; -import 'homepage_screen.dart'; - -/* -QuizScreen widget is stateful because it is our parent widget and therefore -all the functions and variables will be in this widget. As a consequence, we -will need to change the state of our widget. -*/ -class QuizScreen extends StatefulWidget { - const QuizScreen({Key? key}) : super(key: key); - - @override - State createState() => _QuizScreenState(); -} - -class _QuizScreenState extends State { - List Quizes = [ - for (var i = 0; i < quiz_1.length; i++) - Quiz( - question: quiz_1[i][0] as String, - choices: quiz_1[i][1] as List, - correctIndex: quiz_1[i][2] as int) - ]; - - // Create an index to loop through Quizes - int index = 0; - - @override - Widget build(BuildContext context) { - return Scaffold( - // Set background color - backgroundColor: background, - - // Set the top app bar - appBar: AppBar( - title: Text('Level 1 Quiz', - style: GoogleFonts.poppins(textStyle: appBarTitle)), - backgroundColor: white, - foregroundColor: Colors.black, - elevation: 0), - - // Set the body of the app - body: SingleChildScrollView( - child: Container( - decoration: primaryBackground, - alignment: Alignment.center, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - for (var i = 0; i < Quizes.length; i++) - // Add the Quiz widget - QuizWidget(quiz: Quizes[i]), - Container( - alignment: Alignment.center, - margin: const EdgeInsets.symmetric(vertical: 20), - child: const BlueEndButton( - nextPage: HomeScreen(), buttonText: 'Kirim')), - ], - ))), - ); - } -} diff --git a/lite_up/lib/widgets/blueEnd_button.dart b/lite_up/lib/widgets/blueEnd_button.dart deleted file mode 100644 index f83e102..0000000 --- a/lite_up/lib/widgets/blueEnd_button.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; -import '../constants/style.dart'; -import '../screens/flashcard_screen.dart'; -import '../screens/homepage_screen.dart'; -import '../screens/personalisation_screen.dart'; - -class BlueEndButton extends StatelessWidget { - const BlueEndButton({Key? key, required this.nextPage, required this.buttonText}) : super(key: key); - - final StatefulWidget nextPage; - final String buttonText; - - @override - Widget build(BuildContext context) { - return ElevatedButton( - style: ElevatedButton.styleFrom( - primary: skyBlue, - padding: const EdgeInsets.symmetric(horizontal: 120, vertical: 15), - shape: const StadiumBorder()), - onPressed: () { - Navigator.push( - context, MaterialPageRoute(builder: (context) => nextPage)); - }, - child: Text(buttonText, - style: GoogleFonts.poppins(textStyle: loginButtonTextStyle))); - } -} diff --git a/lite_up/lib/widgets/login_button.dart b/lite_up/lib/widgets/login_button.dart index 23a32bd..60094db 100644 --- a/lite_up/lib/widgets/login_button.dart +++ b/lite_up/lib/widgets/login_button.dart @@ -3,7 +3,6 @@ import 'package:google_fonts/google_fonts.dart'; import '../constants/style.dart'; import '../screens/flashcard_screen.dart'; import '../screens/homepage_screen.dart'; -import '../screens/personalisation_screen.dart'; class LoginButton extends StatelessWidget { const LoginButton({Key? key}) : super(key: key); diff --git a/lite_up/lib/widgets/personalisation_button.dart b/lite_up/lib/widgets/personalisation_button.dart deleted file mode 100644 index 3edd040..0000000 --- a/lite_up/lib/widgets/personalisation_button.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; -import '../constants/style.dart'; -import '../screens/flashcard_screen.dart'; -import '../screens/homepage_screen.dart'; -import '../screens/personalisation_screen.dart'; - -class PersonalisationButton extends StatefulWidget { - const PersonalisationButton({Key? key, required this.buttonText}) - : super(key: key); - - final String buttonText; - - @override - State createState() => _PersonalisationButtonState(); -} - -class _PersonalisationButtonState extends State { - bool isPressed = false; - Color primary = white; - Color textColor = grayish; - - void pressed() { - if (isPressed) { - setState(() { - isPressed = false; - primary = white; - textColor = grayish; - }); - } else { - setState(() { - isPressed = true; - primary = deepYellow; - textColor = white; - }); - } - } - - @override - Widget build(BuildContext context) { - return ElevatedButton( - onPressed: () { - pressed(); - }, - style: ElevatedButton.styleFrom( - minimumSize: Size(100, 30), side: BorderSide(width: 1, color:deepYellow), - padding: const EdgeInsets.symmetric(horizontal: 20), - elevation: 0, - primary: primary, - shape: const StadiumBorder(), - textStyle: TextStyle( - color: textColor, fontSize: 13, fontWeight: FontWeight.w500)), - child: Text( - widget.buttonText, - style: GoogleFonts.poppins(textStyle: TextStyle( - color: textColor, fontSize: 13, fontWeight: FontWeight.w500)), - ), - ); - } -} diff --git a/lite_up/lib/widgets/quiz_widget.dart b/lite_up/lib/widgets/quiz_widget.dart deleted file mode 100644 index a9f5aff..0000000 --- a/lite_up/lib/widgets/quiz_widget.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:lite_up/screens/flashcard_screen.dart'; -import '../constants/style.dart'; -import '../models/quiz_model.dart'; - -class QuizWidget extends StatefulWidget { - const QuizWidget({Key? key, required this.quiz}) : super(key: key); - - final Quiz quiz; - - @override - State createState() => _QuizWidgetState(); -} - -class _QuizWidgetState extends State { - bool isPressed = false; - Color primary = white; - int choicePressed = -1; - - void pressed(i) { - if (isPressed) { - setState(() { - isPressed = false; - primary = white; - }); - } else { - setState(() { - isPressed = true; - primary = deepYellow; - choicePressed = i; - }); - } - } - - @override - Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric(vertical: 10, horizontal: 30), - color: Colors.transparent, - alignment: Alignment.centerLeft, - child: - Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text( - widget.quiz.question, - textAlign: TextAlign.left, - style: GoogleFonts.poppins(textStyle: personalisationTextstyle), - ), - for (int i = 0; i < widget.quiz.choices.length; i++) - Row( - children: [ - Container( - margin: - const EdgeInsets.symmetric(vertical: 3, horizontal: 0), - decoration: BoxDecoration( - color: i == choicePressed ? primary : white, - shape: BoxShape.circle, - border: Border.all(color: deepYellow)), - width: 35, - height: 35, - child: TextButton( - onPressed: () { - pressed(i); - }, - child: Text(mapNumberToLetter[i + 1] as String, - style: GoogleFonts.poppins( - textStyle: personalisationTextstyle)))), - Container( - alignment: Alignment.centerLeft, - margin: const EdgeInsets.symmetric( - vertical: 10, horizontal: 10), - child: Text(widget.quiz.choices[i], - style: GoogleFonts.poppins( - textStyle: personalisationTextstyle))) - ], - ) - ])); - } -} diff --git a/lite_up/lib/widgets/signup_button.dart b/lite_up/lib/widgets/signup_button.dart index 2512e7c..3e821df 100644 --- a/lite_up/lib/widgets/signup_button.dart +++ b/lite_up/lib/widgets/signup_button.dart @@ -3,7 +3,6 @@ import 'package:google_fonts/google_fonts.dart'; import '../constants/style.dart'; import '../screens/flashcard_screen.dart'; import '../screens/homepage_screen.dart'; -import '../screens/personalisation_screen.dart'; class SignUpButton extends StatelessWidget { const SignUpButton({Key? key}) : super(key: key); @@ -18,7 +17,7 @@ class SignUpButton extends StatelessWidget { shape: const StadiumBorder()), onPressed: () { Navigator.push(context, - MaterialPageRoute(builder: (context) => const PersonalisationScreen())); + MaterialPageRoute(builder: (context) => const HomeScreen())); }, child: Text("Daftar", style: GoogleFonts.montserrat(textStyle: signUpButtonTextStyle))); diff --git a/lite_up/lib/widgets/start_button.dart b/lite_up/lib/widgets/start_button.dart deleted file mode 100644 index ca2a8e0..0000000 --- a/lite_up/lib/widgets/start_button.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; -import '../constants/style.dart'; -import '../screens/flashcard_screen.dart'; -import '../screens/homepage_screen.dart'; - -class StartButton extends StatefulWidget { - const StartButton({Key? key, required this.buttonText}) : super(key: key); - - final String buttonText; - - @override - State createState() => _StartButtonState(); -} - -class _StartButtonState extends State { - bool isPressed = false; - Color primary = lightGray; - Color textColor = white; - - void pressed() { - if (isPressed) { - Navigator.push(context, - MaterialPageRoute(builder: (context) => const HomeScreen())); - } else { - setState(() { - isPressed = true; - primary = deepOrange; - textColor = white; - }); - } - } - - @override - Widget build(BuildContext context) { - return ElevatedButton( - style: ElevatedButton.styleFrom( - primary: primary, - padding: const EdgeInsets.symmetric(horizontal: 120, vertical: 15), - shape: const StadiumBorder()), - onPressed: () { - pressed(); - }, - child: Text(widget.buttonText, - style: GoogleFonts.montserrat(textStyle: loginButtonTextStyle))); - } -}