Created
April 19, 2022 16:10
-
-
Save alperefesahin/d70e481246fae60819b0bfad4135e955 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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