Skip to content

Commit

Permalink
setup create_addiction page anim, change checkboxes to switches
Browse files Browse the repository at this point in the history
  • Loading branch information
onur-yildiz committed Mar 28, 2021
1 parent a330749 commit 527b431
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
22 changes: 19 additions & 3 deletions lib/screens/create_addiction_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,25 @@ class _AddictionCardState extends State<AddictionCard>
final newAddiction =
await Provider.of<AddictionsProvider>(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,
);
},
),
);
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/widgets/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class _SettingsViewState extends State<SettingsView> {
@override
Widget build(BuildContext context) {
final local = AppLocalizations.of(context);
final isDark = MediaQuery.of(context).platformBrightness == Brightness.dark;

return Drawer(
child: LayoutBuilder(
Expand Down Expand Up @@ -79,7 +80,7 @@ class _SettingsViewState extends State<SettingsView> {
),
),
),
CheckboxListTile(
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
vertical: 24, horizontal: 8),
title: Text(
Expand All @@ -106,7 +107,7 @@ class _SettingsViewState extends State<SettingsView> {
height: 0,
thickness: 1,
),
CheckboxListTile(
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
vertical: 24, horizontal: 8),
title: Text(
Expand Down

0 comments on commit 527b431

Please sign in to comment.