hrt/lib/notification.dart
2023-10-05 19:33:47 +02:00

33 lines
834 B
Dart

import 'package:flutter_local_notifications/flutter_local_notifications.dart';
void sendNotification() async {
var initialized = await FlutterLocalNotificationsPlugin().initialize(
const InitializationSettings(
android: AndroidInitializationSettings('estrogen'),
),
);
if (initialized != true) {
throw "Not initialized";
}
await FlutterLocalNotificationsPlugin().show(
1,
null,
null,
const NotificationDetails(
android: AndroidNotificationDetails(
'hrt',
'HRT',
autoCancel: false,
styleInformation: BigPictureStyleInformation(
DrawableResourceAndroidBitmap('take_your_hrt'),
),
importance: Importance.max,
ongoing: true,
actions: [AndroidNotificationAction("confirmation", "Done!")],
),
),
);
}