new msgbox to avoid crash
This commit is contained in:
parent
d89ad33b98
commit
0797334e35
@ -64,33 +64,52 @@ Future<T> showAlertDialog<T>(BuildContext context, BuildAlertDailog build,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<T> msgbox<T>(
|
void msgbox(String type, String title, String text, BuildContext context,
|
||||||
String type, String title, String text, BuildContext context,
|
[bool hasCancel]) {
|
||||||
[bool hasCancel]) async {
|
var wrap = (String text, void Function() onPressed) => ButtonTheme(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||||
|
materialTapTargetSize: MaterialTapTargetSize
|
||||||
|
.shrinkWrap, //limits the touch area to the button area
|
||||||
|
minWidth: 0, //wraps child's width
|
||||||
|
height: 0,
|
||||||
|
child: FlatButton(
|
||||||
|
focusColor: MyTheme.accent,
|
||||||
|
onPressed: onPressed,
|
||||||
|
child: Text(text, style: TextStyle(color: MyTheme.accent))));
|
||||||
|
|
||||||
|
dismissLoading();
|
||||||
|
if (_hasDialog) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
final buttons = [
|
||||||
|
Expanded(child: Container()),
|
||||||
|
wrap('OK', () {
|
||||||
|
dismissLoading();
|
||||||
|
Navigator.pop(context);
|
||||||
|
})
|
||||||
|
];
|
||||||
if (hasCancel == null) {
|
if (hasCancel == null) {
|
||||||
hasCancel = type != 'error';
|
hasCancel = type != 'error';
|
||||||
}
|
}
|
||||||
return await showAlertDialog<T>(
|
if (hasCancel) {
|
||||||
context,
|
buttons.insert(
|
||||||
(_) => Tuple3(Text(title), Text(text), [
|
1,
|
||||||
hasCancel
|
wrap('Cancel', () {
|
||||||
? FlatButton(
|
dismissLoading();
|
||||||
textColor: MyTheme.accent,
|
}));
|
||||||
onPressed: () {
|
}
|
||||||
Navigator.pop(context);
|
EasyLoading.showWidget(Column(
|
||||||
},
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Text('Cancel'),
|
children: [
|
||||||
)
|
Text(title, style: TextStyle(fontSize: 21)),
|
||||||
: Spacer(),
|
SizedBox(height: 20),
|
||||||
FlatButton(
|
Text(text, style: TextStyle(fontSize: 15)),
|
||||||
textColor: MyTheme.accent,
|
SizedBox(height: 20),
|
||||||
onPressed: () {
|
Row(
|
||||||
Navigator.pop(context);
|
children: buttons,
|
||||||
Navigator.pop(context);
|
)
|
||||||
},
|
],
|
||||||
child: Text('OK'),
|
));
|
||||||
),
|
|
||||||
]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PasswordWidget extends StatefulWidget {
|
class PasswordWidget extends StatefulWidget {
|
||||||
|
@ -99,8 +99,8 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> showMsgBox(String type, String title, String text) async {
|
void showMsgBox(String type, String title, String text) {
|
||||||
await msgbox(type, title, text, context);
|
msgbox(type, title, text, context);
|
||||||
final hasRetry = type == "error" &&
|
final hasRetry = type == "error" &&
|
||||||
title == "Connection Error" &&
|
title == "Connection Error" &&
|
||||||
text.toLowerCase().indexOf("offline") < 0 &&
|
text.toLowerCase().indexOf("offline") < 0 &&
|
||||||
@ -179,7 +179,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() => _showBar = !_showBar);
|
setState(() => _showBar = !_showBar);
|
||||||
}),
|
}),
|
||||||
bottomNavigationBar: _showBar
|
bottomNavigationBar: _showBar && FFI.ffiModel.pi.displays != null
|
||||||
? BottomAppBar(
|
? BottomAppBar(
|
||||||
elevation: 10,
|
elevation: 10,
|
||||||
color: MyTheme.accent,
|
color: MyTheme.accent,
|
||||||
|
@ -43,20 +43,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0-nullsafety.3"
|
version: "1.15.0-nullsafety.3"
|
||||||
convert:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: convert
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.1.1"
|
|
||||||
crypto:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: crypto
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.1.5"
|
|
||||||
csslib:
|
csslib:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -114,31 +100,12 @@ packages:
|
|||||||
flutter_easyloading:
|
flutter_easyloading:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_easyloading
|
path: "."
|
||||||
url: "https://pub.dartlang.org"
|
ref: HEAD
|
||||||
source: hosted
|
resolved-ref: "2d085c411dc262043b6173c3b962d3e66ce657b1"
|
||||||
|
url: "git://github.com/open-trade/flutter_easyloading"
|
||||||
|
source: git
|
||||||
version: "2.2.0"
|
version: "2.2.0"
|
||||||
flutter_sound:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_sound
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "6.4.2+1"
|
|
||||||
flutter_sound_platform_interface:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: flutter_sound_platform_interface
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "6.4.2+1"
|
|
||||||
flutter_sound_web:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: flutter_sound_web
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "6.4.2+1"
|
|
||||||
flutter_spinkit:
|
flutter_spinkit:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -184,13 +151,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.2"
|
version: "0.6.2"
|
||||||
logger:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: logger
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.7.0+2"
|
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -289,13 +249,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.5"
|
version: "2.1.5"
|
||||||
recase:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: recase
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "3.0.1"
|
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -329,13 +282,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0-nullsafety.1"
|
version: "1.1.0-nullsafety.1"
|
||||||
synchronized:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: synchronized
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.2.0+2"
|
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -364,13 +310,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0-nullsafety.3"
|
version: "1.3.0-nullsafety.3"
|
||||||
uuid:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: uuid
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.2.2"
|
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -31,7 +31,10 @@ dependencies:
|
|||||||
ffi: ^0.1.3
|
ffi: ^0.1.3
|
||||||
path_provider: ^1.6.24
|
path_provider: ^1.6.24
|
||||||
provider: ^4.3.2+2
|
provider: ^4.3.2+2
|
||||||
flutter_easyloading: ^2.1.3
|
flutter_easyloading:
|
||||||
|
git:
|
||||||
|
url: git://github.com/open-trade/flutter_easyloading
|
||||||
|
#path: flutter_easyloading
|
||||||
tuple: ^1.0.1
|
tuple: ^1.0.1
|
||||||
wakelock: ^0.2.1+1
|
wakelock: ^0.2.1+1
|
||||||
device_info: ^1.0.0
|
device_info: ^1.0.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user