Dialogs. Cleanup request elevation dialog.
This commit is contained in:
parent
858cf2f5b5
commit
56540ec7b6
@ -674,100 +674,115 @@ void showRequestElevationDialog(String id, OverlayDialogManager dialogManager) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const minTextStyle = TextStyle(fontSize: 14);
|
// TODO get from theme
|
||||||
|
final double fontSizeNote = 13.00;
|
||||||
|
|
||||||
var content = Obx(() => Column(children: [
|
Widget OptionRequestPermissions = Obx(
|
||||||
Row(
|
() => Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Radio(
|
children: [
|
||||||
value: '',
|
Radio(
|
||||||
groupValue: groupValue.value,
|
visualDensity: VisualDensity(horizontal: -4, vertical: -4),
|
||||||
onChanged: onRadioChanged),
|
value: '',
|
||||||
Expanded(
|
groupValue: groupValue.value,
|
||||||
child:
|
onChanged: onRadioChanged,
|
||||||
Text(translate('Ask the remote user for authentication'))),
|
).marginOnly(right: 10),
|
||||||
],
|
Expanded(
|
||||||
),
|
child: Column(
|
||||||
Align(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
alignment: Alignment.centerLeft,
|
children: [
|
||||||
child: Text(
|
InkWell(
|
||||||
translate(
|
hoverColor: Colors.transparent,
|
||||||
'Choose this if the remote account is administrator'),
|
onTap: () => groupValue.value = '',
|
||||||
style: TextStyle(fontSize: 13))
|
|
||||||
.marginOnly(left: 40),
|
|
||||||
).marginOnly(bottom: 15),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Radio(
|
|
||||||
value: 'logon',
|
|
||||||
groupValue: groupValue.value,
|
|
||||||
onChanged: onRadioChanged),
|
|
||||||
Expanded(
|
|
||||||
child: Text(translate(
|
|
||||||
'Transmit the username and password of administrator')),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'${translate('Username')}:',
|
translate('Ask the remote user for authentication'),
|
||||||
style: minTextStyle,
|
),
|
||||||
).marginOnly(right: 10)),
|
).marginOnly(bottom: 10),
|
||||||
Expanded(
|
Text(
|
||||||
flex: 3,
|
translate('Choose this if the remote account is administrator'),
|
||||||
child: TextField(
|
style: TextStyle(fontSize: fontSizeNote),
|
||||||
controller: userController,
|
|
||||||
style: minTextStyle,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
isDense: true,
|
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 15),
|
|
||||||
hintText: translate('eg: admin'),
|
|
||||||
errorText: errUser.isEmpty ? null : errUser.value),
|
|
||||||
onChanged: (s) {
|
|
||||||
if (s.isNotEmpty) {
|
|
||||||
errUser.value = '';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
).marginOnly(left: 40),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Text(
|
|
||||||
'${translate('Password')}:',
|
|
||||||
style: minTextStyle,
|
|
||||||
).marginOnly(right: 10)),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: TextField(
|
|
||||||
controller: pwdController,
|
|
||||||
obscureText: true,
|
|
||||||
style: minTextStyle,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
isDense: true,
|
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 15),
|
|
||||||
errorText: errPwd.isEmpty ? null : errPwd.value),
|
|
||||||
onChanged: (s) {
|
|
||||||
if (s.isNotEmpty) {
|
|
||||||
errPwd.value = '';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
).marginOnly(top: 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget OptionCredentials = Obx(
|
||||||
|
() => Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Radio(
|
||||||
|
visualDensity: VisualDensity(horizontal: -4, vertical: -4),
|
||||||
|
value: 'logon',
|
||||||
|
groupValue: groupValue.value,
|
||||||
|
onChanged: onRadioChanged,
|
||||||
|
).marginOnly(right: 10),
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
hoverColor: Colors.transparent,
|
||||||
|
onTap: () => onRadioChanged('logon'),
|
||||||
|
child: Text(
|
||||||
|
translate('Transmit the username and password of administrator'),
|
||||||
),
|
),
|
||||||
],
|
).marginOnly(top: 4),
|
||||||
).marginOnly(left: 40),
|
),
|
||||||
Align(
|
],
|
||||||
alignment: Alignment.centerLeft,
|
),
|
||||||
child: Text(translate('still_click_uac_tip'),
|
);
|
||||||
style: TextStyle(fontSize: 13, fontWeight: FontWeight.bold))
|
|
||||||
.marginOnly(top: 20)),
|
Widget UacNote = Container(
|
||||||
]));
|
padding: EdgeInsets.fromLTRB(10, 8, 8, 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: MyTheme.currentThemeMode() == ThemeMode.dark
|
||||||
|
? Color.fromARGB(135, 87, 87, 90)
|
||||||
|
: Colors.grey[100],
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(color: Colors.grey),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.info_outline_rounded, size: 20).marginOnly(right: 10),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
translate('still_click_uac_tip'),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: fontSizeNote, fontWeight: FontWeight.normal),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
var content = Obx(
|
||||||
|
() => Column(
|
||||||
|
children: [
|
||||||
|
OptionRequestPermissions.marginOnly(bottom: 15),
|
||||||
|
OptionCredentials,
|
||||||
|
Offstage(
|
||||||
|
offstage: 'logon' != groupValue.value,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
UacNote.marginOnly(bottom: 10),
|
||||||
|
DialogTextField(
|
||||||
|
controller: userController,
|
||||||
|
title: translate('Username'),
|
||||||
|
hintText: translate('eg: admin'),
|
||||||
|
prefixIcon: DialogTextField.kUsernameIcon,
|
||||||
|
errorText: errUser.isEmpty ? null : errUser.value,
|
||||||
|
),
|
||||||
|
PasswordWidget(
|
||||||
|
controller: pwdController,
|
||||||
|
autoFocus: false,
|
||||||
|
errorText: errPwd.isEmpty ? null : errPwd.value,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).marginOnly(left: isDesktop ? 35 : 0),
|
||||||
|
).marginOnly(top: 10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
dialogManager.dismissAll();
|
dialogManager.dismissAll();
|
||||||
dialogManager.show(tag: '$id-request-elevation', (setState, close, context) {
|
dialogManager.show(tag: '$id-request-elevation', (setState, close, context) {
|
||||||
@ -794,8 +809,17 @@ void showRequestElevationDialog(String id, OverlayDialogManager dialogManager) {
|
|||||||
title: Text(translate('Request Elevation')),
|
title: Text(translate('Request Elevation')),
|
||||||
content: content,
|
content: content,
|
||||||
actions: [
|
actions: [
|
||||||
dialogButton('Cancel', onPressed: close, isOutline: true),
|
dialogButton(
|
||||||
dialogButton('OK', onPressed: submit),
|
'Cancel',
|
||||||
|
icon: Icon(Icons.close_rounded),
|
||||||
|
onPressed: close,
|
||||||
|
isOutline: true,
|
||||||
|
),
|
||||||
|
dialogButton(
|
||||||
|
'OK',
|
||||||
|
icon: Icon(Icons.done_rounded),
|
||||||
|
onPressed: submit,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
onSubmit: submit,
|
onSubmit: submit,
|
||||||
onCancel: close,
|
onCancel: close,
|
||||||
@ -878,8 +902,8 @@ void showWaitAcceptDialog(String id, String type, String title, String text,
|
|||||||
|
|
||||||
void showRestartRemoteDevice(
|
void showRestartRemoteDevice(
|
||||||
PeerInfo pi, String id, OverlayDialogManager dialogManager) async {
|
PeerInfo pi, String id, OverlayDialogManager dialogManager) async {
|
||||||
final res =
|
final res = await dialogManager
|
||||||
await dialogManager.show<bool>((setState, close, context) => CustomAlertDialog(
|
.show<bool>((setState, close, context) => CustomAlertDialog(
|
||||||
title: Row(children: [
|
title: Row(children: [
|
||||||
Icon(Icons.warning_rounded, color: Colors.redAccent, size: 28),
|
Icon(Icons.warning_rounded, color: Colors.redAccent, size: 28),
|
||||||
Flexible(
|
Flexible(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user