testing repeating notification
This commit is contained in:
parent
949c1300e6
commit
82335d1025
1 changed files with 20 additions and 0 deletions
|
@ -38,6 +38,12 @@ class _NotificationPageState extends State<NotificationsPage> {
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
onPressed: _scheduleNotify
|
onPressed: _scheduleNotify
|
||||||
),
|
),
|
||||||
|
FlatButton(
|
||||||
|
child: Text("Repeat!"),
|
||||||
|
color: Colors.blue,
|
||||||
|
textColor: Colors.white,
|
||||||
|
onPressed: _repeatNotification
|
||||||
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Waiting?"),
|
child: Text("Waiting?"),
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
|
@ -107,6 +113,20 @@ class _NotificationPageState extends State<NotificationsPage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _repeatNotification() async {
|
||||||
|
const AndroidNotificationDetails androidPlatformChannelSpecifics =
|
||||||
|
AndroidNotificationDetails(
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'desc'
|
||||||
|
);
|
||||||
|
const NotificationDetails platformChannelSpecifics =
|
||||||
|
NotificationDetails(android: androidPlatformChannelSpecifics);
|
||||||
|
await flutterLocalNotificationsPlugin.periodicallyShow(0, 'repeating title',
|
||||||
|
'repeating body', RepeatInterval.hourly, platformChannelSpecifics,
|
||||||
|
androidAllowWhileIdle: true);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _cancelAllNotifications() async {
|
Future<void> _cancelAllNotifications() async {
|
||||||
await flutterLocalNotificationsPlugin.cancelAll();
|
await flutterLocalNotificationsPlugin.cancelAll();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue