Skip to content

BackButton is not displayed when there is a endDrawer #80256

Description

@StarOfLife

in Flutter 2.0 ,my app page has a endDrawer and it can pop.but the backbutton is not show .I found it in app_bar.dart

image

is this a bug or a new feature

Activity

  1. pedromassangocode commented on Apr 12, 2021

    @pedromassangocode

    Hi @StarOfLife
    Can you please provide your flutter doctor -v and a minimal complete reproducible code sample?
    Thank you

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 12, 2021
  3. StarOfLife commented on Apr 13, 2021

    @StarOfLife
    Author

    flutter doctor -v
    [√] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.19041.867], locale zh-CN)
    • Flutter version 2.0.0 at C:\Users\my\fvm\versions\stable
    • Framework revision 60bd88d (6 weeks ago), 2021-03-03 09:13:17 -0800
    • Engine revision 40441de
    • Dart version 2.12.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

    [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at G:\AndroidSdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_HOME = G:\AndroidSdk
    • Java binary at: F:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

    [√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

    [√] Android Studio (version 4.1.0)
    • Android Studio at F:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
    https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
    https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

    [√] VS Code (version 1.55.1)
    • VS Code at C:\Users\my\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.21.0

    [√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
    • Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.75

    ! Doctor found issues in 1 category.

  4. StarOfLife commented on Apr 13, 2021

    @StarOfLife
    Author

    I'm looking forward to the AppBar showing like this.
    image

    but it like this:
    image

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 13, 2021
  6. StarOfLife commented on Apr 13, 2021

    @StarOfLife
    Author
    code sample
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          home: MyHomePage(title: 'Flutter Demo Home Page'),
          routes: {
            "/subpage": (_) => SubPage(),
          },
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      MyHomePage({Key? key, required this.title}) : super(key: key);
    
      final String title;
    
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          backgroundColor: Colors.white,
          appBar: AppBar(
            title: Text("Home"),
          ),
          body: Center(
            child: ElevatedButton(
                child: Text(
                  "Router",
                  style: TextStyle(color: Colors.white),
                ),
                onPressed: () {
                  Navigator.of(context).pushNamed("/subpage");
                }),
          ),
        );
      }
    }
    
    class SubPage extends StatefulWidget {
      @override
      _SubPageState createState() => _SubPageState();
    }
    
    class _SubPageState extends State<SubPage> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text("subPage"),
          ),
          backgroundColor: Colors.white,
          body: Center(
            child: Text("this is subpage"),
          ),
          endDrawer: Drawer(
            child: Padding(
              padding: EdgeInsets.all(20),
              child: Center(
                child: Text("this is endDrawer"),
              ),
            ),
          ),
        );
      }
    }
    
  7. pedromassangocode commented on Apr 13, 2021

    @pedromassangocode

    The changes mentioned in the OP were introduced by @chunhtai in #73993. I'm not really sure if this is a bug or feature.

    Feel free to act accordingly.

    flutter doctor -v
    [✓] Flutter (Channel master, 2.1.0-13.0.pre.587, on macOS 11.2.3 20D91 darwin-x64, locale en-AO)
        • Flutter version 2.1.0-13.0.pre.587 at /Users/pedromassango/Code/flutter_master
        • Framework revision 0fdc4e8805 (5 hours ago), 2021-04-12 18:50:00 -0700
        • Engine revision 8863afff16
        • Dart version 2.13.0 (build 2.13.0-222.0.dev)
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
        • Android SDK at /Users/pedromassango/Library/Android/sdk
        • Platform android-30, build-tools 30.0.2
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    [!] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.4, Build version 12D4e
        ✗ CocoaPods not installed.
            CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
            Without CocoaPods, plugins will not work on iOS or macOS.
            For more info, see https://flutter.dev/platform-plugins
          To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    [✓] Android Studio (version 4.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    [✓] IntelliJ IDEA Community Edition (version 2021.1)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 55.0.5
        • Dart plugin version 211.6693.108
    [✓] VS Code (version 1.54.3)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.16.0
    [✓] Connected device (4 available)
        • Redmi 5 Plus (mobile)      • 0258ff700005  • android-arm64  • Android 8.1.0 (API 27)
        • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64    • Android 11 (API 30) (emulator)
        • macOS (desktop)            • macos         • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
        • Chrome (web)               • chrome        • web-javascript • Google Chrome 89.0.4389.114
    ! Doctor found issues in 1 category.
  8. changed the title [-]the BackButton is not show[/-] [+]BackButton is not displayed when there is a endDrawer[/+] on Apr 13, 2021
  9. added
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on Apr 13, 2021
  10. chunhtai commented on Apr 13, 2021

    @chunhtai
    Contributor

    The check for !hasEndDrawer was introduced a while back #63272, it looks like a regression caused by the original fix
    cc @darrenaustin @gusghrlrl101

  11. 6 remaining items

  12. self-assigned this
    on Apr 8, 2022
  13. chunhtai commented on Apr 15, 2022

    @chunhtai
    Contributor

    internal tests relies on canPop to generate backbutton for testing purposes Needs to migrate internal test before reland the pr

  14. 944095635 commented on Mar 22, 2023

    @944095635

    Widget? leading; if (widget.automaticallyImplyLeading) { if (hasDrawer) { leading = IconButton( icon: const Icon(Icons.menu), iconSize: overallIconTheme.size ?? 24, onPressed: _handleDrawerButton, tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, ); // TODO(chunhtai): remove (!hasEndDrawer && canPop) once internal tests // are migrated. // https://github.com/flutter/flutter/issues/80256. } else if ((!hasEndDrawer && canPop) || (parentRoute?.impliesAppBarDismissal ?? false)) { if (useCloseButton) { leading = const CloseButton(); } else { leading = widget.leading != null ? widget.leading : const BackButton(); } } }

  15. github-actions commented on May 18, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c: regressionIt was better in the past than it is nowfound in release: 2.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packages

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions