update notification tab data when clicking on navigation bars
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:tm_app/views/profile/strings/profile_strings.dart';
|
||||
import 'package:tm_app/views/tenders/strings/tenders_strings.dart';
|
||||
|
||||
import '../../core/routes/app_routes.dart';
|
||||
import '../../view_models/notification_view_model.dart';
|
||||
|
||||
class DesktopNavigationWidget extends StatelessWidget {
|
||||
const DesktopNavigationWidget({
|
||||
@@ -103,7 +104,7 @@ class DesktopNavigationWidget extends StatelessWidget {
|
||||
context,
|
||||
() => const NotificationRouteData().go(context),
|
||||
);
|
||||
//context.read<notificationViewModel>().getTenders();
|
||||
context.read<NotificationViewModel>().init();
|
||||
}
|
||||
},
|
||||
iconPath: AssetsManager.notify,
|
||||
@@ -148,57 +149,56 @@ class DesktopNavigationWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _navigationItem({
|
||||
required BuildContext context,
|
||||
required String text,
|
||||
required bool isActive,
|
||||
required VoidCallback onTap,
|
||||
required String iconPath,
|
||||
required String activeIconPath,
|
||||
}) {
|
||||
final hasUnread = context.watch<HomeViewModel>().hasUnreadNotification;
|
||||
Widget _navigationItem({
|
||||
required BuildContext context,
|
||||
required String text,
|
||||
required bool isActive,
|
||||
required VoidCallback onTap,
|
||||
required String iconPath,
|
||||
required String activeIconPath,
|
||||
}) {
|
||||
final hasUnread = context.watch<HomeViewModel>().hasUnreadNotification;
|
||||
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: 115.0,
|
||||
height: 64,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
SvgPicture.asset(isActive ? activeIconPath : iconPath),
|
||||
if (text == TendersStrings.notifications && hasUnread)
|
||||
Positioned(
|
||||
right: -5,
|
||||
top: -2,
|
||||
child: Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red,
|
||||
shape: BoxShape.circle,
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: 115.0,
|
||||
height: 64,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
SvgPicture.asset(isActive ? activeIconPath : iconPath),
|
||||
if (text == TendersStrings.notifications && hasUnread)
|
||||
Positioned(
|
||||
right: -5,
|
||||
top: -2,
|
||||
child: Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: isActive ? AppColors.primaryColor : AppColors.grey60,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: isActive ? AppColors.primaryColor : AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user