Set created date at last possible moment

This commit is contained in:
Brandon Presley 2023-11-29 16:33:01 +13:00
parent 7642c6faf2
commit 36b8ce37ad
2 changed files with 8 additions and 7 deletions

View File

@ -126,7 +126,9 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
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]);
}

View File

@ -80,13 +80,12 @@ class _SetList extends State<SetList> {
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(''),
),
),
),