WillPopScope
WillPopScope it is used to intervene with the back button
return MaterialApp(
home: Builder(
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () async {
bool result = await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("title"),
content: Text("message"),
);
},
);
return false;
},
child: Scaffold(
backgroundColor: Color.fromARGB(255, 16, 15, 22),
body: /* Body of the screen */
),
);
},
),
);Last updated