2022-11-19 03:49:11 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2022-11-19 05:00:17 +00:00
|
|
|
import 'package:provider/provider.dart';
|
2022-11-19 03:49:11 +00:00
|
|
|
|
|
|
|
import '../controls/app_bottom_nav_bar.dart';
|
2022-11-19 05:00:17 +00:00
|
|
|
import '../controls/notifications_control.dart';
|
|
|
|
import '../services/notifications_manager.dart';
|
2022-11-19 03:49:11 +00:00
|
|
|
|
|
|
|
class NotificationsScreen extends StatelessWidget {
|
|
|
|
const NotificationsScreen({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-11-19 05:00:17 +00:00
|
|
|
final manager = context.watch<NotificationsManager>();
|
|
|
|
final notifications = manager.notifications;
|
|
|
|
if (notifications.isEmpty) {
|
|
|
|
manager.updateNotifications();
|
|
|
|
}
|
2022-11-19 03:49:11 +00:00
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text('Notifications'),
|
|
|
|
),
|
2022-11-19 05:00:17 +00:00
|
|
|
body: ListView.separated(
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return NotificationControl(notification: notifications[index]);
|
|
|
|
},
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
return Divider();
|
|
|
|
},
|
|
|
|
itemCount: notifications.length),
|
2022-11-19 03:49:11 +00:00
|
|
|
bottomNavigationBar: AppBottomNavBar(
|
|
|
|
currentButton: NavBarButtons.notifications,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|