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

[go_router] Back button not appearing when using Shellroute #144687

Open
claudeJURA opened this issue Mar 6, 2024 · 11 comments
Open

[go_router] Back button not appearing when using Shellroute #144687

claudeJURA opened this issue Mar 6, 2024 · 11 comments
Labels
found in release: 3.19 Found to occur in 3.19 found in release: 3.21 Found to occur in 3.21 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: go_router The go_router package P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. team-go_router Owned by Go Router team triaged-go_router Triaged by Go Router team

Comments

@claudeJURA
Copy link

claudeJURA commented Mar 6, 2024

What package does this bug report belong to?

go_router

What target platforms are you seeing this bug on?

Android

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
  async:
    dependency: transitive
    description:
      name: async
      sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
      url: "https://pub.dev"
    source: hosted
    version: "2.11.0"
  boolean_selector:
    dependency: transitive
    description:
      name: boolean_selector
      sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.1"
  characters:
    dependency: transitive
    description:
      name: characters
      sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
      url: "https://pub.dev"
    source: hosted
    version: "1.3.0"
  clock:
    dependency: transitive
    description:
      name: clock
      sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
      url: "https://pub.dev"
    source: hosted
    version: "1.1.1"
  collection:
    dependency: transitive
    description:
      name: collection
      sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
      url: "https://pub.dev"
    source: hosted
    version: "1.18.0"
  cupertino_icons:
    dependency: "direct main"
    description:
      name: cupertino_icons
      sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
      url: "https://pub.dev"
    source: hosted
    version: "1.0.6"
  fake_async:
    dependency: transitive
    description:
      name: fake_async
      sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
      url: "https://pub.dev"
    source: hosted
    version: "1.3.1"
  flutter:
    dependency: "direct main"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_lints:
    dependency: "direct dev"
    description:
      name: flutter_lints
      sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
      url: "https://pub.dev"
    source: hosted
    version: "2.0.3"
  flutter_test:
    dependency: "direct dev"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_web_plugins:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.0"
  go_router:
    dependency: "direct main"
    description:
      name: go_router
      sha256: "170c46e237d6eb0e6e9f0e8b3f56101e14fb64f787016e42edd74c39cf8b176a"
      url: "https://pub.dev"
    source: hosted
    version: "13.2.0"
  lints:
    dependency: transitive
    description:
      name: lints
      sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.1"
  logging:
    dependency: transitive
    description:
      name: logging
      sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
      url: "https://pub.dev"
    source: hosted
    version: "1.2.0"
  matcher:
    dependency: transitive
    description:
      name: matcher
      sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
      url: "https://pub.dev"
    source: hosted
    version: "0.12.16"
  material_color_utilities:
    dependency: transitive
    description:
      name: material_color_utilities
      sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
      url: "https://pub.dev"
    source: hosted
    version: "0.5.0"
  meta:
    dependency: transitive
    description:
      name: meta
      sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
      url: "https://pub.dev"
    source: hosted
    version: "1.10.0"
  path:
    dependency: transitive
    description:
      name: path
      sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
      url: "https://pub.dev"
    source: hosted
    version: "1.8.3"
  sky_engine:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.99"
  source_span:
    dependency: transitive
    description:
      name: source_span
      sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
      url: "https://pub.dev"
    source: hosted
    version: "1.10.0"
  stack_trace:
    dependency: transitive
    description:
      name: stack_trace
      sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
      url: "https://pub.dev"
    source: hosted
    version: "1.11.1"
  stream_channel:
    dependency: transitive
    description:
      name: stream_channel
      sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
      url: "https://pub.dev"
    source: hosted
    version: "2.1.2"
  string_scanner:
    dependency: transitive
    description:
      name: string_scanner
      sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
      url: "https://pub.dev"
    source: hosted
    version: "1.2.0"
  term_glyph:
    dependency: transitive
    description:
      name: term_glyph
      sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
      url: "https://pub.dev"
    source: hosted
    version: "1.2.1"
  test_api:
    dependency: transitive
    description:
      name: test_api
      sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
      url: "https://pub.dev"
    source: hosted
    version: "0.6.1"
  vector_math:
    dependency: transitive
    description:
      name: vector_math
      sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.4"
  web:
    dependency: transitive
    description:
      name: web
      sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
      url: "https://pub.dev"
    source: hosted
    version: "0.3.0"
sdks:
  dart: ">=3.2.2 <4.0.0"
  flutter: ">=3.13.0"

Steps to reproduce

1.Create a ShellRoute with some routes.
2.From these GoRoutes provide Scaffold Widgets.
3.Use the push() method to navigate to these Routes.

Hint: Providing a Scaffold inside the ShellRoute builder method, to wrap the actual child, results in a working back button! See the example code for both cases.

Expected results

Expect a Scaffold widget provided by a GoRoute within a ShellRoute to show the back button correctly.

Actual results

