File tree Expand file tree Collapse file tree 2 files changed +34
-25
lines changed Expand file tree Collapse file tree 2 files changed +34
-25
lines changed Original file line number Diff line number Diff line change 1+ import 'package:flashcard_project/design_system.dart' ;
2+ import 'package:flashcard_project/ui/screen/lesson_selector_screen.dart' ;
3+ import 'package:flutter/material.dart' ;
4+
5+ class CompletionWidget extends StatelessWidget {
6+ final VoidCallback onPressed;
7+ const CompletionWidget ({required this .onPressed, Key ? key}) : super (key: key);
8+
9+ @override
10+ Widget build (BuildContext context) {
11+ return Column (
12+ mainAxisAlignment: MainAxisAlignment .center,
13+ children: [
14+ const Text ("Congratulations! You finished all your cards." ),
15+ const SizedBox (height: Insets .medium),
16+ ElevatedButton (
17+ onPressed: onPressed,
18+ child: const Text ("Repeat Lesson" ),
19+ ),
20+ const SizedBox (height: Insets .medium),
21+ ElevatedButton (
22+ onPressed: () {
23+ LessonSelectorScreen .navigateTo (context);
24+ },
25+ child: const Text ("Back to Lecture Selection" ),
26+ )
27+ ],
28+ );
29+ }
30+ }
Original file line number Diff line number Diff line change 11import 'package:flashcard_project/design_system.dart' ;
22import 'package:flashcard_project/domain/flashcard_service.dart' ;
33import 'package:flashcard_project/repository/sheet_repo.dart' ;
4- import 'package:flashcard_project/ui/screen/lesson_selector_screen .dart' ;
4+ import 'package:flashcard_project/ui/screen/home/completion_widget .dart' ;
55import 'package:flutter/material.dart' ;
66
77class HomePage extends StatefulWidget {
@@ -69,7 +69,9 @@ class _HomePageState extends State<HomePage> {
6969 if (snapshot.hasData) {
7070 return Expanded (
7171 child: allCardsFinished
72- ? _buildLoadingSpinner ()
72+ ? CompletionWidget (onPressed: () {
73+ init = startLesson ();
74+ })
7375 : IgnorePointer (
7476 ignoring: cardFlipped,
7577 child: InkWell (
@@ -148,27 +150,4 @@ class _HomePageState extends State<HomePage> {
148150 currentQuestionAndAnswer = questionAnswerList.removeAt (0 );
149151 });
150152 }
151-
152- Column _buildLoadingSpinner () {
153- return Column (
154- mainAxisAlignment: MainAxisAlignment .center,
155- children: [
156- const Text ("Congratulations! You finished all your cards." ),
157- const SizedBox (height: Insets .medium),
158- ElevatedButton (
159- onPressed: () {
160- init = startLesson ();
161- },
162- child: const Text ("Repeat Lesson" ),
163- ),
164- const SizedBox (height: Insets .medium),
165- ElevatedButton (
166- onPressed: () {
167- LessonSelectorScreen .navigateTo (context);
168- },
169- child: const Text ("Back to Lecture Selection" ),
170- )
171- ],
172- );
173- }
174153}
You can’t perform that action at this time.
0 commit comments