import 'package:flutter/material.dart'; import '../../../../controllers/localization/localization.dart'; import '../../../../models/app_notification.dart'; import '../../../../models/subtitle.dart'; import '../../../widgets/loaders/lazy_loading.dart'; import '../../../widgets/loaders/no_item_found.dart'; import '../../../widgets/notifications/notification_item.dart'; import '../requests/future_request_service_details.dart'; class NotificationsList extends StatelessWidget { final List? notifications; final bool? nextPage; final Future Function()? onLazyLoad; const NotificationsList({Key? key, this.notifications, this.nextPage, this.onLazyLoad}) : super(key: key); @override Widget build(BuildContext context) { Subtitle? _subtitle = AppLocalization.of(context)?.subtitle; if ((notifications?.isEmpty ?? false)) { return NoItemFound( message: _subtitle?.notificationsNotFound ?? "", ); } return LazyLoading( nextPage: nextPage ?? false, onLazyLoad: onLazyLoad ?? () async {}, onLoadingEnd: () {}, child: ListView.builder( physics: BouncingScrollPhysics(), itemCount: notifications?.length, padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), itemBuilder: (context, itemIndex) { return NotificationItem( notification: notifications![itemIndex], onPressed: (notification) { Navigator.of(context).pushNamed(FutureRequestServiceDetails.id, arguments: notification.requestId); }, ); }), ); } }