skip return key of dialog

This commit is contained in:
open-trade 2020-11-20 00:29:59 +08:00
parent 0b0fb4f145
commit e516dd3267
2 changed files with 13 additions and 11 deletions

View File

@ -53,12 +53,14 @@ Future<Null> showAlertDialog(
_hasDialog = true; _hasDialog = true;
var dialog = StatefulBuilder(builder: (context, setState) { var dialog = StatefulBuilder(builder: (context, setState) {
var widgets = build(setState); var widgets = build(setState);
return AlertDialog( return WillPopScope(
onWillPop: () async => false,
child: AlertDialog(
title: widgets.item1, title: widgets.item1,
contentPadding: const EdgeInsets.all(20.0), contentPadding: const EdgeInsets.all(20.0),
content: widgets.item2, content: widgets.item2,
actions: widgets.item3, actions: widgets.item3,
); ));
}); });
await showDialog<void>( await showDialog<void>(
context: context, context: context,

View File

@ -21,7 +21,7 @@ class RemotePage extends StatefulWidget {
// https://github.com/hanxu317317/flutter_plan_demo/blob/master/lib/src/enter.dart // https://github.com/hanxu317317/flutter_plan_demo/blob/master/lib/src/enter.dart
class _RemotePageState extends State<RemotePage> { class _RemotePageState extends State<RemotePage> {
Timer _interval; Timer _interval;
bool _show_bar = true; bool _showBar = true;
@override @override
void initState() { void initState() {
@ -68,16 +68,16 @@ class _RemotePageState extends State<RemotePage> {
// MediaQuery.of(context).size.height; // MediaQuery.of(context).size.height;
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light; EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
return Scaffold( return Scaffold(
floatingActionButton: _show_bar floatingActionButton: _showBar
? null ? null
: FloatingActionButton( : FloatingActionButton(
mini: true, mini: true,
child: Icon(Icons.expand_less), child: Icon(Icons.expand_less),
backgroundColor: MyTheme.accent50, backgroundColor: MyTheme.accent50,
onPressed: () { onPressed: () {
setState(() => _show_bar = !_show_bar); setState(() => _showBar = !_showBar);
}), }),
bottomNavigationBar: _show_bar bottomNavigationBar: _showBar
? BottomAppBar( ? BottomAppBar(
color: MyTheme.accent, color: MyTheme.accent,
child: Row( child: Row(
@ -117,7 +117,7 @@ class _RemotePageState extends State<RemotePage> {
color: Colors.white, color: Colors.white,
icon: Icon(Icons.expand_more), icon: Icon(Icons.expand_more),
onPressed: () { onPressed: () {
setState(() => _show_bar = !_show_bar); setState(() => _showBar = !_showBar);
}), }),
], ],
), ),