Date selector now works
This commit is contained in:
@@ -162,8 +162,8 @@ class GlobalModel extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
void setDateToToday() {
|
||||
this.currentDate = DateTime.now();
|
||||
void setDateToADay([DateTime? aDay]) {
|
||||
this.currentDate = aDay ?? DateTime.now();
|
||||
this.isMenuAvailable();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -54,10 +54,13 @@ class HomePage extends StatelessWidget {
|
||||
firstDate:
|
||||
data.currentDate.add(const Duration(days: -30)),
|
||||
lastDate:
|
||||
data.currentDate.add(const Duration(days: 30)));
|
||||
data.currentDate.add(const Duration(days: 30)))
|
||||
.then((value) {
|
||||
data.setDateToADay(value ?? data.currentDate);
|
||||
});
|
||||
},
|
||||
onTap: () {
|
||||
data.setDateToToday();
|
||||
data.setDateToADay();
|
||||
},
|
||||
child: Center(
|
||||
child: Text(
|
||||
|
||||
Reference in New Issue
Block a user