包裹一层willpopscope
WebViewController webViewController;
WillPopScope(
onWillPop: () async {
Future<bool> canGoBack = webViewController!.canGoBack();
canGoBack.then((value) {
if (value) {
webViewController!.goBack();
} else {
Get.back();
}
});
return false;
},
child: Widget()
评论