Skip to content

Commit 54f171a

Browse files
committed
Fixup step 5 of animations
1 parent 7fa189a commit 54f171a

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

animations/codelab_rebuild.yaml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,8 @@ steps:
10021002
- name: Use PageRouteBuilder
10031003
path: quiz/lib/home_screen.dart
10041004
patch-u: |
1005-
--- a/animations/step_05/lib/home_screen.dart
1006-
+++ b/animations/step_05/lib/home_screen.dart
1005+
--- b/animations/step_05_a/lib/home_screen.dart
1006+
+++ a/animations/step_05_a/lib/home_screen.dart
10071007
@@ -26,14 +26,19 @@ class HomeScreen extends StatelessWidget {
10081008
// Show the question screen to start the game
10091009
Navigator.push(
@@ -1015,9 +1015,9 @@ steps:
10151015
- ),
10161016
+ PageRouteBuilder(
10171017
+ pageBuilder: (context, animation, secondaryAnimation) {
1018-
+ return const QuestionScreen();
1019-
+ }, transitionsBuilder:
1020-
+ (context, animation, secondaryAnimation, child) {
1018+
+ return const QuestionScreen();
1019+
+ }, transitionsBuilder:
1020+
+ (context, animation, secondaryAnimation, child) {
10211021
+ return FadeTransition(
10221022
+ opacity: animation,
10231023
+ child: child,
@@ -1039,17 +1039,17 @@ steps:
10391039
- name: Use package:animations FadeThroughTransition
10401040
path: quiz/lib/home_screen.dart
10411041
patch-u: |
1042-
--- a/animations/step_05/lib/home_screen.dart
1043-
+++ b/animations/step_05/lib/home_screen.dart
1042+
--- b/animations/step_05_b/lib/home_screen.dart
1043+
+++ a/animations/step_05_b/lib/home_screen.dart
10441044
@@ -1,3 +1,4 @@
10451045
+import 'package:animations/animations.dart';
10461046
import 'package:flutter/material.dart';
10471047
import 'question_screen.dart';
10481048
10491049
@@ -31,8 +32,9 @@ class HomeScreen extends StatelessWidget {
1050-
return const QuestionScreen();
1051-
}, transitionsBuilder:
1052-
(context, animation, secondaryAnimation, child) {
1050+
return const QuestionScreen();
1051+
}, transitionsBuilder:
1052+
(context, animation, secondaryAnimation, child) {
10531053
- return FadeTransition(
10541054
- opacity: animation,
10551055
+ return FadeThroughTransition(
@@ -1093,8 +1093,8 @@ steps:
10931093
- name: Change back to MaterialPageRoute
10941094
path: quiz/lib/home_screen.dart
10951095
patch-u: |
1096-
--- a/animations/step_05/lib/home_screen.dart
1097-
+++ b/animations/step_05/lib/home_screen.dart
1096+
--- b/animations/step_05_c/lib/home_screen.dart
1097+
+++ a/animations/step_05_c/lib/home_screen.dart
10981098
@@ -1,4 +1,3 @@
10991099
-import 'package:animations/animations.dart';
11001100
import 'package:flutter/material.dart';
@@ -1106,16 +1106,15 @@ steps:
11061106
context,
11071107
- PageRouteBuilder(
11081108
- pageBuilder: (context, animation, secondaryAnimation) {
1109-
- return const QuestionScreen();
1110-
- }, transitionsBuilder:
1111-
- (context, animation, secondaryAnimation, child) {
1109+
+ MaterialPageRoute(builder: (context) {
1110+
return const QuestionScreen();
1111+
- }, transitionsBuilder:
1112+
- (context, animation, secondaryAnimation, child) {
11121113
- return FadeThroughTransition(
11131114
- animation: animation,
11141115
- secondaryAnimation: secondaryAnimation,
11151116
- child: child,
11161117
- );
1117-
+ MaterialPageRoute(builder: (context) {
1118-
+ return const QuestionScreen();
11191118
}),
11201119
);
11211120
},

animations/step_05_a/lib/home_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class HomeScreen extends StatelessWidget {
2828
context,
2929
PageRouteBuilder(
3030
pageBuilder: (context, animation, secondaryAnimation) {
31-
return const QuestionScreen();
32-
}, transitionsBuilder:
33-
(context, animation, secondaryAnimation, child) {
31+
return const QuestionScreen();
32+
}, transitionsBuilder:
33+
(context, animation, secondaryAnimation, child) {
3434
return FadeTransition(
3535
opacity: animation,
3636
child: child,

animations/step_05_b/lib/home_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class HomeScreen extends StatelessWidget {
2929
context,
3030
PageRouteBuilder(
3131
pageBuilder: (context, animation, secondaryAnimation) {
32-
return const QuestionScreen();
33-
}, transitionsBuilder:
34-
(context, animation, secondaryAnimation, child) {
32+
return const QuestionScreen();
33+
}, transitionsBuilder:
34+
(context, animation, secondaryAnimation, child) {
3535
return FadeThroughTransition(
3636
animation: animation,
3737
secondaryAnimation: secondaryAnimation,

0 commit comments

Comments
 (0)