From 8cd639ed678fafa16c50ae0a536b3aa357065e68 Mon Sep 17 00:00:00 2001 From: yuhamadan <60957899+yuhamadan@users.noreply.github.com> Date: Wed, 12 Feb 2020 08:25:40 +0100 Subject: [PATCH 1/2] Fix - text on MaterialButton not changing text on MaterialButton was not changing from 'Write Essay' to 'Delete Essay' and vice versa because setState was never called --- animations/lib/src/basics/06_custom_tween.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/animations/lib/src/basics/06_custom_tween.dart b/animations/lib/src/basics/06_custom_tween.dart index 8bd56b354a2..6c297a0bfa1 100644 --- a/animations/lib/src/basics/06_custom_tween.dart +++ b/animations/lib/src/basics/06_custom_tween.dart @@ -52,9 +52,9 @@ class _CustomTweenDemoState extends State textColor: Colors.white, onPressed: () { if (controller.status == AnimationStatus.completed) { - controller.reverse(); + controller.reverse().whenComplete(() {setState((){});}); } else { - controller.forward(); + controller.forward().whenComplete(() {setState((){});}); } }, ), From c0df7c2845d13d63aeaea46dd12557b0689afe3a Mon Sep 17 00:00:00 2001 From: Harun Madanoglu <60957899+yuhamadan@users.noreply.github.com> Date: Wed, 19 Feb 2020 08:47:32 +0100 Subject: [PATCH 2/2] fix issue of code formatting did not think about formatting as I was editing the file directly on Github --- animations/lib/src/basics/06_custom_tween.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/animations/lib/src/basics/06_custom_tween.dart b/animations/lib/src/basics/06_custom_tween.dart index 6c297a0bfa1..c0c9f10a5f0 100644 --- a/animations/lib/src/basics/06_custom_tween.dart +++ b/animations/lib/src/basics/06_custom_tween.dart @@ -52,9 +52,13 @@ class _CustomTweenDemoState extends State textColor: Colors.white, onPressed: () { if (controller.status == AnimationStatus.completed) { - controller.reverse().whenComplete(() {setState((){});}); + controller.reverse().whenComplete(() { + setState(() {}); + }); } else { - controller.forward().whenComplete(() {setState((){});}); + controller.forward().whenComplete(() { + setState(() {}); + }); } }, ),