together_mobile/lib/use_notification.dart

986 lines
39 KiB
Dart

// import 'dart:ffi';
// import 'dart:io';
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/foundation.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_timezone/flutter_timezone.dart';
// import 'package:flutter_local_notifications/flutter_local_notifications.dart';
// import 'package:timezone/timezone.dart' as tz;
// import 'package:timezone/data/latest_all.dart' as tz;
// import 'package:together_mobile/notification_api.dart';
// int id = 0;
// /// A notification action which triggers a url launch event
// const String urlLaunchActionId = 'id_1';
// /// A notification action which triggers a App navigation event
// const String navigationActionId = 'id_3';
// Future<void> main() async {
// // needed if you intend to initialize in `main` function
// WidgetsFlutterBinding.ensureInitialized();
// final NotificationAppLaunchDetails? notificationAppLaunchDetails = !kIsWeb &&
// Platform.isLinux
// ? null
// : await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();
// // initialize android setting
// const AndroidInitializationSettings initializationSettingsAndroid =
// AndroidInitializationSettings('app_icon');
// // IOS notification category
// final List<DarwinNotificationCategory> darwinNotificationCategories = [
// DarwinNotificationCategory(
// darwinNotificationCategoryText,
// actions: [
// DarwinNotificationAction.text(
// 'text_1',
// 'Action 1',
// buttonTitle: 'Send',
// placeholder: 'Placeholder',
// ),
// ],
// ),
// DarwinNotificationCategory(
// darwinNotificationCategoryPlain,
// actions: <DarwinNotificationAction>[
// DarwinNotificationAction.plain('id_1', 'Action 1'),
// DarwinNotificationAction.plain(
// 'id_2',
// 'Action 2 (destructive)',
// options: <DarwinNotificationActionOption>{
// DarwinNotificationActionOption.destructive,
// },
// ),
// DarwinNotificationAction.plain(
// navigationActionId,
// 'Action 3 (foreground)',
// options: <DarwinNotificationActionOption>{
// DarwinNotificationActionOption.foreground,
// },
// ),
// DarwinNotificationAction.plain(
// 'id_4',
// 'Action 4 (auth required)',
// options: <DarwinNotificationActionOption>{
// DarwinNotificationActionOption.authenticationRequired,
// },
// ),
// ],
// options: <DarwinNotificationCategoryOption>{
// DarwinNotificationCategoryOption.hiddenPreviewShowTitle,
// },
// ),
// ];
// // Initialize IOS setting
// final DarwinInitializationSettings initializationSettingsDarwin =
// DarwinInitializationSettings(
// requestAlertPermission: false,
// requestBadgePermission: false,
// requestSoundPermission: false,
// onDidReceiveLocalNotification: (id, title, body, payload) async {
// didReceiveLocalNotificationStream.add(
// ReceivedNotification(
// id: id,
// title: title,
// body: body,
// payload: payload,
// ),
// );
// },
// notificationCategories: darwinNotificationCategories,
// );
// final LinuxInitializationSettings initializationSettingsLinux =
// LinuxInitializationSettings(
// defaultActionName: 'Open notification',
// defaultIcon: AssetsLinuxIcon('icons/app_icon.png'),
// );
// // Initialize notification setting,
// final InitializationSettings initializationSettings = InitializationSettings(
// android: initializationSettingsAndroid,
// iOS: initializationSettingsDarwin,
// macOS: initializationSettingsDarwin,
// linux: initializationSettingsLinux,
// );
// await flutterLocalNotificationsPlugin.initialize(
// initializationSettings,
// onDidReceiveNotificationResponse:
// (NotificationResponse notificationResponse) {
// switch (notificationResponse.notificationResponseType) {
// case NotificationResponseType.selectedNotification:
// selectNotificationStream.add(notificationResponse.payload);
// break;
// case NotificationResponseType.selectedNotificationAction:
// if (notificationResponse.actionId == navigationActionId) {
// selectNotificationStream.add(notificationResponse.payload);
// }
// break;
// }
// },
// onDidReceiveBackgroundNotificationResponse: notificationTapBackground,
// );
// String initialRoute = HomePage.routeName;
// runApp(
// MaterialApp(
// initialRoute: initialRoute,
// routes: <String, WidgetBuilder>{
// HomePage.routeName: (_) => HomePage(notificationAppLaunchDetails),
// SecondPage.routeName: (_) => SecondPage(selectedNotificationPayload),
// },
// ),
// );
// }
// Future<void> _configureLocalTimeZone() async {
// if (kIsWeb || Platform.isLinux) {
// return;
// }
// tz.initializeTimeZones();
// final String timeZoneName = await FlutterTimezone.getLocalTimezone();
// tz.setLocalLocation(tz.getLocation(timeZoneName));
// }
// class PaddedElevatedButton extends StatelessWidget {
// const PaddedElevatedButton({
// required this.buttonText,
// required this.onPressed,
// Key? key,
// }) : super(key: key);
// final String buttonText;
// final VoidCallback onPressed;
// @override
// Widget build(BuildContext context) => Padding(
// padding: const EdgeInsets.fromLTRB(0, 0, 0, 8),
// child: ElevatedButton(
// onPressed: onPressed,
// child: Text(buttonText),
// ),
// );
// }
// class HomePage extends StatefulWidget {
// const HomePage(this.notificationAppLaunchDetails, {Key? key})
// : super(key: key);
// static String routeName = '/';
// final NotificationAppLaunchDetails? notificationAppLaunchDetails;
// bool get didNotificationLaunchApp =>
// notificationAppLaunchDetails?.didNotificationLaunchApp ?? false;
// @override
// State<HomePage> createState() => _HomePageState();
// }
// class _HomePageState extends State<HomePage> {
// bool _notificationsEnabled = false;
// @override
// void initState() {
// super.initState();
// _isAndroidPermissionGranted();
// _requestPermissions();
// _configureDidReceiveLocalNotificationSubject();
// _configureSelectNotificationSubject();
// }
// Future<void> _isAndroidPermissionGranted() async {
// if (Platform.isAndroid) {
// final bool granted = await flutterLocalNotificationsPlugin
// .resolvePlatformSpecificImplementation<
// AndroidFlutterLocalNotificationsPlugin>()
// ?.areNotificationsEnabled() ??
// false;
// setState(() {
// _notificationsEnabled = granted;
// });
// }
// }
// Future<void> _requestPermissions() async {
// if (Platform.isIOS || Platform.isMacOS) {
// await flutterLocalNotificationsPlugin
// .resolvePlatformSpecificImplementation<
// IOSFlutterLocalNotificationsPlugin>()
// ?.requestPermissions(
// alert: true,
// badge: true,
// sound: true,
// );
// await flutterLocalNotificationsPlugin
// .resolvePlatformSpecificImplementation<
// MacOSFlutterLocalNotificationsPlugin>()
// ?.requestPermissions(
// alert: true,
// badge: true,
// sound: true,
// );
// } else if (Platform.isAndroid) {
// final AndroidFlutterLocalNotificationsPlugin? androidImplementation =
// flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<
// AndroidFlutterLocalNotificationsPlugin>();
// final bool? granted = await androidImplementation?.requestPermission();
// setState(() {
// _notificationsEnabled = granted ?? false;
// });
// }
// }
// // configure the action when a notification is tapped
// void _configureDidReceiveLocalNotificationSubject() {
// didReceiveLocalNotificationStream.stream
// .listen((ReceivedNotification receivedNotification) async {
// await showDialog(
// context: context,
// builder: (BuildContext context) => CupertinoAlertDialog(
// title: receivedNotification.title != null
// ? Text(receivedNotification.title!)
// : null,
// content: receivedNotification.body != null
// ? Text(receivedNotification.body!)
// : null,
// actions: <Widget>[
// CupertinoDialogAction(
// isDefaultAction: true,
// onPressed: () async {
// Navigator.of(context, rootNavigator: true).pop();
// await Navigator.of(context).push(
// MaterialPageRoute<void>(
// builder: (BuildContext context) =>
// SecondPage(receivedNotification.payload),
// ),
// );
// },
// child: const Text('Ok'),
// )
// ],
// ),
// );
// });
// }
// void _configureSelectNotificationSubject() {
// selectNotificationStream.stream.listen((String? payload) async {
// await Navigator.of(context).push(MaterialPageRoute<void>(
// builder: (BuildContext context) => SecondPage(payload),
// ));
// });
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: const Text('Notifications Example'),
// ),
// body: SingleChildScrollView(
// child: Padding(
// padding: EdgeInsets.all(8),
// child: Center(
// child: Column(
// children: [
// const Padding(
// padding: EdgeInsets.zero,
// child: Text(
// 'Tap on a Notification when it appears to trigger navigation'),
// ),
// _InfoValueString(
// title: 'Did notification launch app?',
// value: widget.didNotificationLaunchApp,
// ),
// if (widget.didNotificationLaunchApp) ...<Widget>[
// const Text('Launch notification details'),
// _InfoValueString(
// title: 'Notification id',
// value: widget
// .notificationAppLaunchDetails!.notificationResponse?.id,
// ),
// _InfoValueString(
// title: 'Action id',
// value: widget.notificationAppLaunchDetails!
// .notificationResponse?.actionId,
// ),
// _InfoValueString(
// title: 'Input',
// value: widget.notificationAppLaunchDetails!
// .notificationResponse?.input,
// ),
// _InfoValueString(
// title: 'Payload:',
// value: widget.notificationAppLaunchDetails!
// .notificationResponse?.payload,
// ),
// PaddedElevatedButton(
// buttonText: 'Show plain notification with payload',
// onPressed: () async {
// await _showNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show plain notification that has no title with '
// 'payload',
// onPressed: () async {
// await _showNotificationWithNoTitle();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show plain notification that has no body with '
// 'payload',
// onPressed: () async {
// await _showNotificationWithNoBody();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with custom sound',
// onPressed: () async {
// await _showNotificationCustomSound();
// },
// ),
// if (kIsWeb || !Platform.isLinux) ...<Widget>[
// PaddedElevatedButton(
// buttonText:
// 'Schedule notification to appear in 5 seconds '
// 'based on local time zone',
// onPressed: () async {
// await _zonedScheduleNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Schedule notification to appear in 5 seconds '
// 'based on local time zone using alarm clock',
// onPressed: () async {
// await _zonedScheduleAlarmClockNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Repeat notification every minute',
// onPressed: () async {
// await _repeatNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Schedule daily 10:00:00 am notification in your '
// 'local time zone',
// onPressed: () async {
// await _scheduleDailyTenAMNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Schedule daily 10:00:00 am notification in your '
// "local time zone using last year's date",
// onPressed: () async {
// await _scheduleDailyTenAMLastYearNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Schedule weekly 10:00:00 am notification in your '
// 'local time zone',
// onPressed: () async {
// await _scheduleWeeklyTenAMNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Schedule weekly Monday 10:00:00 am notification '
// 'in your local time zone',
// onPressed: () async {
// await _scheduleWeeklyMondayTenAMNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Check pending notifications',
// onPressed: () async {
// await _checkPendingNotificationRequests();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Get active notifications',
// onPressed: () async {
// await _getActiveNotifications();
// },
// ),
// ],
// PaddedElevatedButton(
// buttonText:
// 'Schedule monthly Monday 10:00:00 am notification in '
// 'your local time zone',
// onPressed: () async {
// await _scheduleMonthlyMondayTenAMNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Schedule yearly Monday 10:00:00 am notification in '
// 'your local time zone',
// onPressed: () async {
// await _scheduleYearlyMondayTenAMNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with no sound',
// onPressed: () async {
// await _showNotificationWithNoSound();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Cancel latest notification',
// onPressed: () async {
// await _cancelNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Cancel all notifications',
// onPressed: () async {
// await _cancelAllNotifications();
// },
// ),
// const Divider(),
// const Text(
// 'Notifications with actions',
// style: TextStyle(fontWeight: FontWeight.bold),
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with plain actions',
// onPressed: () async {
// await _showNotificationWithActions();
// },
// ),
// if (!Platform.isLinux)
// PaddedElevatedButton(
// buttonText: 'Show notification with text action',
// onPressed: () async {
// await _showNotificationWithTextAction();
// },
// ),
// if (!Platform.isLinux)
// PaddedElevatedButton(
// buttonText: 'Show notification with text choice',
// onPressed: () async {
// await _showNotificationWithTextChoice();
// },
// ),
// const Divider(),
// if (Platform.isAndroid) ...<Widget>[
// const Text(
// 'Android-specific examples',
// style: TextStyle(fontWeight: FontWeight.bold),
// ),
// Text('notifications enabled: $_notificationsEnabled'),
// PaddedElevatedButton(
// buttonText:
// 'Check if notifications are enabled for this app',
// onPressed: _areNotifcationsEnabledOnAndroid,
// ),
// PaddedElevatedButton(
// buttonText: 'Request permission (API 33+)',
// onPressed: () => _requestPermissions(),
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show plain notification with payload and update '
// 'channel description',
// onPressed: () async {
// await _showNotificationUpdateChannelDescription();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show plain notification as public on every '
// 'lockscreen',
// onPressed: () async {
// await _showPublicNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification with custom vibration pattern, '
// 'red LED and red icon',
// onPressed: () async {
// await _showNotificationCustomVibrationIconLed();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification using Android Uri sound',
// onPressed: () async {
// await _showSoundUriNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification that times out after 3 seconds',
// onPressed: () async {
// await _showTimeoutNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show insistent notification',
// onPressed: () async {
// await _showInsistentNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show big picture notification using local images',
// onPressed: () async {
// await _showBigPictureNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show big picture notification using base64 String '
// 'for images',
// onPressed: () async {
// await _showBigPictureNotificationBase64();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show big picture notification using URLs for '
// 'Images',
// onPressed: () async {
// await _showBigPictureNotificationURL();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show big picture notification, hide large icon '
// 'on expand',
// onPressed: () async {
// await _showBigPictureNotificationHiddenLargeIcon();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show media notification',
// onPressed: () async {
// await _showNotificationMediaStyle();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show big text notification',
// onPressed: () async {
// await _showBigTextNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show inbox notification',
// onPressed: () async {
// await _showInboxNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show messaging notification',
// onPressed: () async {
// await _showMessagingNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show grouped notifications',
// onPressed: () async {
// await _showGroupedNotifications();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with tag',
// onPressed: () async {
// await _showNotificationWithTag();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Cancel notification with tag',
// onPressed: () async {
// await _cancelNotificationWithTag();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show ongoing notification',
// onPressed: () async {
// await _showOngoingNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification with no badge, alert only once',
// onPressed: () async {
// await _showNotificationWithNoBadge();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show progress notification - updates every second',
// onPressed: () async {
// await _showProgressNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show indeterminate progress notification',
// onPressed: () async {
// await _showIndeterminateProgressNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification without timestamp',
// onPressed: () async {
// await _showNotificationWithoutTimestamp();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with custom timestamp',
// onPressed: () async {
// await _showNotificationWithCustomTimestamp();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with custom sub-text',
// onPressed: () async {
// await _showNotificationWithCustomSubText();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with chronometer',
// onPressed: () async {
// await _showNotificationWithChronometer();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show full-screen notification',
// onPressed: () async {
// await _showFullScreenNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification with number if the launcher '
// 'supports',
// onPressed: () async {
// await _showNotificationWithNumber();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with sound controlled by '
// 'alarm volume',
// onPressed: () async {
// await _showNotificationWithAudioAttributeAlarm();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Create grouped notification channels',
// onPressed: () async {
// await _createNotificationChannelGroup();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Delete notification channel group',
// onPressed: () async {
// await _deleteNotificationChannelGroup();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Create notification channel',
// onPressed: () async {
// await _createNotificationChannel();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Delete notification channel',
// onPressed: () async {
// await _deleteNotificationChannel();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Get notification channels',
// onPressed: () async {
// await _getNotificationChannels();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Start foreground service',
// onPressed: () async {
// await _startForegroundService();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Start foreground service with blue background '
// 'notification',
// onPressed: () async {
// await _startForegroundServiceWithBlueBackgroundNotification();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Stop foreground service',
// onPressed: () async {
// await _stopForegroundService();
// },
// ),
// ],
// if (!kIsWeb &&
// (Platform.isIOS || Platform.isMacOS)) ...<Widget>[
// const Text(
// 'iOS and macOS-specific examples',
// style: TextStyle(fontWeight: FontWeight.bold),
// ),
// PaddedElevatedButton(
// buttonText: 'Request permission',
// onPressed: _requestPermissions,
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with subtitle',
// onPressed: () async {
// await _showNotificationWithSubtitle();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with icon badge',
// onPressed: () async {
// await _showNotificationWithIconBadge();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification with attachment (with thumbnail)',
// onPressed: () async {
// await _showNotificationWithAttachment(
// hideThumbnail: false);
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification with attachment (no thumbnail)',
// onPressed: () async {
// await _showNotificationWithAttachment(
// hideThumbnail: true);
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification with attachment (clipped thumbnail)',
// onPressed: () async {
// await _showNotificationWithClippedThumbnailAttachment();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notifications with thread identifier',
// onPressed: () async {
// await _showNotificationsWithThreadIdentifier();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification with time sensitive interruption '
// 'level',
// onPressed: () async {
// await _showNotificationWithTimeSensitiveInterruptionLevel();
// },
// ),
// PaddedElevatedButton(
// buttonText: 'Show notification with banner but not in '
// 'notification centre',
// onPressed: () async {
// await _showNotificationWithBannerNotInNotificationCentre();
// },
// ),
// PaddedElevatedButton(
// buttonText:
// 'Show notification in notification centre only',
// onPressed: () async {
// await _showNotificationInNotificationCentreOnly();
// },
// ),
// ],
// ],
// ],
// ),
// ),
// ),
// ),
// );
// }
// // show single plain notification
// Future<void> _showNotification() async {
// const AndroidNotificationDetails androidNotificationDetails =
// AndroidNotificationDetails(
// 'your channel id',
// 'your channel name',
// channelDescription: 'your channel description',
// importance: Importance.max,
// priority: Priority.high,
// ticker: 'ticker',
// );
// const NotificationDetails notificationDetails =
// NotificationDetails(android: androidNotificationDetails);
// await flutterLocalNotificationsPlugin.show(
// id++, 'plain title', 'plain body', notificationDetails,
// payload: 'item x');
// }
// // show notification with plain actions
// Future<void> _showNotificationWithActions() async {
// const AndroidNotificationDetails androidNotificationDetails =
// AndroidNotificationDetails(
// 'your channel id',
// 'your channel name',
// channelDescription: 'your channel description',
// importance: Importance.max,
// priority: Priority.high,
// ticker: 'ticker',
// actions: <AndroidNotificationAction>[
// AndroidNotificationAction(
// urlLaunchActionId,
// 'Action 1',
// icon: DrawableResourceAndroidBitmap('food'),
// contextual: true,
// ),
// AndroidNotificationAction(
// 'id_2',
// 'Action 2',
// titleColor: Color.fromARGB(255, 255, 0, 0),
// icon: DrawableResourceAndroidBitmap('secondary_icon'),
// ),
// AndroidNotificationAction(
// navigationActionId,
// 'Action 3',
// icon: DrawableResourceAndroidBitmap('secondary_icon'),
// showsUserInterface: true,
// // By default, Android plugin will dismiss the notification when the
// // user tapped on a action (this mimics the behavior on iOS).
// cancelNotification: false,
// ),
// ],
// );
// const DarwinNotificationDetails iosNotificationDetails =
// DarwinNotificationDetails(
// categoryIdentifier: darwinNotificationCategoryPlain,
// );
// const DarwinNotificationDetails macOSNotificationDetails =
// DarwinNotificationDetails(
// categoryIdentifier: darwinNotificationCategoryPlain,
// );
// const LinuxNotificationDetails linuxNotificationDetails =
// LinuxNotificationDetails(
// actions: <LinuxNotificationAction>[
// LinuxNotificationAction(
// key: urlLaunchActionId,
// label: 'Action 1',
// ),
// LinuxNotificationAction(
// key: navigationActionId,
// label: 'Action 2',
// ),
// ],
// );
// const NotificationDetails notificationDetails = NotificationDetails(
// android: androidNotificationDetails,
// iOS: iosNotificationDetails,
// macOS: macOSNotificationDetails,
// linux: linuxNotificationDetails,
// );
// await flutterLocalNotificationsPlugin.show(
// id++,
// 'plain title',
// 'plain body',
// notificationDetails,
// payload: 'item z',
// );
// }
// // show notification with text input action
// Future<void> _showNotificationWithTextAction() async {
// const AndroidNotificationDetails androidNotificationDetails =
// AndroidNotificationDetails(
// 'your channel id',
// 'your channel name',
// channelDescription: 'your channel description',
// importance: Importance.max,
// priority: Priority.high,
// ticker: 'ticker',
// actions: [
// AndroidNotificationAction(
// 'text_id_1',
// 'Enter Text',
// icon: DrawableResourceAndroidBitmap('food'),
// inputs: [
// AndroidNotificationActionInput(label: 'Enter a Message'),
// ],
// ),
// ],
// );
// const NotificationDetails notificationDetails =
// NotificationDetails(android: androidNotificationDetails);
// await flutterLocalNotificationsPlugin.show(
// id++,
// 'Text Input Notification',
// 'Expand to see Input action',
// notificationDetails,
// payload: 'item x',
// );
// }
// @override
// void dispose() {
// didReceiveLocalNotificationStream.close();
// selectNotificationStream.close();
// super.dispose();
// }
// }
// class _InfoValueString extends StatelessWidget {
// const _InfoValueString({
// required this.title,
// required this.value,
// Key? key,
// }) : super(key: key);
// final String title;
// final Object? value;
// @override
// Widget build(BuildContext context) => Padding(
// padding: const EdgeInsets.fromLTRB(0, 0, 0, 8),
// child: Text.rich(
// TextSpan(
// children: <InlineSpan>[
// TextSpan(
// text: '$title ',
// style: const TextStyle(
// fontWeight: FontWeight.bold,
// ),
// ),
// TextSpan(
// text: '$value',
// )
// ],
// ),
// ),
// );
// }