将小部件包装在其中,
WillPopScope并
Future在
onWillPop属性中返回false
@override Widget build(BuildContext context) { return WillPopScope( onWillPop: () => Future.value(false), child: Scaffold( appBar: AppBar( title: const Text("Home Page"), ), body: Center( child: const Text("Home Page"), ), ), ); }请参阅此文档:https : //api.flutter.dev/flutter/widgets/WillPopScope-
class.html



