From 54f171a8d8aa75147f8dee92f4b93ccd1fa457b8 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 14 Nov 2024 14:50:39 +1100 Subject: [PATCH] Fixup step 5 of `animations` --- animations/codelab_rebuild.yaml | 33 +++++++++++------------ animations/step_05_a/lib/home_screen.dart | 6 ++--- animations/step_05_b/lib/home_screen.dart | 6 ++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/animations/codelab_rebuild.yaml b/animations/codelab_rebuild.yaml index e719f7c419..72d60bcdd5 100644 --- a/animations/codelab_rebuild.yaml +++ b/animations/codelab_rebuild.yaml @@ -1002,8 +1002,8 @@ steps: - name: Use PageRouteBuilder path: quiz/lib/home_screen.dart patch-u: | - --- a/animations/step_05/lib/home_screen.dart - +++ b/animations/step_05/lib/home_screen.dart + --- b/animations/step_05_a/lib/home_screen.dart + +++ a/animations/step_05_a/lib/home_screen.dart @@ -26,14 +26,19 @@ class HomeScreen extends StatelessWidget { // Show the question screen to start the game Navigator.push( @@ -1015,9 +1015,9 @@ steps: - ), + PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) { - + return const QuestionScreen(); - + }, transitionsBuilder: - + (context, animation, secondaryAnimation, child) { + + return const QuestionScreen(); + + }, transitionsBuilder: + + (context, animation, secondaryAnimation, child) { + return FadeTransition( + opacity: animation, + child: child, @@ -1039,17 +1039,17 @@ steps: - name: Use package:animations FadeThroughTransition path: quiz/lib/home_screen.dart patch-u: | - --- a/animations/step_05/lib/home_screen.dart - +++ b/animations/step_05/lib/home_screen.dart + --- b/animations/step_05_b/lib/home_screen.dart + +++ a/animations/step_05_b/lib/home_screen.dart @@ -1,3 +1,4 @@ +import 'package:animations/animations.dart'; import 'package:flutter/material.dart'; import 'question_screen.dart'; @@ -31,8 +32,9 @@ class HomeScreen extends StatelessWidget { - return const QuestionScreen(); - }, transitionsBuilder: - (context, animation, secondaryAnimation, child) { + return const QuestionScreen(); + }, transitionsBuilder: + (context, animation, secondaryAnimation, child) { - return FadeTransition( - opacity: animation, + return FadeThroughTransition( @@ -1093,8 +1093,8 @@ steps: - name: Change back to MaterialPageRoute path: quiz/lib/home_screen.dart patch-u: | - --- a/animations/step_05/lib/home_screen.dart - +++ b/animations/step_05/lib/home_screen.dart + --- b/animations/step_05_c/lib/home_screen.dart + +++ a/animations/step_05_c/lib/home_screen.dart @@ -1,4 +1,3 @@ -import 'package:animations/animations.dart'; import 'package:flutter/material.dart'; @@ -1106,16 +1106,15 @@ steps: context, - PageRouteBuilder( - pageBuilder: (context, animation, secondaryAnimation) { - - return const QuestionScreen(); - - }, transitionsBuilder: - - (context, animation, secondaryAnimation, child) { + + MaterialPageRoute(builder: (context) { + return const QuestionScreen(); + - }, transitionsBuilder: + - (context, animation, secondaryAnimation, child) { - return FadeThroughTransition( - animation: animation, - secondaryAnimation: secondaryAnimation, - child: child, - ); - + MaterialPageRoute(builder: (context) { - + return const QuestionScreen(); }), ); }, diff --git a/animations/step_05_a/lib/home_screen.dart b/animations/step_05_a/lib/home_screen.dart index cc49bb89b2..b4858dcfa6 100644 --- a/animations/step_05_a/lib/home_screen.dart +++ b/animations/step_05_a/lib/home_screen.dart @@ -28,9 +28,9 @@ class HomeScreen extends StatelessWidget { context, PageRouteBuilder( pageBuilder: (context, animation, secondaryAnimation) { - return const QuestionScreen(); - }, transitionsBuilder: - (context, animation, secondaryAnimation, child) { + return const QuestionScreen(); + }, transitionsBuilder: + (context, animation, secondaryAnimation, child) { return FadeTransition( opacity: animation, child: child, diff --git a/animations/step_05_b/lib/home_screen.dart b/animations/step_05_b/lib/home_screen.dart index 6e41695236..176a5be333 100644 --- a/animations/step_05_b/lib/home_screen.dart +++ b/animations/step_05_b/lib/home_screen.dart @@ -29,9 +29,9 @@ class HomeScreen extends StatelessWidget { context, PageRouteBuilder( pageBuilder: (context, animation, secondaryAnimation) { - return const QuestionScreen(); - }, transitionsBuilder: - (context, animation, secondaryAnimation, child) { + return const QuestionScreen(); + }, transitionsBuilder: + (context, animation, secondaryAnimation, child) { return FadeThroughTransition( animation: animation, secondaryAnimation: secondaryAnimation,