diff --git a/README-pt.md b/README-pt.md
index fdce2fe..a7caafd 100644
--- a/README-pt.md
+++ b/README-pt.md
@@ -8,7 +8,7 @@
- ✅ Maximum Speed 🏃♂️
- ✅ In Orbit 👨🚀
- ✅ Landing 🔥
-- 🔄 Surface Exploration ⚡
+- ✅ Surface Exploration ⚡
- 🔄 Acelerando sua Carreira 🚀
---
@@ -34,17 +34,18 @@
Sobre 📖
-
-
-
-
+ Esse projeto foi desenvolvido na Next Level Week, uma semana intensa de estudos, networking, amizade, trabalho em grupo, acompanhado de um projeto sensacional desenvolvido pela Rocketseat do dia 19 ao dia 25 de Abril.
+ Essa aplicação tem como intuito ser um Quiz para programadores intensificarem seu conhecimento em programação através dos exercícios propostos pela aplicação, onde você tem a interatividade de perguntas e respostas.
+ É um projeto básico até aqui, mas que abre muitas portas para ideias, features, parcerias, e muito aprendizado que irei levar para o meu profissional.Mais uma semana NLW concluída com sucesso e muita presença na comunidade, ajudando outras pessoas e tirando dúvidas das mesmas. Foi incrível!
---
Preview 📱
- > *
+
+
+
---
@@ -62,15 +63,14 @@
--
- - ,
- - ,
- - ,
- - .
-
--
-
--
+- Quiz
+ - Perguntas,
+ - Respostas,
+ - Feedback para o usuário,
+ - Ranking e Score,
+ - Resultados
+ - Compartilhamento de Resultados...
+- Entre várias outras coisas incríveis!
@@ -79,10 +79,10 @@
Desafios e Aprendizados no Caminho 🤯
-
-
-
-
+ Esse projeto foi desafiador pra mim e para toda a comunidade. Um aplicativo simples, mas que foi bem estruturado e organizado.
+ Tive vários erros no caminho, mas já percebo que estou muito mais maduro com os erros que cometia antes, me sentindo mais confiante e seguro do que nunca sobre o que faço, e essa semana da NLW me ajudou bastante e analisar e ver os caminhos onde posso e quero seguir.
+ A comunidade no Discord do evento foi sensacional, muitas pessoas com boas intenções e querendo evoluir uns com os outros...
+ Ahhh, já estou com saudades! Ansioso por novos eventos!
---
@@ -116,15 +116,15 @@
Como Contribuir 💪
```
- - Fork the project
+ - Fork o projeto
- - Create a new branch with your changes:
+ - Cria uma nova branch com suas mudanças:
$ git checkout -b my-feature
- - Save your changes and create a commit message telling you what you did:
+ - Salve suas mudanças e crie uma mensagem de commit falando o que fez:
$ git commit -m "feature: My new feature"
- - Submit your changes:
+ - Envie suas mudanças:
$ git push origin my-feature
```
diff --git a/README.md b/README.md
index 947b43e..af10cdf 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
- ✅ Maximum Speed 🏃♂️
- ✅ In Orbit 👨🚀
- ✅ Landing 🔥
-- 🔄 Surface Exploration ⚡
+- ✅ Surface Exploration ⚡
- 🔄 Accelerating your Career 🚀
---
@@ -32,19 +32,20 @@
---
About 📖
-
+
-
-
-
-
+ This project was developed at Next Level Week, an intense week of studies, networking, friendship, group work, accompanied by a sensational project developed by Rocketseat from the 19th to the 25th of April.
+ This application is intended to be a Quiz for programmers to intensify their knowledge in programming through the exercises proposed by the application, where you have interactivity of questions and answers.
+ It is a basic project so far, but it opens many doors for ideas, features, partnerships, and a lot of learning that I will take to my professional. Another NLW week concluded successfully and with a lot of presence in the community, helping other people and taking questions from same. It was incredible!
---
Preview 📱
- > *
+
+
+
---
@@ -62,15 +63,14 @@
--
- - ,
- - ,
- - ,
- - .
-
--
-
--
+- Quiz
+ - Questions,
+ - Answers,
+ - User feedback,
+ - Ranking and Score,
+ - Results
+ - Sharing Results ...
+- Among many other amazing things!
@@ -79,10 +79,10 @@
Challenges and Learnings along the way 🤯
-
-
-
-
+ This project was challenging for me and the whole community. A simple application, but it was well structured and organized.
+ I had several mistakes along the way, but I already realize that I am much more mature with the mistakes I made before, feeling more confident and confident than ever about what I do, and this week at NLW helped me a lot and to analyze and see the paths where I can and I want to continue.
+ The community at the event's Discord was sensational, many people with good intentions and wanting to evolve with each other ...
+ Ahhh, I miss you already! Looking forward to new events!
---
diff --git a/assets/database/quizzes.json b/assets/database/quizzes.json
index 8fb2f08..1859492 100644
--- a/assets/database/quizzes.json
+++ b/assets/database/quizzes.json
@@ -1,26 +1,130 @@
[
{
"title": "Flutter in NLW",
- "image": "blocks",
+ "image": "assets/images/blocks.png",
+ "questionAnswered": 0,
+ "level": "easy",
+ "questions": [
+ {
+ "title": "Did you like Next Level Week?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ },
+ {
+ "title": "Did you like Flutter and Dart?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ }
+ ]
+ },
+ {
+ "title": "Code Flutter",
+ "image": "assets/images/laptop.png",
+ "questionAnswered": 1,
+ "level": "easy",
+ "questions": [
+ {
+ "title": "Did you like Next Level Week?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ },
+ {
+ "title": "Did you like Flutter and Dart?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ }
+ ]
+ },
+ {
+ "title": "Flutter & Dart",
+ "image": "assets/images/hierarchy.png",
+ "questionAnswered": 0,
+ "level": "easy",
+ "questions": [
+ {
+ "title": "Did you like Next Level Week?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ },
+ {
+ "title": "Did you like Flutter and Dart?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ }
+ ]
+ },
+ {
+ "title": "Flutter - Intro",
+ "image": "assets/images/check.png",
+ "questionAnswered": 2,
+ "level": "easy",
+ "questions": [
+ {
+ "title": "Did you like Next Level Week?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ },
+ {
+ "title": "Did you like Flutter and Dart?",
+ "answers": [
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
+ ]
+ }
+ ]
+ },
+ {
+ "title": "Dart POO",
+ "image": "assets/images/data.png",
"questionAnswered": 1,
"level": "easy",
"questions": [
{
- "title": "You are liking Flutter?",
+ "title": "Did you like Next Level Week?",
"answers": [
- {"title": "Like"},
- {"title": "Don't like"},
- {"title": "+/-"},
- {"title": "Flutter is sensational", "isRight": true}
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
]
},
{
- "title": "You are liking Flutter?",
+ "title": "Did you like Flutter and Dart?",
"answers": [
- {"title": "Like"},
- {"title": "Don't like"},
- {"title": "+/-"},
- {"title": "Flutter is sensational", "isRight": true}
+ {"title": "Liked it"},
+ {"title": "Hm... yes..."},
+ {"title": "It was Amazing"},
+ {"title": "Sensational, great week and Project", "isRight": true}
]
}
]
diff --git a/assets/database/user.json b/assets/database/user.json
index 85da5c7..898bcad 100644
--- a/assets/database/user.json
+++ b/assets/database/user.json
@@ -1,5 +1,5 @@
{
"name": "Felipe Sales",
- "score": 75,
+ "score": 100,
"photoUrl": "https://avatars.githubusercontent.com/u/59374587"
}
\ No newline at end of file
diff --git a/assets/images/devquiz.gif b/assets/images/devquiz.gif
new file mode 100644
index 0000000..08dbdd7
Binary files /dev/null and b/assets/images/devquiz.gif differ
diff --git a/assets/images/trophy.png b/assets/images/trophy.png
index 9aa1da6..59d4302 100644
Binary files a/assets/images/trophy.png and b/assets/images/trophy.png differ
diff --git a/lib/challenge/challenge_controller.dart b/lib/challenge/challenge_controller.dart
index 64c1ab3..17e386b 100644
--- a/lib/challenge/challenge_controller.dart
+++ b/lib/challenge/challenge_controller.dart
@@ -4,4 +4,6 @@ class ChallengeController {
final currentPageNotifier = ValueNotifier(1);
int get currentPage => currentPageNotifier.value;
set currentPage(int value) => currentPageNotifier.value = value;
+
+ int quantityAnswer = 0;
}
diff --git a/lib/challenge/challenge_page.dart b/lib/challenge/challenge_page.dart
index d2a8f1d..ce879dd 100644
--- a/lib/challenge/challenge_page.dart
+++ b/lib/challenge/challenge_page.dart
@@ -3,12 +3,16 @@ import 'package:flutter/material.dart';
import 'challenge_controller.dart';
import 'widgets/question_indicator/question_indicator_widget.dart';
import 'widgets/quiz/quiz_widget.dart';
+import 'package:devquiz/result/result_page.dart';
import 'package:devquiz/shared/models/question_model.dart';
import 'widgets/next_button/next_button_widget.dart';
class ChallengePage extends StatefulWidget {
final List questions;
- ChallengePage({Key? key, required this.questions}) : super(key: key);
+ final String title;
+
+ ChallengePage({Key? key, required this.questions, required this.title})
+ : super(key: key);
@override
_ChallengePageState createState() => _ChallengePageState();
@@ -28,10 +32,17 @@ class _ChallengePageState extends State {
void nextPage() {
if (controller.currentPage < widget.questions.length)
- pageController.nextPage(
- duration: Duration(milliseconds: 500),
- curve: Curves.linear,
- );
+ pageController.nextPage(
+ duration: Duration(milliseconds: 500),
+ curve: Curves.linear,
+ );
+ }
+
+ void onSelected(bool value) {
+ if (value) {
+ controller.quantityAnswer++;
+ }
+ nextPage();
}
@override
@@ -61,9 +72,10 @@ class _ChallengePageState extends State {
controller: pageController,
children: widget.questions
.map((e) => QuizWidget(
- question: e,
- onChanged: nextPage,
- )).toList(),
+ question: e,
+ onSelected: onSelected,
+ ))
+ .toList(),
),
bottomNavigationBar: SafeArea(
bottom: true,
@@ -71,27 +83,35 @@ class _ChallengePageState extends State {
padding: const EdgeInsets.symmetric(horizontal: 20),
child: ValueListenableBuilder(
valueListenable: controller.currentPageNotifier,
- builder: (context, value, _) =>
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- if (value < widget.questions.length)
- Expanded(
- child: NextButtonWidget.white(
- label: 'Skip',
- onTap: nextPage,
- ),
+ builder: (context, value, _) => Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ if (value < widget.questions.length)
+ Expanded(
+ child: NextButtonWidget.white(
+ label: 'Skip',
+ onTap: nextPage,
),
- if (value == widget.questions.length)
- Expanded(
- child: NextButtonWidget.green(
- label: 'Confirm',
- onTap: () {
- Navigator.pop(context);
- },
- ),
+ ),
+ if (value == widget.questions.length)
+ Expanded(
+ child: NextButtonWidget.green(
+ label: 'Confirm',
+ onTap: () {
+ Navigator.pushReplacement(
+ context,
+ MaterialPageRoute(
+ builder: (context) => ResultPage(
+ title: widget.title,
+ length: widget.questions.length,
+ result: controller.quantityAnswer,
+ ),
+ ),
+ );
+ },
),
- ],
+ ),
+ ],
),
),
),
diff --git a/lib/challenge/widgets/answer/answer_widget.dart b/lib/challenge/widgets/answer/answer_widget.dart
index 5dfde8e..f5aaa4a 100644
--- a/lib/challenge/widgets/answer/answer_widget.dart
+++ b/lib/challenge/widgets/answer/answer_widget.dart
@@ -7,13 +7,13 @@ class AnswerWidget extends StatelessWidget {
final AnswerModel answer;
final bool isSelected;
final bool disabled;
- final VoidCallback onTap;
+ final ValueChanged onTap;
const AnswerWidget({
Key? key,
required this.answer,
required this.onTap,
- this.isSelected = false,
+ this.isSelected = false,
this.disabled = false,
}) : super(key: key);
@@ -41,17 +41,19 @@ class AnswerWidget extends StatelessWidget {
child: IgnorePointer(
ignoring: disabled,
child: GestureDetector(
- onTap: onTap,
+ onTap: () {
+ onTap(answer.isRight);
+ },
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: isSelected ? _selectedColorCardRight : AppColors.white,
borderRadius: BorderRadius.circular(10),
- border: Border.fromBorderSide(BorderSide(
- color: isSelected
- ? _selectedBorderCardRight
- : AppColors.border
- ),
+ border: Border.fromBorderSide(
+ BorderSide(
+ color: isSelected
+ ? _selectedBorderCardRight
+ : AppColors.border),
),
),
child: Row(
@@ -59,10 +61,10 @@ class AnswerWidget extends StatelessWidget {
children: [
Expanded(
child: Text(
- answer.title,
- style: isSelected
- ? _selectedTextStyleRight
- : AppTextStyles.body,
+ answer.title,
+ style: isSelected
+ ? _selectedTextStyleRight
+ : AppTextStyles.body,
),
),
SizedBox(width: 16),
@@ -74,15 +76,16 @@ class AnswerWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(500),
border: Border.fromBorderSide(
BorderSide(
- color: isSelected
- ? _selectedBorderRight
- : AppColors.border,
+ color: isSelected
+ ? _selectedBorderRight
+ : AppColors.border,
),
),
),
child: isSelected
- ? Icon(_selectedIconRight, color: AppColors.white, size: 16)
- : null,
+ ? Icon(_selectedIconRight,
+ color: AppColors.white, size: 16)
+ : null,
),
],
),
diff --git a/lib/challenge/widgets/next_button/next_button_widget.dart b/lib/challenge/widgets/next_button/next_button_widget.dart
index cc3eb3f..cdf03cf 100644
--- a/lib/challenge/widgets/next_button/next_button_widget.dart
+++ b/lib/challenge/widgets/next_button/next_button_widget.dart
@@ -22,6 +22,11 @@ class NextButtonWidget extends StatelessWidget {
this.fontColor = AppColors.white,
this.borderColor = AppColors.green;
+ NextButtonWidget.purple({required this.label, required this.onTap})
+ : this.backgroundColor = AppColors.purple,
+ this.fontColor = AppColors.white,
+ this.borderColor = AppColors.green;
+
NextButtonWidget.white({required this.label, required this.onTap})
: this.backgroundColor = AppColors.white,
this.fontColor = AppColors.grey,
diff --git a/lib/challenge/widgets/quiz/quiz_widget.dart b/lib/challenge/widgets/quiz/quiz_widget.dart
index 4e3e2fb..67b48e2 100644
--- a/lib/challenge/widgets/quiz/quiz_widget.dart
+++ b/lib/challenge/widgets/quiz/quiz_widget.dart
@@ -7,8 +7,8 @@ import 'package:devquiz/shared/models/question_model.dart';
class QuizWidget extends StatefulWidget {
final QuestionModel question;
- final VoidCallback onChanged;
- const QuizWidget({Key? key, required this.question, required this.onChanged})
+ final ValueChanged onSelected;
+ const QuizWidget({Key? key, required this.question, required this.onSelected})
: super(key: key);
@override
@@ -35,12 +35,11 @@ class _QuizWidgetState extends State {
answer: answer(i),
isSelected: indexSelected == i,
disabled: indexSelected != -1,
- onTap: () {
+ onTap: (value) {
indexSelected = i;
- widget.onChanged();
setState(() {});
Future.delayed(Duration(seconds: 1))
- .then((value) => widget.onChanged());
+ .then((_) => widget.onSelected(value));
},
),
],
diff --git a/lib/core/app_widget.dart b/lib/core/app_widget.dart
index 3c25ed5..f02105c 100644
--- a/lib/core/app_widget.dart
+++ b/lib/core/app_widget.dart
@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
-import 'package:devquiz/home/home_page.dart';
-//import 'package:devquiz/challenge/challenge_page.dart';
-// import 'package:devquiz/splash/splash_page.dart';
+import 'package:devquiz/splash/splash_page.dart';
class AppWidget extends StatelessWidget {
@override
@@ -10,7 +8,7 @@ class AppWidget extends StatelessWidget {
return MaterialApp(
title: 'DevQuiz',
debugShowCheckedModeBanner: false,
- home: HomePage(),
+ home: SplashPage(),
);
}
}
diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart
index b057dd8..250b749 100644
--- a/lib/home/home_page.dart
+++ b/lib/home/home_page.dart
@@ -66,16 +66,18 @@ class _HomePageState extends State {
onTap: (){
Navigator.push(context, MaterialPageRoute(
builder: (context) => ChallengePage(
- questions: e.questions
+ title: e.title,
+ questions: e.questions,
),
));
},
- percent: e.questionAnswered / e.questions.length,
+ percent: e.questionAnswered / e.questions.length,
+ image: e.image,
),
- )
- .toList(),
+ ).toList(),
),
),
+ SizedBox(height: 20),
],
),
),
diff --git a/lib/home/widgets/appbar/app_bar_widget.dart b/lib/home/widgets/appbar/app_bar_widget.dart
index f74023b..491dfed 100644
--- a/lib/home/widgets/appbar/app_bar_widget.dart
+++ b/lib/home/widgets/appbar/app_bar_widget.dart
@@ -48,7 +48,7 @@ class AppBarWidget extends PreferredSize {
),
Align(
alignment: Alignment(0.0, 1.0),
- child: ScoreCardWidget(),
+ child: ScoreCardWidget(percent: user.score / 100),
),
],
),
diff --git a/lib/home/widgets/chart/chart_widget.dart b/lib/home/widgets/chart/chart_widget.dart
index 74e9810..255405f 100644
--- a/lib/home/widgets/chart/chart_widget.dart
+++ b/lib/home/widgets/chart/chart_widget.dart
@@ -2,31 +2,63 @@ import 'package:flutter/material.dart';
import 'package:devquiz/core/core.dart';
-class ChartWidget extends StatelessWidget {
- const ChartWidget({Key? key}) : super(key: key);
+class ChartWidget extends StatefulWidget {
+ final double percent;
+ const ChartWidget({Key? key, required this.percent}) : super(key: key);
+
+ @override
+ _ChartWidgetState createState() => _ChartWidgetState();
+}
+
+class _ChartWidgetState extends State
+ with SingleTickerProviderStateMixin {
+ late AnimationController _controller;
+ late Animation _animation;
+
+ void initAnimation() {
+ _controller =
+ AnimationController(vsync: this, duration: Duration(seconds: 5));
+ _animation =
+ Tween(begin: 0.0, end: widget.percent).animate(_controller);
+ _controller.forward();
+ }
+
+ @override
+ void initState() {
+ initAnimation();
+ super.initState();
+ }
@override
Widget build(BuildContext context) {
return Container(
height: 80,
width: 80,
- child: Stack(
- children: [
- Center(
- child: Container(
- height: 80,
- width: 80,
- child: CircularProgressIndicator(
- strokeWidth: 10,
- value: .75,
- backgroundColor: AppColors.chartSecondary,
- valueColor:
- AlwaysStoppedAnimation(AppColors.chartPrimary),
+ child: AnimatedBuilder(
+ animation: _animation,
+ builder: (context, _) => Stack(
+ children: [
+ Center(
+ child: Container(
+ height: 80,
+ width: 80,
+ child: CircularProgressIndicator(
+ strokeWidth: 10,
+ value: _animation.value,
+ backgroundColor: AppColors.chartSecondary,
+ valueColor:
+ AlwaysStoppedAnimation(AppColors.chartPrimary),
+ ),
+ ),
+ ),
+ Center(
+ child: Text(
+ '${(_animation.value * 100).toInt()}%',
+ style: AppTextStyles.heading,
),
),
- ),
- Center(child: Text('75%', style: AppTextStyles.heading)),
- ],
+ ],
+ ),
),
);
}
diff --git a/lib/home/widgets/quiz_card/quiz_card_widget.dart b/lib/home/widgets/quiz_card/quiz_card_widget.dart
index 7d3919e..0e1616f 100644
--- a/lib/home/widgets/quiz_card/quiz_card_widget.dart
+++ b/lib/home/widgets/quiz_card/quiz_card_widget.dart
@@ -4,6 +4,7 @@ import 'package:devquiz/core/core.dart';
import 'package:devquiz/shared/widgets/progress_indicator/progress_indicator_widget.dart';
class QuizCardWidget extends StatelessWidget {
+ final String image;
final String title;
final String completed;
final double percent;
@@ -11,10 +12,11 @@ class QuizCardWidget extends StatelessWidget {
const QuizCardWidget({
Key? key,
+ required this.image,
required this.title,
required this.completed,
required this.percent,
- required this.onTap
+ required this.onTap,
}) : super(key: key);
@override
@@ -34,7 +36,7 @@ class QuizCardWidget extends StatelessWidget {
Container(
height: 40,
width: 40,
- child: Image.asset(AppImages.blocks),
+ child: Image.asset(image),
),
SizedBox(height: 14),
Text(title, style: AppTextStyles.heading15),
diff --git a/lib/home/widgets/score_card/score_card_widget.dart b/lib/home/widgets/score_card/score_card_widget.dart
index 10e8d1b..d531ff4 100644
--- a/lib/home/widgets/score_card/score_card_widget.dart
+++ b/lib/home/widgets/score_card/score_card_widget.dart
@@ -4,7 +4,8 @@ import 'package:devquiz/core/core.dart';
import 'package:devquiz/home/widgets/chart/chart_widget.dart';
class ScoreCardWidget extends StatelessWidget {
- const ScoreCardWidget({Key? key}) : super(key: key);
+ final double percent;
+ const ScoreCardWidget({Key? key, required this.percent}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -23,7 +24,7 @@ class ScoreCardWidget extends StatelessWidget {
children: [
Expanded(
flex: 1,
- child: ChartWidget(),
+ child: ChartWidget(percent: percent),
),
Expanded(
flex: 3,
@@ -34,14 +35,14 @@ class ScoreCardWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'Let\'s start',
+ 'Let\'s start',
style: AppTextStyles.heading,
),
Text(
'Complete challenges and advance knowledge :)',
style: AppTextStyles.body,
),
- ]
+ ],
),
),
),
diff --git a/lib/main.dart b/lib/main.dart
index a4dd67b..bfcf600 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
-import 'package:devquiz/home/home_page.dart';
-//import 'package:devquiz/challenge/challenge_page.dart';
-// import 'package:devquiz/splash/splash_page.dart';
+import 'package:devquiz/splash/splash_page.dart';
void main() {
runApp(MyApp());
@@ -14,7 +12,7 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'DevQuiz',
debugShowCheckedModeBanner: false,
- home: HomePage(),
+ home: SplashPage(),
);
}
}
diff --git a/lib/result/result_page.dart b/lib/result/result_page.dart
new file mode 100644
index 0000000..870e960
--- /dev/null
+++ b/lib/result/result_page.dart
@@ -0,0 +1,99 @@
+import 'package:flutter/material.dart';
+
+import 'package:devquiz/challenge/widgets/next_button/next_button_widget.dart';
+import 'package:devquiz/core/core.dart';
+import 'package:share_plus/share_plus.dart';
+
+class ResultPage extends StatelessWidget {
+ final String title;
+ final int length;
+ final int result;
+
+ const ResultPage(
+ {Key? key,
+ required this.title,
+ required this.length,
+ required this.result})
+ : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: Container(
+ width: double.maxFinite,
+ padding: const EdgeInsets.only(top: 50),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Image.asset(AppImages.trophy),
+ Column(
+ children: [
+ Text(
+ 'Congrats!',
+ textAlign: TextAlign.center,
+ style: AppTextStyles.heading40,
+ ),
+ SizedBox(height: 16),
+ Text.rich(
+ TextSpan(
+ text: 'You found',
+ style: AppTextStyles.body,
+ children: [
+ TextSpan(
+ text: '\n$title',
+ style: AppTextStyles.bodyBold,
+ ),
+ TextSpan(
+ text: '\nwith $result out of $length hits.',
+ style: AppTextStyles.body,
+ ),
+ ],
+ ),
+ textAlign: TextAlign.center,
+ ),
+ ],
+ ),
+ Column(
+ children: [
+ Row(
+ children: [
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 68),
+ child: NextButtonWidget.purple(
+ label: 'Share',
+ onTap: () {
+ Share.share(
+ 'DevQuiz NLW 5 - Quiz Result: $title\n'
+ 'Accuracy: $result / $length'
+ );
+ },
+ ),
+ ),
+ ),
+ ],
+ ),
+ SizedBox(height: 24),
+ Row(
+ children: [
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 68),
+ child: NextButtonWidget.white(
+ label: 'Back to Start',
+ onTap: () {
+ Navigator.pop(context);
+ }),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/splash/splash_page.dart b/lib/splash/splash_page.dart
index 33c1757..4cb810b 100644
--- a/lib/splash/splash_page.dart
+++ b/lib/splash/splash_page.dart
@@ -1,10 +1,16 @@
+import 'package:flutter/material.dart';
+
import 'package:devquiz/core/app_gradients.dart';
import 'package:devquiz/core/app_images.dart';
-import 'package:flutter/material.dart';
+import 'package:devquiz/home/home_page.dart';
class SplashPage extends StatelessWidget {
+
@override
Widget build(BuildContext context) {
+ Future.delayed(Duration(seconds: 2)).then((_) => Navigator.pushReplacement(
+ context, MaterialPageRoute(builder: (context) => HomePage()),
+ ));
return Scaffold(
body: Container(
decoration: BoxDecoration(
@@ -14,4 +20,4 @@ class SplashPage extends StatelessWidget {
),
);
}
-}
\ No newline at end of file
+}
diff --git a/pubspec.yaml b/pubspec.yaml
index 09d0913..8aa8e4c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -14,6 +14,7 @@ dependencies:
cupertino_icons: ^1.0.2
google_fonts: ^2.0.0
+ share_plus: ^2.0.1
dev_dependencies:
flutter_test: