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.
44 lines
1.6 KiB
Dart
44 lines
1.6 KiB
Dart
|
3 years ago
|
import 'package:test_sa/controllers/localization/localization.dart';
|
||
|
|
import 'package:test_sa/models/app_notification.dart';
|
||
|
|
import 'package:test_sa/models/subtitle.dart';
|
||
|
|
import 'package:test_sa/views/pages/user/requests/future_request_service_details.dart';
|
||
|
|
import 'package:test_sa/views/widgets/loaders/lazy_loading.dart';
|
||
|
|
import 'package:test_sa/views/widgets/loaders/no_item_found.dart';
|
||
|
|
import 'package:test_sa/views/widgets/notifications/notification_item.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
class NotificationsList extends StatelessWidget {
|
||
|
|
final List<AppNotification> notifications;
|
||
|
|
final bool nextPage;
|
||
|
|
final Future<void> 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.length == 0){
|
||
|
|
return NoItemFound(message: _subtitle.notificationsNotFound,);
|
||
|
|
}
|
||
|
|
return LazyLoading(
|
||
|
|
nextPage: nextPage,
|
||
|
|
onLazyLoad: onLazyLoad,
|
||
|
|
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
|
||
|
|
);
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|