Skip to content

Instantly share code, notes, and snippets.

@alperefesahin
Created April 19, 2022 16:10
Show Gist options
  • Select an option

  • Save alperefesahin/d70e481246fae60819b0bfad4135e955 to your computer and use it in GitHub Desktop.

Select an option

Save alperefesahin/d70e481246fae60819b0bfad4135e955 to your computer and use it in GitHub Desktop.
listener: (context, state) {
timerController!.duration = state.durationOfTimer;
if (state.isTimerReset) {
timerController!.reset();
NotificationApi.notifications.cancelAll();
}
if (state.isTimerStopped) {
timerController!.stop();
NotificationApi.notifications.cancelAll();
} else if (!state.isTimerStopped) {
final notificationDuration = (timerController!.duration! - state.spentFocusedTime).inMicroseconds;
timerController!.start();
NotificationApi.zonedScheduleNotification(
title: _localization.timeIsUpTitle,
body: _localization.timeIsUpBody,
microSeconds: notificationDuration,
);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment