mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
add local/remote file manager
This commit is contained in:
77
lib/widgets/dialog.dart
Normal file
77
lib/widgets/dialog.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import '../common.dart';
|
||||
import '../models/model.dart';
|
||||
|
||||
void clientClose() {
|
||||
msgBox('', 'Close', 'Are you sure to close the connection?');
|
||||
}
|
||||
|
||||
void enterPasswordDialog(String id) {
|
||||
final controller = TextEditingController();
|
||||
var remember = FFI.getByName('remember', id) == 'true';
|
||||
if (globalKey.currentContext == null) return;
|
||||
showAlertDialog((setState) => Tuple3(
|
||||
Text(translate('Password Required')),
|
||||
Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
PasswordWidget(controller: controller),
|
||||
CheckboxListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
title: Text(
|
||||
translate('Remember password'),
|
||||
),
|
||||
value: remember,
|
||||
onChanged: (v) {
|
||||
if (v != null) {
|
||||
setState(() => remember = v);
|
||||
}
|
||||
},
|
||||
),
|
||||
]),
|
||||
[
|
||||
TextButton(
|
||||
style: flatButtonStyle,
|
||||
onPressed: () {
|
||||
DialogManager.reset();
|
||||
Navigator.pop(globalKey.currentContext!);
|
||||
},
|
||||
child: Text(translate('Cancel')),
|
||||
),
|
||||
TextButton(
|
||||
style: flatButtonStyle,
|
||||
onPressed: () {
|
||||
var text = controller.text.trim();
|
||||
if (text == '') return;
|
||||
FFI.login(text, remember);
|
||||
DialogManager.reset();
|
||||
showLoading(translate('Logging in...'));
|
||||
},
|
||||
child: Text(translate('OK')),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
void wrongPasswordDialog(String id) {
|
||||
if (globalKey.currentContext == null) return;
|
||||
showAlertDialog((_) => Tuple3(Text(translate('Wrong Password')),
|
||||
Text(translate('Do you want to enter again?')), [
|
||||
TextButton(
|
||||
style: flatButtonStyle,
|
||||
onPressed: () {
|
||||
DialogManager.reset();
|
||||
Navigator.pop(globalKey.currentContext!);
|
||||
},
|
||||
child: Text(translate('Cancel')),
|
||||
),
|
||||
TextButton(
|
||||
style: flatButtonStyle,
|
||||
onPressed: () {
|
||||
enterPasswordDialog(id);
|
||||
},
|
||||
child: Text(translate('Retry')),
|
||||
),
|
||||
]));
|
||||
}
|
||||
Reference in New Issue
Block a user