You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.7 KiB
Dart
96 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:test_sa/controllers/localization/localization.dart';
|
|
import 'package:test_sa/controllers/providers/api/notifications_provider.dart';
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
import 'package:test_sa/models/subtitle.dart';
|
|
import 'package:test_sa/views/app_style/colors.dart';
|
|
import 'package:test_sa/views/pages/user/notifications/notifications_list.dart';
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
class NotificationsPage extends StatefulWidget {
|
|
static final String id = "/notifications";
|
|
|
|
@override
|
|
_NotificationsPageState createState() => _NotificationsPageState();
|
|
}
|
|
|
|
class _NotificationsPageState extends State<NotificationsPage> with TickerProviderStateMixin {
|
|
NotificationsProvider _notificationsProvider;
|
|
UserProvider _userProvider;
|
|
SettingProvider _settingProvider;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
_notificationsProvider = Provider.of<NotificationsProvider>(context);
|
|
_userProvider = Provider.of<UserProvider>(context);
|
|
_settingProvider = Provider.of<SettingProvider>(context);
|
|
|
|
return Scaffold(
|
|
body: SafeArea(
|
|
child: LoadingManager(
|
|
isLoading: _notificationsProvider.isLoading,
|
|
isFailedLoading: _notificationsProvider.notifications == null,
|
|
stateCode: _notificationsProvider.stateCode,
|
|
onRefresh: () async {
|
|
_notificationsProvider.reset();
|
|
await _notificationsProvider.getNotifications(
|
|
user: _userProvider.user,
|
|
host: _settingProvider.host,
|
|
hospitalId: _userProvider.user.clientId,
|
|
);
|
|
},
|
|
child: Stack(
|
|
children: [
|
|
Column(
|
|
children: [
|
|
Container(
|
|
color: AColors.primaryColor,
|
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
ABackButton(),
|
|
Expanded(
|
|
child: Center(
|
|
child: Text(
|
|
context.translation.notifications,
|
|
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 48,
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: NotificationsList(
|
|
nextPage: _notificationsProvider.nextPage,
|
|
onLazyLoad: () async {
|
|
await _notificationsProvider.getNotifications(
|
|
user: _userProvider.user,
|
|
host: _settingProvider.host,
|
|
hospitalId: _userProvider.user.clientId,
|
|
);
|
|
},
|
|
notifications: _notificationsProvider.notifications,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|