@@ -250,10 +250,10 @@ steps:
250
250
TextButton(
251
251
onPressed:
252
252
viewModel.hasNextQuestion && viewModel.didAnswerQuestion
253
- ? () {
254
- viewModel.getNextQuestion();
255
- }
256
- : null,
253
+ ? () {
254
+ viewModel.getNextQuestion();
255
+ }
256
+ : null,
257
257
child: const Text('Next'),
258
258
),
259
259
],
@@ -268,10 +268,9 @@ steps:
268
268
viewModel.checkAnswer(index);
269
269
},
270
270
answers: viewModel.currentQuestion?.possibleAnswers ?? [],
271
- correctAnswer:
272
- viewModel.didAnswerQuestion
273
- ? viewModel.currentQuestion?.correctAnswer
274
- : null,
271
+ correctAnswer: viewModel.didAnswerQuestion
272
+ ? viewModel.currentQuestion?.correctAnswer
273
+ : null,
275
274
),
276
275
StatusBar(viewModel: viewModel),
277
276
],
@@ -438,8 +437,9 @@ steps:
438
437
Icon(
439
438
Icons.star,
440
439
size: 50,
441
- color:
442
- score < i + 1 ? Colors.grey.shade400 : Colors.yellow.shade700,
440
+ color: score < i + 1
441
+ ? Colors.grey.shade400
442
+ : Colors.yellow.shade700,
443
443
),
444
444
],
445
445
),
@@ -466,7 +466,7 @@ steps:
466
466
import 'view_model.dart';
467
467
468
468
class QuestionScreen extends StatefulWidget {
469
- @@ -160 ,13 +161 ,9 @@ class StatusBar extends StatelessWidget {
469
+ @@ -159 ,13 +160 ,9 @@ class StatusBar extends StatelessWidget {
470
470
child: Row(
471
471
mainAxisAlignment: MainAxisAlignment.spaceAround,
472
472
children: [
@@ -497,15 +497,16 @@ steps:
497
497
patch-u : |
498
498
--- b/animations/step_02_c/lib/scoreboard.dart
499
499
+++ a/animations/step_02_c/lib/scoreboard.dart
500
- @@ -18,14 +18,31 @@ class Scoreboard extends StatelessWidget {
500
+ @@ -18,15 +18,31 @@ class Scoreboard extends StatelessWidget {
501
501
mainAxisAlignment: MainAxisAlignment.center,
502
502
children: [
503
503
for (var i = 0; i < totalQuestions; i++)
504
504
- Icon(
505
505
- Icons.star,
506
506
- size: 50,
507
- - color:
508
- - score < i + 1 ? Colors.grey.shade400 : Colors.yellow.shade700,
507
+ - color: score < i + 1
508
+ - ? Colors.grey.shade400
509
+ - : Colors.yellow.shade700,
509
510
- ),
510
511
+ AnimatedStar(isActive: score > i),
511
512
],
@@ -616,7 +617,7 @@ steps:
616
617
patch-u : |
617
618
--- b/animations/step_03_a/lib/question_screen.dart
618
619
+++ a/animations/step_03_a/lib/question_screen.dart
619
- @@ -86 ,13 +86 ,17 @@ class QuestionCard extends StatelessWidget {
620
+ @@ -85 ,13 +85 ,17 @@ class QuestionCard extends StatelessWidget {
620
621
621
622
@override
622
623
Widget build(BuildContext context) {
@@ -655,7 +656,7 @@ steps:
655
656
patch-u : |
656
657
--- b/animations/step_03_b/lib/question_screen.dart
657
658
+++ a/animations/step_03_b/lib/question_screen.dart
658
- @@ -87 ,6 +87 ,16 @@ class QuestionCard extends StatelessWidget {
659
+ @@ -86 ,6 +86 ,16 @@ class QuestionCard extends StatelessWidget {
659
660
@override
660
661
Widget build(BuildContext context) {
661
662
return AnimatedSwitcher(
@@ -686,7 +687,7 @@ steps:
686
687
patch-u : |
687
688
--- b/animations/step_03_c/lib/question_screen.dart
688
689
+++ a/animations/step_03_c/lib/question_screen.dart
689
- @@ -95 ,7 +95 ,11 @@ class QuestionCard extends StatelessWidget {
690
+ @@ -94 ,7 +94 ,11 @@ class QuestionCard extends StatelessWidget {
690
691
begin: Offset(-0.1, 0.0),
691
692
end: Offset.zero,
692
693
).animate(curveAnimation);
@@ -713,7 +714,7 @@ steps:
713
714
patch-u : |
714
715
--- b/animations/step_03_d/lib/question_screen.dart
715
716
+++ a/animations/step_03_d/lib/question_screen.dart
716
- @@ -87 ,6 +87 ,15 @@ class QuestionCard extends StatelessWidget {
717
+ @@ -86 ,6 +86 ,15 @@ class QuestionCard extends StatelessWidget {
717
718
@override
718
719
Widget build(BuildContext context) {
719
720
return AnimatedSwitcher(
@@ -801,14 +802,13 @@ steps:
801
802
builder: (context, child) {
802
803
return Transform(
803
804
alignment: Alignment.center,
804
- transform:
805
- Matrix4.identity()..rotateX(_animationController.value * math.pi),
806
- child:
807
- _animationController.isAnimating
808
- ? _animationController.value < 0.5
809
- ? _previousChild
810
- : Transform.flip(flipY: true, child: child)
811
- : child,
805
+ transform: Matrix4.identity()
806
+ ..rotateX(_animationController.value * math.pi),
807
+ child: _animationController.isAnimating
808
+ ? _animationController.value < 0.5
809
+ ? _previousChild
810
+ : Transform.flip(flipY: true, child: child)
811
+ : child,
812
812
);
813
813
},
814
814
child: widget.child,
@@ -826,7 +826,7 @@ steps:
826
826
import 'scoreboard.dart';
827
827
import 'view_model.dart';
828
828
829
- @@ -149 ,21 +150 ,24 @@ class AnswerCards extends StatelessWidget {
829
+ @@ -148 ,21 +149 ,24 @@ class AnswerCards extends StatelessWidget {
830
830
if (correctAnswer == index) {
831
831
color = Theme.of(context).colorScheme.tertiaryContainer;
832
832
}
@@ -899,7 +899,7 @@ steps:
899
899
patch-u : |
900
900
--- b/animations/step_04_b/lib/question_screen.dart
901
901
+++ a/animations/step_04_b/lib/question_screen.dart
902
- @@ -151 ,6 +151 ,7 @@ class AnswerCards extends StatelessWidget {
902
+ @@ -150 ,6 +150 ,7 @@ class AnswerCards extends StatelessWidget {
903
903
color = Theme.of(context).colorScheme.tertiaryContainer;
904
904
}
905
905
return CardFlipEffect(
@@ -968,7 +968,7 @@ steps:
968
968
patch-u : |
969
969
--- b/animations/step_04_d/lib/flip_effect.dart
970
970
+++ a/animations/step_04_d/lib/flip_effect.dart
971
- @@ -66,15 +66,15 @@ class _CardFlipEffectState extends State<CardFlipEffect>
971
+ @@ -66,14 +66,14 @@ class _CardFlipEffectState extends State<CardFlipEffect>
972
972
@override
973
973
Widget build(BuildContext context) {
974
974
return AnimatedBuilder(
@@ -977,16 +977,15 @@ steps:
977
977
builder: (context, child) {
978
978
return Transform(
979
979
alignment: Alignment.center,
980
- transform:
981
- - Matrix4.identity()..rotateX(_animationController.value * math.pi),
982
- + Matrix4.identity()..rotateX(_animationWithDelay.value * math.pi),
983
- child:
984
- _animationController.isAnimating
985
- - ? _animationController.value < 0.5
986
- + ? _animationWithDelay.value < 0.5
987
- ? _previousChild
988
- : Transform.flip(flipY: true, child: child)
989
- : child,
980
+ transform: Matrix4.identity()
981
+ - ..rotateX(_animationController.value * math.pi),
982
+ + ..rotateX(_animationWithDelay.value * math.pi),
983
+ child: _animationController.isAnimating
984
+ - ? _animationController.value < 0.5
985
+ + ? _animationWithDelay.value < 0.5
986
+ ? _previousChild
987
+ : Transform.flip(flipY: true, child: child)
988
+ : child,
990
989
- name : Copy step_04_d
991
990
copydir :
992
991
from : quiz
@@ -1001,7 +1000,7 @@ steps:
1001
1000
patch-u : |
1002
1001
--- b/animations/step_05_a/lib/home_screen.dart
1003
1002
+++ a/animations/step_05_a/lib/home_screen.dart
1004
- @@ -24,9 +24,17 @@ class HomeScreen extends StatelessWidget {
1003
+ @@ -24,10 +24,17 @@ class HomeScreen extends StatelessWidget {
1005
1004
// Show the question screen to start the game
1006
1005
Navigator.push(
1007
1006
context,
@@ -1011,17 +1010,17 @@ steps:
1011
1010
+ PageRouteBuilder(
1012
1011
+ pageBuilder: (context, animation, secondaryAnimation) {
1013
1012
+ return const QuestionScreen();
1014
- + },
1015
- + transitionsBuilder: (
1016
- + context,
1017
- + animation,
1018
- + secondaryAnimation,
1019
- + child,
1020
- + ) {
1021
- + return FadeTransition(opacity: animation, child: child);
1022
1013
},
1014
+ + transitionsBuilder:
1015
+ + (context, animation, secondaryAnimation, child) {
1016
+ + return FadeTransition(
1017
+ + opacity: animation,
1018
+ + child: child,
1019
+ + );
1020
+ + },
1023
1021
),
1024
1022
);
1023
+ },
1025
1024
- name : Copy step_05_a
1026
1025
copydir :
1027
1026
from : quiz
@@ -1041,19 +1040,18 @@ steps:
1041
1040
import 'package:flutter/material.dart';
1042
1041
import 'question_screen.dart';
1043
1042
1044
- @@ -34,7 +35,11 @@ class HomeScreen extends StatelessWidget {
1045
- secondaryAnimation,
1046
- child,
1047
- ) {
1048
- - return FadeTransition(opacity: animation, child: child);
1049
- + return FadeThroughTransition(
1050
- + animation: animation,
1051
- + secondaryAnimation: secondaryAnimation,
1052
- + child: child,
1053
- + );
1043
+ @@ -30,8 +31,9 @@ class HomeScreen extends StatelessWidget {
1054
1044
},
1055
- ),
1056
- );
1045
+ transitionsBuilder:
1046
+ (context, animation, secondaryAnimation, child) {
1047
+ - return FadeTransition(
1048
+ - opacity: animation,
1049
+ + return FadeThroughTransition(
1050
+ + animation: animation,
1051
+ + secondaryAnimation: secondaryAnimation,
1052
+ child: child,
1053
+ );
1054
+ },
1057
1055
- name : Patch lib/main.dart
1058
1056
path : quiz/lib/main.dart
1059
1057
patch-u : |
@@ -1099,7 +1097,7 @@ steps:
1099
1097
import 'package:flutter/material.dart';
1100
1098
import 'question_screen.dart';
1101
1099
1102
- @@ -25,22 +24,10 @@ class HomeScreen extends StatelessWidget {
1100
+ @@ -25,18 +24,10 @@ class HomeScreen extends StatelessWidget {
1103
1101
// Show the question screen to start the game
1104
1102
Navigator.push(
1105
1103
context,
@@ -1109,18 +1107,14 @@ steps:
1109
1107
+ builder: (context) {
1110
1108
return const QuestionScreen();
1111
1109
},
1112
- - transitionsBuilder: (
1113
- - context,
1114
- - animation,
1115
- - secondaryAnimation,
1116
- - child,
1117
- - ) {
1118
- - return FadeThroughTransition(
1119
- - animation: animation,
1120
- - secondaryAnimation: secondaryAnimation,
1121
- - child: child,
1122
- - );
1123
- - },
1110
+ - transitionsBuilder:
1111
+ - (context, animation, secondaryAnimation, child) {
1112
+ - return FadeThroughTransition(
1113
+ - animation: animation,
1114
+ - secondaryAnimation: secondaryAnimation,
1115
+ - child: child,
1116
+ - );
1117
+ - },
1124
1118
),
1125
1119
);
1126
1120
},
@@ -1134,7 +1128,7 @@ steps:
1134
1128
import 'package:flutter/material.dart';
1135
1129
import 'flip_effect.dart';
1136
1130
import 'scoreboard.dart';
1137
- @@ -87 ,28 +88 ,15 @@ class QuestionCard extends StatelessWidget {
1131
+ @@ -86 ,28 +87 ,15 @@ class QuestionCard extends StatelessWidget {
1138
1132
1139
1133
@override
1140
1134
Widget build(BuildContext context) {
@@ -1206,7 +1200,7 @@ steps:
1206
1200
Spacer(),
1207
1201
AnswerCards(
1208
1202
onTapped: (index) {
1209
- @@ -59 ,24 +64 ,47 @@ class _QuestionScreenState extends State<QuestionScreen> {
1203
+ @@ -58 ,24 +63 ,47 @@ class _QuestionScreenState extends State<QuestionScreen> {
1210
1204
);
1211
1205
}
1212
1206
@@ -1266,7 +1260,7 @@ steps:
1266
1260
);
1267
1261
}
1268
1262
}
1269
- @@ -84 ,14 +112 ,22 @@ class _QuestionScreenState extends State<QuestionScreen> {
1263
+ @@ -83 ,14 +111 ,22 @@ class _QuestionScreenState extends State<QuestionScreen> {
1270
1264
class QuestionCard extends StatelessWidget {
1271
1265
final String? question;
1272
1266
@@ -1293,7 +1287,7 @@ steps:
1293
1287
transitionBuilder: (child, animation, secondaryAnimation) {
1294
1288
return FadeThroughTransition(
1295
1289
animation: animation,
1296
- @@ -99 ,17 +135 ,30 @@ class QuestionCard extends StatelessWidget {
1290
+ @@ -98 ,17 +134 ,30 @@ class QuestionCard extends StatelessWidget {
1297
1291
child: child,
1298
1292
);
1299
1293
},
0 commit comments