|
|
|
@ -1,5 +1,6 @@
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/all_requests_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/api/notifications_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/api/notifications_provider.dart';
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
@ -10,12 +11,19 @@ import 'package:test_sa/views/widgets/notifications/notification_item.dart';
|
|
|
|
class RecentActivitiesFragment extends StatelessWidget {
|
|
|
|
class RecentActivitiesFragment extends StatelessWidget {
|
|
|
|
RecentActivitiesFragment({Key key}) : super(key: key);
|
|
|
|
RecentActivitiesFragment({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
NotificationsProvider _notificationsProvider;
|
|
|
|
//NotificationsProvider _notificationsProvider;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
_notificationsProvider ??= Provider.of<NotificationsProvider>(context, listen: false);
|
|
|
|
//_notificationsProvider ??= Provider.of<NotificationsProvider>(context, listen: false);
|
|
|
|
return SingleChildScrollView(
|
|
|
|
return Consumer<NotificationsProvider>(builder: (context, _notificationsProvider, _) {
|
|
|
|
|
|
|
|
return RefreshIndicator(
|
|
|
|
|
|
|
|
onRefresh: () {
|
|
|
|
|
|
|
|
Provider.of<AllRequestsProvider>(context, listen: false).getRequests();
|
|
|
|
|
|
|
|
_notificationsProvider.getSystemNotifications();
|
|
|
|
|
|
|
|
return Future.delayed(const Duration(microseconds: 250));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
@ -27,7 +35,12 @@ class RecentActivitiesFragment extends StatelessWidget {
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
context.translation.recentActivities.heading5(context).paddingOnly(top: 16, start: 16, end: 16),
|
|
|
|
context.translation.recentActivities
|
|
|
|
|
|
|
|
.heading5(context)
|
|
|
|
|
|
|
|
.toShimmer(
|
|
|
|
|
|
|
|
isShow: _notificationsProvider.isLoading,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.paddingOnly(top: 16, start: 16, end: 16),
|
|
|
|
ListView.separated(
|
|
|
|
ListView.separated(
|
|
|
|
shrinkWrap: true,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
@ -37,6 +50,7 @@ class RecentActivitiesFragment extends StatelessWidget {
|
|
|
|
itemBuilder: (context, itemIndex) {
|
|
|
|
itemBuilder: (context, itemIndex) {
|
|
|
|
// todo add priority & progress tag to show chip
|
|
|
|
// todo add priority & progress tag to show chip
|
|
|
|
return NotificationItem(
|
|
|
|
return NotificationItem(
|
|
|
|
|
|
|
|
isLoading: _notificationsProvider.isLoading,
|
|
|
|
notification: _notificationsProvider.notifications[itemIndex],
|
|
|
|
notification: _notificationsProvider.notifications[itemIndex],
|
|
|
|
onPressed: (notification) {
|
|
|
|
onPressed: (notification) {
|
|
|
|
// todo @sikander, check notifications payload, because notification model is different to need to check from backend
|
|
|
|
// todo @sikander, check notifications payload, because notification model is different to need to check from backend
|
|
|
|
@ -48,6 +62,8 @@ class RecentActivitiesFragment extends StatelessWidget {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|