A Scaffold widget provided by a GoRoute within a ShellRoute does not show the back button correctly.

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      routerConfig: RouterStuff.router,
    );
  }
}

class RouterStuff {
  static GlobalKey<NavigatorState> _rootNavigatorKey = GlobalKey<NavigatorState>(debugLabel: "root");
  static GlobalKey<NavigatorState> _branchNavigatorKey = GlobalKey<NavigatorState>(debugLabel: "branch");
  static GlobalKey<NavigatorState> _branchNavigatorKey2 = GlobalKey<NavigatorState>(debugLabel: "branch2");

  static GoRouter router = GoRouter(
    initialLocation: "/a",
    navigatorKey: _rootNavigatorKey,
    routes: <RouteBase>[
      StatefulShellRoute.indexedStack(
        branches: [
          StatefulShellBranch(navigatorKey: _branchNavigatorKey, routes: [
            GoRoute(path: "/a", builder: (context, state) => PageA()),
            ShellRoute(
                builder: (context, state, child) {
                  return child;
                },
                routes: [
                  GoRoute(path: "/b", builder: (context, state) => PageB()),
                ]),
            ShellRoute(
              builder: (context, state, child) {
                return Scaffold(
                  appBar: AppBar(
                    title: Text("Back Button Works"),
                  ),
                  body: child,
                );
              },
              routes: [
                GoRoute(path: "/c", builder: (context, state) => PageC()),
              ],
            )
          ]),
          StatefulShellBranch(navigatorKey: _branchNavigatorKey2, routes: [
            GoRoute(path: "/foo", builder: (context, state) => PageB()),
          ])
        ],
        builder: (context, state, shell) => Scaffold(
          body: shell,
        ),
      ),
    ],
  );
}

class PageA extends StatelessWidget {
  const PageA({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(
        width: double.infinity,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            FilledButton(
              onPressed: () => GoRouter.of(context).push("/b"),
              child: Text("Go To B"),
            ),
            FilledButton(
              onPressed: () => GoRouter.of(context).push("/c"),
              child: Text("Go To C"),
            ),
          ],
        ),
      ),
    );
  }
}

class PageC extends StatelessWidget {
  const PageC({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Text("Page C"),
    );
  }
}

class PageB extends StatelessWidget {
  const PageB({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("no back button!"),
      ),
      body: Center(
        child: Text("Page B"),
      ),
    );
  }
}

Screenshots or Videos

Screenshots / Video demonstration

[Upload media here]

Logs

No response

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.2, on macOS 14.2.1 23C71 darwin-arm64, locale en-CH)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.87.0)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Mar 7, 2024
@darshankawar
Copy link
Member

Thanks for the report @claudeJURA
Can you check if this resembles your case or not ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 7, 2024
@claudeJURA
Copy link
Author

No I don't believe it does. In my case the Android system back button works fine, even in the case where the Scaffold is not showing the back button.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 7, 2024
@darshankawar
Copy link
Member

Thanks for the update.

144687.mov
stable, master flutter doctor -v
[!] Flutter (Channel stable, 3.19.2, on macOS 12.2.1 21D62 darwin-x64, locale
    en-GB)
    • Flutter version 3.19.2 on channel stable at
      /Users/dhs/documents/fluttersdk/flutter
    ! Warning: `flutter` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
      your current Flutter SDK checkout at
      /Users/dhs/documents/fluttersdk/flutter. Consider adding
      /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
      Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
      of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7482962148 (5 days ago), 2024-02-27 16:51:22 -0500
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

[!] Flutter (Channel master, 3.21.0-2.0.pre.21, on macOS 12.2.1 21D62
    darwin-x64, locale en-GB)
    • Flutter version 3.21.0-2.0.pre.21 on channel master at
      /Users/dhs/documents/fluttersdk/flutter
    ! Warning: `flutter` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
      your current Flutter SDK checkout at
      /Users/dhs/documents/fluttersdk/flutter. Consider adding
      /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
      Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
      of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f677027655 (26 hours ago), 2024-03-06 22:57:32 -0500
    • Engine revision 6c1751bd77
    • Dart version 3.4.0 (build 3.4.0-207.0.dev)
    • DevTools version 2.33.1
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/dhs/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 65.1.4
    • Dart plugin version 213.7228

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.29.0

[✓] Connected device (3 available)
    • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
      • iOS 15.3.1 19D52
    • macOS (desktop)           • macos                                    •
      darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)              • chrome                                   •
      web-javascript • Google Chrome 109.0.5414.119

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
      
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.



@darshankawar darshankawar added package flutter/packages repository. See also p: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on p: go_router The go_router package team-go_router Owned by Go Router team found in release: 3.19 Found to occur in 3.19 found in release: 3.21 Found to occur in 3.21 and removed in triage Presently being triaged by the triage team labels Mar 8, 2024
@chunhtai
Copy link
Contributor

chunhtai commented May 2, 2024

