added new response data from notifications api
This commit is contained in:
@@ -143,9 +143,9 @@ class _MobileNotificationPageState extends State<MobileNotificationPage>
|
||||
),
|
||||
|
||||
if ((viewModel.isLoadingAll &&
|
||||
(viewModel.allNotificationResponse?.data?.notifications?.isEmpty ?? true)) ||
|
||||
(viewModel.allNotificationResponse?.data?.isEmpty ?? true)) ||
|
||||
(viewModel.isLoadingUnread &&
|
||||
(viewModel.unreadNotificationResponse?.data?.notifications?.isEmpty ?? true)))
|
||||
(viewModel.unreadNotificationResponse?.data?.isEmpty ?? true)))
|
||||
const Expanded(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||
|
||||
@@ -13,7 +13,7 @@ class NotificationAllTab extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final viewModel = context.watch<NotificationViewModel>();
|
||||
final notifications =
|
||||
viewModel.allNotificationResponse?.data?.notifications ?? [];
|
||||
viewModel.allNotificationResponse?.data ?? [];
|
||||
|
||||
return ListView.builder(
|
||||
controller: scrollController,
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/constants/assets.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/data/services/model/notification_data/notification_data.dart';
|
||||
import 'package:tm_app/data/services/model/notification__response/notification_response_model.dart';
|
||||
import 'package:tm_app/view_models/notification_view_model.dart';
|
||||
|
||||
import '../strings/notification_strings.dart';
|
||||
@@ -102,7 +102,7 @@ class NotificationCard extends StatelessWidget {
|
||||
SvgPicture.asset(AssetsManager.calendar),
|
||||
SizedBox(width: 4.0.w()),
|
||||
Text(
|
||||
viewModel.timeAgo(notification.createdAt!),
|
||||
viewModel.timeAgo(notification.createdAt!.toString()),
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
|
||||
@@ -17,9 +17,9 @@ class NotificationImportantTab extends StatelessWidget {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
final importantFromApi = viewModel.importantNotificationResponse?.data?.notifications ?? [];
|
||||
final importantFromApi = viewModel.importantNotificationResponse?.data ?? [];
|
||||
|
||||
final allNotifications = viewModel.allNotificationResponse?.data?.notifications ?? [];
|
||||
final allNotifications = viewModel.allNotificationResponse?.data ?? [];
|
||||
|
||||
final source = importantFromApi.isNotEmpty ? importantFromApi : allNotifications;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class NotificationUnreadTab extends StatelessWidget {
|
||||
}
|
||||
|
||||
final notifications =
|
||||
viewModel.unreadNotificationResponse?.data?.notifications ?? [];
|
||||
viewModel.unreadNotificationResponse?.data ?? [];
|
||||
|
||||
if (notifications.isEmpty) {
|
||||
return const Center(child: Text(NotificationStrings.noUnreadNotifications,));
|
||||
|
||||
Reference in New Issue
Block a user