mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 23:19:02 +08:00
fix on login and config
This commit is contained in:
parent
52139dc84b
commit
0ba74ef7ec
@ -165,6 +165,7 @@ class Peer {
|
||||
|
||||
// https://github.com/huangjianke/flutter_easyloading
|
||||
void showLoading(String text) {
|
||||
dismissLoading();
|
||||
EasyLoading.show(status: text);
|
||||
}
|
||||
|
||||
@ -173,17 +174,24 @@ void dismissLoading() {
|
||||
}
|
||||
|
||||
void showSuccess(String text) {
|
||||
dismissLoading();
|
||||
EasyLoading.showSuccess(text);
|
||||
}
|
||||
|
||||
bool _hasDialog = false;
|
||||
|
||||
// https://material.io/develop/flutter/components/dialogs
|
||||
void enterPasswordDialog(String id, BuildContext context) {
|
||||
Future<Null> enterPasswordDialog(String id, BuildContext context) async {
|
||||
dismissLoading();
|
||||
if (_hasDialog) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
_hasDialog = true;
|
||||
final controller = TextEditingController();
|
||||
var remember = FFI.getByName('remember', arg: id) == 'true';
|
||||
var dialog = AlertDialog(
|
||||
title: Text('Please enter your password'),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding: const EdgeInsets.all(20.0),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@ -230,19 +238,30 @@ void enterPasswordDialog(String id, BuildContext context) {
|
||||
),
|
||||
],
|
||||
);
|
||||
showDialog<void>(context: context, builder: (context) => dialog);
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => dialog);
|
||||
_hasDialog = false;
|
||||
}
|
||||
|
||||
void wrongPasswordDialog(String id, BuildContext context) {
|
||||
Future<Null> wrongPasswordDialog(String id, BuildContext context) async {
|
||||
dismissLoading();
|
||||
if (_hasDialog) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
_hasDialog = true;
|
||||
var dialog = AlertDialog(
|
||||
title: Text('Wrong Password'),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding: const EdgeInsets.all(20.0),
|
||||
content: Text('Do you want to enter again?'),
|
||||
actions: [
|
||||
FlatButton(
|
||||
textColor: MyTheme.accent,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('Cancel'),
|
||||
),
|
||||
FlatButton(
|
||||
@ -255,14 +274,23 @@ void wrongPasswordDialog(String id, BuildContext context) {
|
||||
),
|
||||
],
|
||||
);
|
||||
showDialog<void>(context: context, builder: (context) => dialog);
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => dialog);
|
||||
_hasDialog = false;
|
||||
}
|
||||
|
||||
void msgbox(String type, String title, String text, BuildContext context) {
|
||||
Future<Null> msgbox(
|
||||
String type, String title, String text, BuildContext context) async {
|
||||
dismissLoading();
|
||||
if (_hasDialog) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
_hasDialog = true;
|
||||
var dialog = AlertDialog(
|
||||
title: Text(title),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding: const EdgeInsets.all(20.0),
|
||||
content: Text(text),
|
||||
actions: [
|
||||
FlatButton(
|
||||
@ -275,5 +303,9 @@ void msgbox(String type, String title, String text, BuildContext context) {
|
||||
),
|
||||
],
|
||||
);
|
||||
showDialog<void>(context: context, builder: (context) => dialog);
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => dialog);
|
||||
_hasDialog = false;
|
||||
}
|
||||
|
@ -15,15 +15,10 @@ class HomePage extends StatefulWidget {
|
||||
class _HomePageState extends State<HomePage> {
|
||||
final _idController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_idController.text = FFI.getId();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Provider.of<FfiModel>(context);
|
||||
if (_idController.text.isEmpty) _idController.text = FFI.getId();
|
||||
// This method is rerun every time setState is called
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
Loading…
Reference in New Issue
Block a user