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.
47 lines
1.6 KiB
Dart
47 lines
1.6 KiB
Dart
|
3 years ago
|
|
||
|
3 years ago
|
import 'package:flutter/material.dart';
|
||
|
3 years ago
|
|
||
|
|
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';
|
||
|
3 years ago
|
class NotificationsList extends StatelessWidget {
|
||
|
3 years ago
|
final List<AppNotification>? notifications;
|
||
|
|
final bool? nextPage;
|
||
|
|
final Future<void> Function()? onLazyLoad;
|
||
|
3 years ago
|
|
||
|
3 years ago
|
const NotificationsList({Key? key, this.notifications, this.nextPage, this.onLazyLoad}) : super(key: key);
|
||
|
3 years ago
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
3 years ago
|
Subtitle? _subtitle = AppLocalization.of(context)?.subtitle;
|
||
|
|
if((notifications?.isEmpty??false)){
|
||
|
|
return NoItemFound(message: _subtitle?.notificationsNotFound??"",);
|
||
|
3 years ago
|
}
|
||
|
|
return LazyLoading(
|
||
|
3 years ago
|
nextPage: nextPage??false,
|
||
|
|
onLazyLoad: onLazyLoad??()async{},
|
||
|
|
onLoadingEnd: () { },
|
||
|
3 years ago
|
child: ListView.builder(
|
||
|
|
physics: BouncingScrollPhysics(),
|
||
|
3 years ago
|
itemCount: notifications?.length,
|
||
|
3 years ago
|
padding: EdgeInsets.symmetric(horizontal: 16,vertical: 8),
|
||
|
|
itemBuilder: (context,itemIndex){
|
||
|
|
return NotificationItem(
|
||
|
3 years ago
|
notification: notifications![itemIndex],
|
||
|
3 years ago
|
onPressed: (notification){
|
||
|
|
Navigator.of(context).pushNamed(
|
||
|
|
FutureRequestServiceDetails.id,
|
||
|
|
arguments: notification.requestId
|
||
|
|
);
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|