This is WAI, The Page B is build inside of the Shell, so there isn't other page underneath PageB. While AppBar of page C is on the Shell itself, so it can tell there is a page underneath.

What's the use case for PageB? couldn't you just add the Scaffold in ShellRoute of PageB?

@chunhtai chunhtai added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds P3 Issues that are less important to the Flutter project triaged-go_router Triaged by Go Router team labels May 2, 2024
@claudeJURA
Copy link
Author

I do not wish to provide the Scaffold in the ShellRoute builder because PageB and its siblings may have different Scaffold requirements (different titles, floatingActionButtons etc.).

In the example I provided the Shellroute hosting PageB just directly returns the child from its builder. In my application however the Shellroute wraps the child with a BlocProvider widget, used to provide some common state to all pages in the shellroute.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 3, 2024
@claudeJURA
Copy link
Author

As a side note: calling context.canPop() inside the Scaffold of PageB works just fine and I can tell whether or not going back is possible or not. I therefore believe that the Scaffold of PageB should be able to display a back button as well.

@sagar-tide
Copy link

Any update on this?

@SAGARSURI
Copy link

SAGARSURI commented Jun 29, 2024

This is WAI, The Page B is build inside of the Shell, so there isn't other page underneath PageB. While AppBar of page C is on the Shell itself, so it can tell there is a page underneath.

What's the use case for PageB? couldn't you just add the Scaffold in ShellRoute of PageB?

The problem with that is, there will be shared AppBar() if we pass it inside the ShellRoute. We want the children to have their own AppBar(). Once the user is coming out of the nested navigation stack. They can easily pop out to the parent.

Usecase:
I have a large app with multiple product flows in it e.g payment, accounts, profile, onboarding etc. I want individual products to have their own Navigation stack instead of connect everything to the root/parent navigation. So if the user enter from Home screen to Payment screen. The user should enter a payment flow(nested navigation stack). Once they enter the payment flow they should be seeing the back button on all the screens of the payment flow.

@csells
Copy link
Contributor

csells commented Jul 16, 2024

There are lots of UI that the ShellRoute enables and for some of those, you want to show the back button for the currently active ShellRoute on a top-level AppBar. For example, I'm building an app that's a multi-page reader, but it also includes a pane that's independent of the page that the user is reading. In that case, I want the ShellRoute to be nested under the top-level Scaffold/AppBar so that the user can interact w/ the extra pane w/o being affected by the nav.

Here's a silly sample I built that builds panes all around the navigated pages to illustrate what I mean:

sample

To enable the back button on the top-level AppBar, I manually reflect the state of the ShellRoute's canPop state to the top-level AppBar and show a BackButton as appropriate. Here's the sample that goes along with the animated gif.

All of that said, this feels like a hack. I'm sure there's a better way to do this and I'm open to suggestions. Even better if the GoRouter could do something to take away the boilerplate for this kind of scenario.

I'd especially love your thoughts, @chunhtai and @johnpryan.

@csells
Copy link
Contributor

csells commented Jul 16, 2024

come to think of it, from my pov, every Scaffold + AppBar belongs in a ShellRoute -- transitions are particularly ugly for AppBars and the ShellRoute provides a wonderful way to reuse the top-level chrome shared between pages. Arguably, GoRouter itself should be a ShellRoute and all of the navigated pages should all be in the ShellRoute child.

@btrautmann
Copy link

It would be a shame to close this as WAI. As previously pointed out, forcing an AppBar to be declared within the ShellRoute's builder limits flexibility to the underlying routes. I'm using ShellRoute as a way to isolate flows. In doing so I can provide dependencies (i.e not UI elements) through the builder rather than needing to hoist them up to the top of the app.

It looks like this:

  ShellRoute(
    parentNavigatorKey: rootNavigatorKey,
    builder: (context, state, child) {
      return Flow(
        createManager: (_) => SettingsCreateCategoryViewFlow.create(),
        child: child,
      );
    },
    routes: [
      GoRoute(
        path: 'new',
        builder: (context, state) => const SettingsCreateCategoryView(),
        routes: [
          GoRoute(
            path: 'name',
            builder: (context, state) => const SettingsNameNewCategoryViewScreen(),
          ),
        ],
      ),
    ],
  ),

The resulting UI looks like the following:

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-07-24.at.09.15.51.mp4

This is WAI, The Page B is build inside of the Shell, so there isn't other page underneath PageB

FWIW, I am able to hook up a CloseButton as the leading Widget on an AppBar like so:

appBar: AppBar(
  // Need to show this due to being the first route in a ShellRoute
  leading: CloseButton(onPressed: () => GoRouter.of(context).pop()),
  title: const Text('Choose goal type'),
),

This works just fine. It would be great to have this supported out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
found in release: 3.19 Found to occur in 3.19 found in release: 3.21 Found to occur in 3.21 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: go_router The go_router package P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. team-go_router Owned by Go Router team triaged-go_router Triaged by Go Router team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants