From 36b8ce37ad43d0ff5a4a03b017e94168496a0f5f Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Wed, 29 Nov 2023 16:33:01 +1300 Subject: [PATCH] Set created date at last possible moment --- lib/edit_set.dart | 4 +++- lib/set_list.dart | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/edit_set.dart b/lib/edit_set.dart index 0eba160..20131ec 100644 --- a/lib/edit_set.dart +++ b/lib/edit_set.dart @@ -126,7 +126,9 @@ class _EditGymSetPageState extends State { await db.update(db.gymSets).replace(gymSet); else { await Permission.notification.request(); - await db.into(db.gymSets).insert(gymSet); + final newSet = gymSet.copyWith( + created: Value(DateTime.now().toIso8601String())); + await db.into(db.gymSets).insert(newSet); const platform = MethodChannel('com.massive/android'); platform.invokeMethod('timer', [3000]); } diff --git a/lib/set_list.dart b/lib/set_list.dart index 12e38d7..c60817b 100644 --- a/lib/set_list.dart +++ b/lib/set_list.dart @@ -80,13 +80,12 @@ class _SetList extends State { await Navigator.push( context, MaterialPageRoute( - builder: (context) => EditGymSetPage( + builder: (context) => const EditGymSetPage( gymSet: GymSetsCompanion( - name: const Value(''), - reps: const Value(0), - weight: const Value(0), - image: const Value(''), - created: Value(DateTime.now().toString()), + name: Value(''), + reps: Value(0), + weight: Value(0), + image: Value(''), ), ), ),