Date selector now works

This commit is contained in:
2023-09-06 19:21:15 +05:30
parent 8b0b770460
commit c74876ecb8
2 changed files with 12 additions and 9 deletions

View File

@@ -162,8 +162,8 @@ class GlobalModel extends ChangeNotifier {
} }
} }
void setDateToToday() { void setDateToADay([DateTime? aDay]) {
this.currentDate = DateTime.now(); this.currentDate = aDay ?? DateTime.now();
this.isMenuAvailable(); this.isMenuAvailable();
notifyListeners(); notifyListeners();
} }

View File

@@ -54,10 +54,13 @@ class HomePage extends StatelessWidget {
firstDate: firstDate:
data.currentDate.add(const Duration(days: -30)), data.currentDate.add(const Duration(days: -30)),
lastDate: lastDate:
data.currentDate.add(const Duration(days: 30))); data.currentDate.add(const Duration(days: 30)))
.then((value) {
data.setDateToADay(value ?? data.currentDate);
});
}, },
onTap: () { onTap: () {
data.setDateToToday(); data.setDateToADay();
}, },
child: Center( child: Center(
child: Text( child: Text(