flutter_notification_center/example/lib/main.dart

72 lines
1.9 KiB
Dart
Raw Normal View History

2024-04-03 14:38:40 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_notification_center/flutter_notification_center.dart';
void main() {
runApp(
const MaterialApp(
home: NotificationCenterDemo(),
),
);
}
class NotificationCenterDemo extends StatefulWidget {
2024-04-03 14:38:40 +02:00
const NotificationCenterDemo({Key? key}) : super(key: key);
@override
State<NotificationCenterDemo> createState() => _NotificationCenterDemoState();
}
class _NotificationCenterDemoState extends State<NotificationCenterDemo> {
var config = NotificationConfig(
service: NotificationService(
listOfNotifications: [
NotificationModel(
title: 'Notification title 1',
body: 'Notification body 1',
dateTime: DateTime.now(),
isRead: false,
),
NotificationModel(
title: 'RECURRING',
body: 'RECURRING',
dateTime: DateTime.now(),
isRead: false,
isScheduled: true,
),
NotificationModel(
title: 'Notification title 2',
body: 'Notification body 2',
dateTime: DateTime.now(),
isRead: false,
),
NotificationModel(
title: 'Notification title 3',
body: 'Notification body 3',
dateTime: DateTime.now(),
isRead: false,
),
],
),
style: const NotificationStyle(
titleTextStyle: TextStyle(color: Colors.red, fontSize: 20),
subtitleTextStyle: TextStyle(color: Colors.blue, fontSize: 16),
subtitleTextAlign: TextAlign.end),
);
2024-04-03 14:38:40 +02:00
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Notification Center Demo'),
centerTitle: true,
actions: [
NotificationBellWidgetStory(
config: config,
),
],
),
body: const SizedBox.shrink(),
);
2024-04-03 14:38:40 +02:00
}
}