forked from eatvio/eatvio_app
feat(notifications): changed navigation flow from Cancelled diet and started diet notifications
This commit is contained in:
@@ -47,8 +47,12 @@ class MainNavigationRoutes {
|
||||
path: RouteConstants.feedScreen,
|
||||
name: 'feedScreen',
|
||||
pageBuilder: (context, state) {
|
||||
final initialTabIndex = int.tryParse(state.uri.queryParameters['initialTabIndex'] ?? '');
|
||||
return NoTransitionPage(child: FeedScreen(initialTabIndex: initialTabIndex));
|
||||
final initialTabIndexFromQuery = int.tryParse(state.uri.queryParameters['initialTabIndex'] ?? '');
|
||||
final extra = state.extra;
|
||||
if (extra is int) {
|
||||
return NoTransitionPage(child: FeedScreen(initialTabIndex: extra));
|
||||
}
|
||||
return NoTransitionPage(child: FeedScreen(initialTabIndex: initialTabIndexFromQuery));
|
||||
},
|
||||
redirect: (context, state) async {
|
||||
try {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/core/routing/route_constants.dart';
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_nav_scope.dart';
|
||||
@@ -594,7 +595,6 @@ class _EntityCommentedWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Новые виджеты для дополнительных типов уведомлений
|
||||
class _PlanSubscriptionExpiredWidget extends StatelessWidget {
|
||||
const _PlanSubscriptionExpiredWidget({required this.notification});
|
||||
@@ -737,7 +737,11 @@ class _DietCancelledWidget extends StatelessWidget {
|
||||
createdAt: notification.createdAt,
|
||||
onTap: () {
|
||||
if (notification.dietId > 0) {
|
||||
context.push(RouteConstants.aboutDietScreen, extra: {'id': notification.dietId});
|
||||
const dietTabIndexWithHiddenPlansTab = 3;
|
||||
const dietTabIndexWithoutHiddenPlansTab = 4;
|
||||
|
||||
final initialTabIndex = hidePlans ? dietTabIndexWithHiddenPlansTab : dietTabIndexWithoutHiddenPlansTab;
|
||||
_navigateToBottomNavRoute(context, RouteConstants.feedScreen, initialTabIndex);
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -754,9 +758,7 @@ class _DietStartedWidget extends StatelessWidget {
|
||||
notificationsText: 'Старт диеты "${notification.dietName}"! Успехов! 🥗',
|
||||
createdAt: notification.createdAt,
|
||||
onTap: () {
|
||||
if (notification.dietId > 0) {
|
||||
context.push(RouteConstants.aboutDietScreen, extra: {'id': notification.dietId});
|
||||
}
|
||||
_navigateToBottomNavRoute(context, RouteConstants.diaryScreen);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user