Date selector now works
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,15 +49,18 @@ class HomePage extends StatelessWidget {
|
|||||||
splashFactory: NoSplash.splashFactory,
|
splashFactory: NoSplash.splashFactory,
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
showDatePicker(
|
showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: data.currentDate,
|
initialDate: data.currentDate,
|
||||||
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(
|
||||||
|
|||||||
Reference in New Issue
Block a user