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,16 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:tm_app/core/constants/assets.dart';
import 'package:provider/provider.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/desktop_navigation_widget.dart';
import '../../shared/main_tab_bar.dart';
import '../widgets/notification_all_tab.dart';
import '../widgets/notification_important_tab.dart';
import '../widgets/notification_unread_tab.dart';
import '../../shared/main_tab_bar.dart';
class DesktopNotificationPage extends StatefulWidget {
const DesktopNotificationPage({super.key});
@@ -38,14 +37,14 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
@override
Widget build(BuildContext context) {
final viewModel = context.watch<NotificationViewModel>();
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Column(
children: [
const DesktopNavigationWidget(currentIndex: 3),
SizedBox(height: 60.0.h()),
Expanded(
child: Center(
child: SizedBox(
@@ -60,15 +59,13 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
NotificationStrings.important,
],
),
SizedBox(height: 12.0.h()),
Padding(
padding: EdgeInsetsDirectional.only(end: 24.0.w()),
child: Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {},
onTap: viewModel.markAllAsRead,
borderRadius: BorderRadius.circular(99),
child: Container(
width: 132.0.w(),
@@ -119,14 +116,14 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
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(
border: Border.all(
@@ -139,7 +136,7 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
children: [
SizedBox(width: 5.0.w()),
Text(
NotificationStrings.currentPage,
viewModel.currentPage.toString(),
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
@@ -147,12 +144,9 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
),
),
SizedBox(width: 5.0.w()),
SvgPicture.asset(
AssetsManager.arrowDownSmall,
colorFilter: ColorFilter.mode(
AppColors.grey80,
BlendMode.srcIn,
),
Icon(
Icons.arrow_drop_down,
color: AppColors.grey80,
),
SizedBox(width: 5.0.w()),
],
@@ -170,7 +164,7 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
),
SizedBox(width: 5.0.w()),
Text(
NotificationStrings.totalPages,
viewModel.totalPages.toString(),
style: TextStyle(
fontSize: 13.0.sp(),
fontWeight: FontWeight.w400,
@@ -179,7 +173,6 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
),
],
),
SizedBox(height: 30.0.h()),
],
),