mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
solve the date fix in a cleaner way
This commit is contained in:
@@ -43,7 +43,7 @@ class WeightEntry {
|
||||
WeightEntry copyWith({int? id, int? weight, DateTime? date}) => WeightEntry(
|
||||
id: id,
|
||||
weight: weight ?? this.weight,
|
||||
date: date ?? DateTime.now(),
|
||||
date: date ?? this.date,
|
||||
);
|
||||
|
||||
// Boilerplate
|
||||
|
||||
@@ -43,7 +43,7 @@ class WeightScreen extends StatelessWidget {
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).newEntry,
|
||||
WeightForm(lastWeightEntry?.copyWith(id: null)),
|
||||
WeightForm(lastWeightEntry?.copyWith(id: null, date: DateTime.now())),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -209,7 +209,9 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).newEntry,
|
||||
WeightForm(weightProvider.getNewestEntry()?.copyWith(id: null)),
|
||||
WeightForm(weightProvider
|
||||
.getNewestEntry()
|
||||
?.copyWith(id: null, date: DateTime.now())),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user