Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- part of 'notification_page.dart';
- class PostsContentView extends StatelessWidget {
- const PostsContentView({
- Key? key,
- this.notif,
- }) : super(key: key);
- final Notif? notif;
- @override
- Widget build(BuildContext context) {
- debugPrint('Build: $runtimeType');
- final _refreshController = RefreshController(initialRefresh: false);
- if (notif != null && notif!.data.isEmpty) {
- return PullRefreshWidget(
- controller: _refreshController,
- onRefresh: () {
- context.read<UserNotificationCubit>().fetchUserNotification();
- _refreshController.refreshCompleted();
- },
- child: const InfoWidgetNoData());
- } else {
- if (notif != null) {
- return PullRefreshWidget(
- controller: _refreshController,
- onRefresh: () {
- context.read<UserNotificationCubit>().fetchUserNotification();
- _refreshController.refreshCompleted();
- },
- child: ListView.builder(
- itemBuilder: (BuildContext context, int index) {
- return ContentWidgetNotif(
- title: notif!.data[index].title ?? '-',
- message: notif!.data[index].message ?? '-',
- datetime: notif!.data[index].createdDatetime!,
- );
- },
- itemCount: notif!.data.length,
- ),
- );
- }
- return const SizedBox();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement