我知道對于后退按鈕,我們可以使用 來完成willpopscope,但現在我正試圖阻止用戶重繪 頁面,有沒有辦法禁用重繪 按鈕或在用戶單擊重繪 按鈕時提示訊息?
willpopscope 示例
return WillPopScope (
onWillPop: () async {
return shouldPop;
},
child: const Text('WillPopScope sample'),
);
uj5u.com熱心網友回復:
添加這個lib/web/index.html將顯示一個確認對話框:
...
<body>
<script type="text/javascript">
window.onbeforeunload = function() {
return "Changes that you made may not be saved.";
}
</script>
...
</body>
...
像這樣:

轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/420290.html
標籤:
