Skip to content

Commit

Permalink
feat: expose YaruNavigationPage.initialRoute and onUnknownRoute (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi authored Jul 6, 2023
1 parent 2c8d0c9 commit 0bee47a
Showing 1 changed file with 13 additions and 3 deletions.
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

0 comments on commit 0bee47a

Please sign in to comment.