-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from florentianayuwono/development
Interactive personalisation screen
- Loading branch information
Showing
13 changed files
with
460 additions
and
11 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Quiz { | ||
final String question; | ||
final List<String> 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)"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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<PersonalisationScreen> createState() => _PersonalisationScreenState(); | ||
} | ||
|
||
class _PersonalisationScreenState extends State<PersonalisationScreen> { | ||
@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')) | ||
])), | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
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<QuizScreen> createState() => _QuizScreenState(); | ||
} | ||
|
||
class _QuizScreenState extends State<QuizScreen> { | ||
List<Quiz> 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<String>, | ||
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')), | ||
], | ||
))), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.