From 6a8644133c3efc6eecc758a67bc945eb4f923530 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Mon, 29 Mar 2021 02:16:45 +0800 Subject: [PATCH] Revert "flutter: Remove unused functions" Restore didPush didPopNext didPushNext didPop didChangeDependencies buildManualPanel to fix setoption not called. This commit reverts 5884fa4c5f3a890d090693e965a17122de1aea06 --- src/ui/flutter_app/lib/widgets/game_page.dart | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/ui/flutter_app/lib/widgets/game_page.dart b/src/ui/flutter_app/lib/widgets/game_page.dart index a57c281d..0eca9ba0 100644 --- a/src/ui/flutter_app/lib/widgets/game_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_page.dart @@ -756,6 +756,28 @@ class _GamePageState extends State with RouteAware { ); } + Widget buildManualPanel(String text) { + // + final manualStyle = TextStyle( + fontSize: 18, + color: UIColors.darkTextSecondaryColor, + height: 1.5, + ); + + return Expanded( + child: Container( + margin: EdgeInsets.symmetric(vertical: 16), + child: SingleChildScrollView(child: Text(text, style: manualStyle)), + ), + ); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); + } + @override Widget build(BuildContext context) { // @@ -777,4 +799,31 @@ class _GamePageState extends State with RouteAware { super.dispose(); routeObserver.unsubscribe(this); } + + @override + void didPush() { + final route = ModalRoute.of(context)!.settings.name; + print('Game Page didPush route: $route'); + widget.engine.setOptions(); + } + + @override + void didPopNext() { + final route = ModalRoute.of(context)!.settings.name; + print('Game Page didPopNext route: $route'); + widget.engine.setOptions(); + } + + @override + void didPushNext() { + final route = ModalRoute.of(context)!.settings.name; + print('Game Page didPushNext route: $route'); + widget.engine.setOptions(); + } + + @override + void didPop() { + final route = ModalRoute.of(context)!.settings.name; + print('Game Page didPop route: $route'); + } }