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,
|
path: RouteConstants.feedScreen,
|
||||||
name: 'feedScreen',
|
name: 'feedScreen',
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final initialTabIndex = int.tryParse(state.uri.queryParameters['initialTabIndex'] ?? '');
|
final initialTabIndexFromQuery = int.tryParse(state.uri.queryParameters['initialTabIndex'] ?? '');
|
||||||
return NoTransitionPage(child: FeedScreen(initialTabIndex: 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 {
|
redirect: (context, state) async {
|
||||||
try {
|
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/routing/route_constants.dart';
|
||||||
import 'package:eatvio_app/core/theme/custom_text_style.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';
|
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 {
|
class _PlanSubscriptionExpiredWidget extends StatelessWidget {
|
||||||
const _PlanSubscriptionExpiredWidget({required this.notification});
|
const _PlanSubscriptionExpiredWidget({required this.notification});
|
||||||
@@ -737,7 +737,11 @@ class _DietCancelledWidget extends StatelessWidget {
|
|||||||
createdAt: notification.createdAt,
|
createdAt: notification.createdAt,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (notification.dietId > 0) {
|
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}"! Успехов! 🥗',
|
notificationsText: 'Старт диеты "${notification.dietName}"! Успехов! 🥗',
|
||||||
createdAt: notification.createdAt,
|
createdAt: notification.createdAt,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (notification.dietId > 0) {
|
_navigateToBottomNavRoute(context, RouteConstants.diaryScreen);
|
||||||
context.push(RouteConstants.aboutDietScreen, extra: {'id': notification.dietId});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user