Added notification logic and view api

This commit is contained in:
llsajjad
2025-09-22 16:05:08 +03:30
parent 2e2718a92e
commit cfc61daf71
23 changed files with 1944 additions and 152 deletions
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
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/view_models/notification_view_model.dart';
import 'package:tm_app/views/notification/strings/notification_strings.dart';
import 'package:tm_app/views/shared/page_selection_dialog.dart';
import 'package:tm_app/views/shared/tablet_navigation_widget.dart';
@@ -38,7 +40,9 @@ class _TabletNotificationPageState extends State<TabletNotificationPage>
@override
Widget build(BuildContext context) {
final viewModel = context.watch<NotificationViewModel>();
final GlobalKey<ScaffoldState> key = GlobalKey();
return Scaffold(
key: key,
backgroundColor: AppColors.backgroundColor,
@@ -66,7 +70,7 @@ class _TabletNotificationPageState extends State<TabletNotificationPage>
child: Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {},
onTap: viewModel.markAllAsRead,
borderRadius: BorderRadius.circular(99),
child: Container(
width: 132.0.w(),
@@ -101,7 +105,6 @@ class _TabletNotificationPageState extends State<TabletNotificationPage>
),
),
SizedBox(height: 10.0.h()),
Row(
children: [
const Spacer(),
@@ -118,12 +121,14 @@ class _TabletNotificationPageState extends State<TabletNotificationPage>
onTap: () async {
final selectedPage = await showDialog<int>(
context: context,
builder:
(context) =>
const PageSelectionDialog(totalPages: 10),
builder: (context) => PageSelectionDialog(
totalPages: viewModel.totalPages,
),
);
if (selectedPage != null) {}
if (selectedPage != null) {
viewModel.jumpToPage(selectedPage);
}
},
child: Container(
decoration: BoxDecoration(
@@ -134,7 +139,7 @@ class _TabletNotificationPageState extends State<TabletNotificationPage>
children: [
SizedBox(width: 5.0.w()),
Text(
NotificationStrings.currentPage,
viewModel.currentPage.toString(),
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
@@ -165,7 +170,7 @@ class _TabletNotificationPageState extends State<TabletNotificationPage>
),
SizedBox(width: 5.0.w()),
Text(
NotificationStrings.totalPages,
viewModel.totalPages.toString(),
style: TextStyle(
fontSize: 13.0.sp(),
fontWeight: FontWeight.w400,
@@ -174,7 +179,6 @@ class _TabletNotificationPageState extends State<TabletNotificationPage>
),
],
),
SizedBox(height: 30.0.h()),
],
),