|
|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:test_sa/controllers/localization/localization.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/system_notification_model.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';
|
|
|
|
|
@ -17,28 +15,35 @@ class NotificationsList extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
if (notifications.length == 0) {
|
|
|
|
|
return NoItemFound(
|
|
|
|
|
message: context.translation.notificationsNotFound,
|
|
|
|
|
);
|
|
|
|
|
if (notifications.isEmpty) {
|
|
|
|
|
return NoItemFound(message: context.translation.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) {
|
|
|
|
|
// todo @sikander, check notifications payload, because notification model is different to need to check from backend
|
|
|
|
|
//Navigator.of(context).pushNamed(FutureRequestServiceDetails.id, arguments: notification.requestId);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Card(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: notifications.length,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (context, itemIndex) {
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
NotificationItem(
|
|
|
|
|
notification: notifications[itemIndex],
|
|
|
|
|
onPressed: (notification) {
|
|
|
|
|
// todo @sikander, check notifications payload, because notification model is different to need to check from backend
|
|
|
|
|
//Navigator.of(context).pushNamed(FutureRequestServiceDetails.id, arguments: notification.requestId);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (itemIndex != (notifications.length - 1)) const Divider().defaultStyle(context).paddingOnly(start: 16, end: 16),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|