-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.24Found to occur in 3.24Found to occur in 3.24frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Steps to reproduce
- Run the code sample, or any app with a WillPopScope that returns
falseon the home route, on Android. - Perform a system back (either swipe back or physical back button).
Expected results
WillPopScope.onWillPop is called and the back is unsuccessful because it returns false.
Actual results
WillPopScope.onWillPop is not called and the back succeeds in exiting the app.
This is caused by flutter/engine#52302.
Workaround
Upgrade to PopScope. Since WillPopScope is deprecated, fixing this is likely to be low priority.
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: WillPopScope(
onWillPop: () {
return Future.value(false);
},
child: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Press the system back button. The app should exit, but it dont.'),
],
),
),
),
);
}
}Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
[!] Flutter (Channel master, 3.24.0-1.0.pre.48, on macOS 14.5 23F79 darwin-arm64, locale en)
! Upstream repository [email protected]:justinmc/flutter.git is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to [email protected]:justinmc/flutter.git to dismiss this error.
[✓] 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 unknown)
✗ Unable to determine Android Studio version.
[✓] Android Studio (version 2023.2)
[✓] Connected device (3 available)
! Error: Browsing on the local area network for Bella’s iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
! Doctor found issues in 2 categories.b/344690680
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.24Found to occur in 3.24Found to occur in 3.24frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team