-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[go_router_builder] add support to go_router_builder for initializing…
… a StatefulShellBranch with observers (#5865) This pr added the ability to provide a list of NavigatorObservers to a StatefulShellBranch. The equivalent was never added to go_router_builder, so this pr provides that functionality. With this change, you can provide NavigatorObservers directly to the StatefulShellBranch and fix flutter/flutter#143869.
- Loading branch information
Showing
5 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/go_router_builder/test_inputs/statefull_shell_branch_with_observers_data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:flutter/widgets.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
|
||
@TypedStatefulShellBranch<StatefulShellBranchWithObserversData>() | ||
class StatefulShellBranchWithObserversData extends StatefulShellBranchData { | ||
const StatefulShellBranchWithObserversData(); | ||
|
||
static const String $initialLocation = '/main/second-tab'; | ||
static const List<NavigatorObserver> $observers = <NavigatorObserver>[]; | ||
} |
5 changes: 5 additions & 0 deletions
5
...ages/go_router_builder/test_inputs/statefull_shell_branch_with_observers_data.dart.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
RouteBase get $statefulShellBranchWithObserversData => | ||
StatefulShellBranchData.$branch( | ||
initialLocation: StatefulShellBranchWithObserversData.$initialLocation, | ||
observers: StatefulShellBranchWithObserversData.$observers, | ||
); |