timeDisplay method
Implementation
Widget timeDisplay(BuildContext context) {
NumberFormat format = NumberFormat('00');
return InkWell(
onTap: () {
if (notificationEnabled) {
Future<TimeOfDay?> newTimeOfDay = showTimePicker(
context: context,
initialTime: timeOfDay,
builder: (BuildContext context, Widget? child) {
return MediaQuery(
data: MediaQuery.of(context)
.copyWith(alwaysUse24HourFormat: true),
child: child!,
);
},
initialEntryMode: TimePickerEntryMode.dial);
newTimeOfDay.then((value) {
if (value != null) {
setState(() {
timeOfDay = value;
widget.controller.scheduleNotification(
hour: timeOfDay.hour,
minute: timeOfDay.minute,
title: 'Oefen nu je Franse werkwoorden',
body: 'en bouw verder aan je streak!',
payload: 'en bouw verder aan je streak!');
});
}
});
}
},
child: Wrap(
children: [
Text(format.format(timeOfDay.hour)),
const Text(':'),
Text(format.format(timeOfDay.minute)),
],
),
);
}