From 527b431fe65bb7a77837a19af47736e237f13170 Mon Sep 17 00:00:00 2001 From: onur-yildiz Date: Sun, 28 Mar 2021 15:44:06 +0300 Subject: [PATCH] setup create_addiction page anim, change checkboxes to switches --- lib/screens/create_addiction_screen.dart | 22 +++++++++++++++++++--- lib/widgets/settings_view.dart | 5 +++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/screens/create_addiction_screen.dart b/lib/screens/create_addiction_screen.dart index d70a778..c1c7661 100644 --- a/lib/screens/create_addiction_screen.dart +++ b/lib/screens/create_addiction_screen.dart @@ -139,9 +139,25 @@ class _AddictionCardState extends State final newAddiction = await Provider.of(context, listen: false) .createAddiction(addictionData); - Navigator.of(context).popAndPushNamed( - AddictionItemScreen.routeName, - arguments: AddictionItemScreenArgs(newAddiction), + Navigator.of(context).pushReplacement( + PageRouteBuilder( + transitionDuration: Duration(milliseconds: 250), + reverseTransitionDuration: Duration(milliseconds: 250), + pageBuilder: (_, __, ___) => AddictionItemScreen(), + settings: RouteSettings( + arguments: AddictionItemScreenArgs(newAddiction), + ), + transitionsBuilder: (context, animation, secondaryAnimation, child) { + var begin = 0.0; + var end = 1.0; + var tween = Tween(begin: begin, end: end); + + return FadeTransition( + opacity: animation.drive(tween), + child: child, + ); + }, + ), ); } } diff --git a/lib/widgets/settings_view.dart b/lib/widgets/settings_view.dart index 80efd16..e5d3e61 100644 --- a/lib/widgets/settings_view.dart +++ b/lib/widgets/settings_view.dart @@ -38,6 +38,7 @@ class _SettingsViewState extends State { @override Widget build(BuildContext context) { final local = AppLocalizations.of(context); + final isDark = MediaQuery.of(context).platformBrightness == Brightness.dark; return Drawer( child: LayoutBuilder( @@ -79,7 +80,7 @@ class _SettingsViewState extends State { ), ), ), - CheckboxListTile( + SwitchListTile( contentPadding: const EdgeInsets.symmetric( vertical: 24, horizontal: 8), title: Text( @@ -106,7 +107,7 @@ class _SettingsViewState extends State { height: 0, thickness: 1, ), - CheckboxListTile( + SwitchListTile( contentPadding: const EdgeInsets.symmetric( vertical: 24, horizontal: 8), title: Text(