Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
notification_screen.dart
Go to the documentation of this file.
1import 'package:connect/core/localization/app_localizations.dart';
2
3import '/core/ui/screens/views/faild_to_fetch_data_view.dart';
4import '/core/ui/widgets/custom_scaffold.dart';
5import '/features/notifications/presentation/logic/notifications_cubit/notifications_cubit.dart';
6import '/features/notifications/presentation/notifications_screen/views/notifications_loaded_view.dart';
7import 'package:flutter/material.dart';
8import 'package:flutter_bloc/flutter_bloc.dart';
9
10import '../../../authentication/presentation/logic/authentication_bloc/authentication_bloc.dart';
11
13 const NotificationsScreen({super.key});
14
15 @override
16 State<NotificationsScreen> createState() => _NotificationsScreenState();
17}
18
19class _NotificationsScreenState extends State<NotificationsScreen> {
21 final authenticationState = context.read<AuthenticationBloc>().state;
22 if (authenticationState is AuthenticatedState) {
23 int? uid = authenticationState.session.uid;
24 if (uid != null) {
25 context.read<NotificationsCubit>().loadNotifications('$uid');
26 }
27 }
28 }
29
30 @override
31 void initState() {
33 super.initState();
34 }
35
36 @override
37 Widget build(BuildContext context) {
38 return BlocBuilder<NotificationsCubit, NotificationsState>(
39 builder: (context, state) {
40 return CustomScaffold(
41 title: AppLocalizations.of(context).translate('NOTIFICATIONS'),
42 isLeadingVisible: true,
43 isLoading: state is LoadingNotificationsState,
44 body: SafeArea(
46 ),
47 );
48 },
49 );
50 }
51
53 if (state is NotificationsLoadedState) {
54 return NotificationLoadedView(notifications: state.notifications);
55 } else if (state is NotificationsLoadingFailureState) {
56 return FailedToFetchDataView(
58 );
59 } else {
60 return const SizedBox();
61 }
62 }
63}
String translate(String key)
static AppLocalizations of(BuildContext context)
final List< NotificationEntity > notifications
override State< NotificationsScreen > createState()
const NotificationsScreen({super.key})
final Widget child
override void initState()
_adaptViewToState(DashboardState state)
class ElearningScreen extends StatefulWidget _triggerEnvironmentalDashboardLoaderEvent()
override Widget build(BuildContext context)
const NotificationsScreen({super.key})
const NotificationsLoadingFailureState({required this.failure})
notifications
Definition routes.dart:73
final int uid
final String title