Repository: flutter
Issue: pushNamedAndRemoveUntil doesn't reach route under drawer
Labels: framework,f: material design,f: routes,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-design,triaged-design

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill our the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- You must include full steps to reproduce so that we can reproduce the problem. -->

lib/main.dart
```dart
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',
      home: MyHomePage(title: 'Flutter Demo Home Page'),
      routes: {
        'front': (_) => MyHomePage(),
        'apage': (_) => APage(),
        'bpage': (_) => BPage(),
      },
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: Drawer(
        child: ListView(
          children: <Widget>[
            DrawerHeader(
              child: Text('Drawer Header'),
            ),
            ListTile(
              title: Text('go to apage'),
              onTap: () {
                Navigator.of(context).pushNamed('apage');
              },
            ),
          ],
        ),
      ),
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child:
            Text(
              'home',
            ),
        ),
      );
  }
}

class APage extends StatefulWidget {
  APage();

  @override
  _APageState createState() => _APageState();
}

class _APageState extends State<APage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('APage')),
        body: Center(
            child: FlatButton(
                onPressed: () {
                  Navigator.of(context).pushNamedAndRemoveUntil(
                      'bpage', ModalRoute.withName('front'));
                },
                child: Text('Press to go bpage and remove apage.'))));
  }
}

class BPage extends StatefulWidget {
  BPage();

  @override
  _BPageState createState() => _BPageState();
}

class _BPageState extends State<BPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('BPage')), body: Center(child: Text('abc')));
  }
}
```
**reproduce step

  1. click to open the drawer.
  2. click the item to go to apage.
  3. click the flatbutton to  `pushNamedAndRemoveUntil('bpage', ModalRoute.withName('front'));`

**Expected results:** <!-- what did you want to see? -->
 There should be  a back button at top left in b page. 
**Actual results:** <!-- what did you see? -->
 The front page was removed, so there is no back button.

I find that when the drawer is open, the front route's `willHandlePopInternally` is true, so the code below
[code](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/routes.dart#L883~L885) will return false, so the front route will be pop.  
```dart
  /// Returns a predicate that's true if the route has the specified name and if
  /// popping the route will not yield the same route, i.e. if the route's
  /// [willHandlePopInternally] property is false.
  ///
  /// This function is typically used with [Navigator.popUntil()].
  static RoutePredicate withName(String name) {
    return (Route<dynamic> route) {
      return !route.willHandlePopInternally
          && route is ModalRoute
          && route.settings.name == name;
    };
  }
```
I know that i can use change the drawer button action like this to avoid this, but i think it's wried...
```dart
ListTile(
              title: Text('go to apage'),
              onTap: () {
                Navigator.of(context).pop(); //add this to pop drawer first.
                Navigator.of(context).pushNamed('apage');
              },
```

so should we change the statement sequence ?  judge the route name first ?   
I'm not sure will it affect other features like some route has localhistory..
```
  return route.settings.name == name
          && !route.willHandlePopInternally
          && route is ModalRoute;
```
<details>
  <summary>Logs</summary>



```
 flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76,
    locale zh-Hans-CN)
    • Flutter version 1.12.13+hotfix.8 at /Users/wdjwxh/code/flutter
    • Framework revision 0b8abb4724 (2 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/wdjwxh/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.9.0

[!] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.42.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.8.1

[✓] Connected device (1 available)
    • iPhone 11 Pro • 12819EA7-67B2-4541-B697-7EF1A7640A04 • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

! Doctor found issues in 1 category.
```

</details>