Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose YaruNavigationPage.initialRoute and onUnknownRoute #731

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 13 additions & 3 deletions lib/src/widgets/navi_rail/yaru_navigation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ class YaruNavigationPage extends StatefulWidget {
this.controller,
this.leading,
this.trailing,
this.onGenerateRoute,
this.navigatorKey,
this.initialRoute,
this.onGenerateRoute,
this.onUnknownRoute,
}) : assert(initialIndex == null || controller == null),
assert((length == null) != (controller == null));

Expand Down Expand Up @@ -62,11 +64,17 @@ class YaruNavigationPage extends StatefulWidget {
/// The trailing widget in the rail that is placed below the destinations.
final Widget? trailing;

/// A key to use when building the [Navigator] widget.
final GlobalKey<NavigatorState>? navigatorKey;

/// The route name for the initial route.
final String? initialRoute;

/// Called to generate a route for a given [RouteSettings].
final RouteFactory? onGenerateRoute;

/// A key to use when building the [Navigator] widget.
final GlobalKey<NavigatorState>? navigatorKey;
/// Called when [onGenerateRoute] fails to generate a route.
final RouteFactory? onUnknownRoute;

@override
State<YaruNavigationPage> createState() => _YaruNavigationPageState();
Expand Down Expand Up @@ -191,7 +199,9 @@ class _YaruNavigationPageState extends State<YaruNavigationPage> {
: widget.pageBuilder(context, 0),
),
],
initialRoute: widget.initialRoute,
onGenerateRoute: widget.onGenerateRoute,
onUnknownRoute: widget.onUnknownRoute,
onPopPage: (route, result) => route.didPop(result),
observers: [HeroController()],
),
Expand Down