Skip to content

Commit

Permalink
feat: set currentIndex from route on Web Platform (#963)
Browse files Browse the repository at this point in the history
* Add RouterServiceInterface to Stacked package

* Add setCurrentWebPageIndex method to IndexTrackingViewModel

* Update cupertino_icons on example apps

* Sort routes to match BottomNavigation items order

* Call setCurrentWebPageIndex on Class Constructor

Allows to set the index of the Bottom Navigation Bar using the current
route at Web Platform when app starts from scratch which means there is
no state for the currentIndex property to track the selected button.

* Fix format

---------

Co-authored-by: Dane Mackier <dane.mackier@outlook.com>
  • Loading branch information
ferrarafer and FilledStacks authored May 31, 2023
1 parent 63ad67f commit cfd1378
Show file tree
Hide file tree
Showing 12 changed files with 792 additions and 125 deletions.
2 changes: 1 addition & 1 deletion example/navigator_example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
cupertino_icons: ^1.0.2

# state management
stacked:
Expand Down
8 changes: 4 additions & 4 deletions example/router_example/lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ import 'custom_route_transition.dart';
MaterialRoute(page: HomeView, initial: true),
MaterialRoute(page: BottomNavExample, children: [
RedirectRoute(path: '', redirectTo: 'favorites'),
CustomRoute(
page: HistoryView,
transitionsBuilder: TransitionsBuilders.fadeIn,
),
AdaptiveRoute(
path: 'favourites',
page: FavoritesView,
Expand All @@ -44,6 +40,10 @@ import 'custom_route_transition.dart';
CustomRoute(page: HistoryView),
],
),
CustomRoute(
page: HistoryView,
transitionsBuilder: TransitionsBuilders.fadeIn,
),
CupertinoRoute(page: ProfileView),
]),
MaterialRoute(page: StreamCounterView),
Expand Down
Loading

0 comments on commit cfd1378

Please sign in to comment.