added icon to dialogButton, reverted some design changes. The outline buttons now rely on theme data
This commit is contained in:
parent
18339cf343
commit
fd8829f08e
@ -224,7 +224,20 @@ class MyTheme {
|
|||||||
),
|
),
|
||||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(18.0),
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStateProperty.all(
|
||||||
|
Color(0xFFEEEEEE),
|
||||||
|
),
|
||||||
|
foregroundColor: MaterialStateProperty.all(Colors.black87),
|
||||||
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -296,9 +309,6 @@ class MyTheme {
|
|||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
splashFactory: isDesktop ? NoSplash.splashFactory : null,
|
splashFactory: isDesktop ? NoSplash.splashFactory : null,
|
||||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
|
||||||
style:
|
|
||||||
OutlinedButton.styleFrom(side: BorderSide(color: Colors.white38))),
|
|
||||||
textButtonTheme: isDesktop
|
textButtonTheme: isDesktop
|
||||||
? TextButtonThemeData(
|
? TextButtonThemeData(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
@ -318,7 +328,23 @@ class MyTheme {
|
|||||||
),
|
),
|
||||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(18.0),
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStatePropertyAll(
|
||||||
|
Color(0xFF24252B),
|
||||||
|
),
|
||||||
|
side: MaterialStatePropertyAll(
|
||||||
|
BorderSide(color: Colors.white12, width: 0.5),
|
||||||
|
),
|
||||||
|
foregroundColor: MaterialStateProperty.all(Colors.white70),
|
||||||
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1824,28 +1850,43 @@ class ServerConfig {
|
|||||||
Widget dialogButton(String text,
|
Widget dialogButton(String text,
|
||||||
{required VoidCallback? onPressed,
|
{required VoidCallback? onPressed,
|
||||||
bool isOutline = false,
|
bool isOutline = false,
|
||||||
|
Widget? icon,
|
||||||
TextStyle? style,
|
TextStyle? style,
|
||||||
ButtonStyle? buttonStyle}) {
|
ButtonStyle? buttonStyle}) {
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
if (isOutline) {
|
if (isOutline) {
|
||||||
return OutlinedButton(
|
return icon == null
|
||||||
onPressed: onPressed,
|
? OutlinedButton(
|
||||||
child: Text(translate(text), style: style),
|
onPressed: onPressed,
|
||||||
);
|
child: Text(translate(text), style: style),
|
||||||
|
)
|
||||||
|
: OutlinedButton.icon(
|
||||||
|
icon: icon,
|
||||||
|
onPressed: onPressed,
|
||||||
|
label: Text(translate(text), style: style),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return ElevatedButton(
|
return icon == null
|
||||||
style: ElevatedButton.styleFrom(elevation: 0).merge(buttonStyle),
|
? ElevatedButton(
|
||||||
onPressed: onPressed,
|
style: ElevatedButton.styleFrom(elevation: 0).merge(buttonStyle),
|
||||||
child: Text(translate(text), style: style),
|
onPressed: onPressed,
|
||||||
);
|
child: Text(translate(text), style: style),
|
||||||
|
)
|
||||||
|
: ElevatedButton.icon(
|
||||||
|
icon: icon,
|
||||||
|
style: ElevatedButton.styleFrom(elevation: 0).merge(buttonStyle),
|
||||||
|
onPressed: onPressed,
|
||||||
|
label: Text(translate(text), style: style),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
child: Text(
|
child: Text(
|
||||||
translate(text),
|
translate(text),
|
||||||
style: style,
|
style: style,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -683,23 +683,21 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
Obx(() => Offstage(
|
Obx(() => Offstage(
|
||||||
offstage: isInProgress.isFalse,
|
offstage: isInProgress.isFalse,
|
||||||
child: const LinearProgressIndicator())),
|
child: const LinearProgressIndicator())),
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.close_rounded),
|
|
||||||
label: Text(translate("Cancel")),
|
|
||||||
onPressed: close,
|
|
||||||
),
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.done_rounded),
|
|
||||||
label: Text(translate("Ok")),
|
|
||||||
onPressed: submit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).paddingOnly(top: 20)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
actions: [
|
||||||
|
dialogButton(
|
||||||
|
"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,
|
||||||
);
|
);
|
||||||
@ -740,26 +738,20 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
content: Column(
|
content: SizedBox.shrink(),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
actions: [
|
||||||
children: [
|
dialogButton(
|
||||||
Row(
|
"Cancel",
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
icon: Icon(Icons.close_rounded),
|
||||||
children: [
|
onPressed: close,
|
||||||
ElevatedButton.icon(
|
isOutline: true,
|
||||||
icon: Icon(Icons.close_rounded),
|
),
|
||||||
label: Text(translate("Cancel")),
|
dialogButton(
|
||||||
onPressed: close,
|
"OK",
|
||||||
),
|
icon: Icon(Icons.done_rounded),
|
||||||
ElevatedButton.icon(
|
onPressed: submit,
|
||||||
icon: Icon(Icons.done_rounded),
|
),
|
||||||
label: Text(translate("Ok")),
|
],
|
||||||
onPressed: submit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).paddingOnly(top: 20)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onSubmit: submit,
|
onSubmit: submit,
|
||||||
onCancel: close,
|
onCancel: close,
|
||||||
);
|
);
|
||||||
|
@ -989,37 +989,30 @@ class _FileManagerPageState extends State<FileManagerPage>
|
|||||||
content: Column(
|
content: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
TextFormField(
|
||||||
children: [
|
decoration: InputDecoration(
|
||||||
TextFormField(
|
labelText: translate(
|
||||||
decoration: InputDecoration(
|
"Please enter the folder name",
|
||||||
labelText: translate(
|
|
||||||
"Please enter the folder name",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
controller: name,
|
|
||||||
autofocus: true,
|
|
||||||
),
|
),
|
||||||
Row(
|
),
|
||||||
mainAxisAlignment:
|
controller: name,
|
||||||
MainAxisAlignment.spaceBetween,
|
autofocus: true,
|
||||||
children: [
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.close_rounded),
|
|
||||||
label: Text(translate("Cancel")),
|
|
||||||
onPressed: cancel,
|
|
||||||
),
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.done_rounded),
|
|
||||||
label: Text(translate("Ok")),
|
|
||||||
onPressed: submit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).paddingOnly(top: 20)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
actions: [
|
||||||
|
dialogButton(
|
||||||
|
"Cancel",
|
||||||
|
icon: Icon(Icons.close_rounded),
|
||||||
|
onPressed: cancel,
|
||||||
|
isOutline: true,
|
||||||
|
),
|
||||||
|
dialogButton(
|
||||||
|
"Ok",
|
||||||
|
icon: Icon(Icons.done_rounded),
|
||||||
|
onPressed: submit,
|
||||||
|
),
|
||||||
|
],
|
||||||
onSubmit: submit,
|
onSubmit: submit,
|
||||||
onCancel: cancel,
|
onCancel: cancel,
|
||||||
);
|
);
|
||||||
|
@ -28,27 +28,21 @@ void showRestartRemoteDevice(
|
|||||||
Icon(Icons.warning_rounded, color: Colors.redAccent, size: 28),
|
Icon(Icons.warning_rounded, color: Colors.redAccent, size: 28),
|
||||||
Text(translate("Restart Remote Device")).paddingOnly(left: 10),
|
Text(translate("Restart Remote Device")).paddingOnly(left: 10),
|
||||||
]),
|
]),
|
||||||
content: Column(
|
content: Text(
|
||||||
children: [
|
"${translate('Are you sure you want to restart')} \n${pi.username}@${pi.hostname}($id) ?"),
|
||||||
Text(
|
actions: [
|
||||||
"${translate('Are you sure you want to restart')} \n${pi.username}@${pi.hostname}($id) ?"),
|
dialogButton(
|
||||||
Row(
|
"Cancel",
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
icon: Icon(Icons.close_rounded),
|
||||||
children: [
|
onPressed: close,
|
||||||
ElevatedButton.icon(
|
isOutline: true,
|
||||||
icon: Icon(Icons.close_rounded),
|
),
|
||||||
label: Text(translate("Cancel")),
|
dialogButton(
|
||||||
onPressed: close,
|
"OK",
|
||||||
),
|
icon: Icon(Icons.done_rounded),
|
||||||
ElevatedButton.icon(
|
onPressed: () => close(true),
|
||||||
icon: Icon(Icons.done_rounded),
|
),
|
||||||
label: Text(translate("Ok")),
|
],
|
||||||
onPressed: () => close(true),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).paddingOnly(top: 20)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onCancel: close,
|
onCancel: close,
|
||||||
onSubmit: () => close(true),
|
onSubmit: () => close(true),
|
||||||
));
|
));
|
||||||
@ -82,76 +76,65 @@ void setPermanentPasswordDialog(OverlayDialogManager dialogManager) async {
|
|||||||
Text(translate('Set your own password')).paddingOnly(left: 10),
|
Text(translate('Set your own password')).paddingOnly(left: 10),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
content: Column(
|
content: Form(
|
||||||
children: [
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
Form(
|
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
TextFormField(
|
||||||
child: Column(
|
autofocus: true,
|
||||||
mainAxisSize: MainAxisSize.min,
|
obscureText: true,
|
||||||
children: [
|
keyboardType: TextInputType.visiblePassword,
|
||||||
TextFormField(
|
decoration: InputDecoration(
|
||||||
autofocus: true,
|
labelText: translate('Password'),
|
||||||
obscureText: true,
|
),
|
||||||
keyboardType: TextInputType.visiblePassword,
|
controller: p0,
|
||||||
decoration: InputDecoration(
|
validator: (v) {
|
||||||
labelText: translate('Password'),
|
if (v == null) return null;
|
||||||
),
|
final val = v.trim().length > 5;
|
||||||
controller: p0,
|
if (validateLength != val) {
|
||||||
validator: (v) {
|
// use delay to make setState success
|
||||||
if (v == null) return null;
|
Future.delayed(Duration(microseconds: 1),
|
||||||
final val = v.trim().length > 5;
|
() => setState(() => validateLength = val));
|
||||||
if (validateLength != val) {
|
}
|
||||||
// use delay to make setState success
|
return val
|
||||||
Future.delayed(Duration(microseconds: 1),
|
? null
|
||||||
() => setState(() => validateLength = val));
|
: translate('Too short, at least 6 characters.');
|
||||||
}
|
},
|
||||||
return val
|
|
||||||
? null
|
|
||||||
: translate('Too short, at least 6 characters.');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
obscureText: true,
|
|
||||||
keyboardType: TextInputType.visiblePassword,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: translate('Confirmation'),
|
|
||||||
),
|
|
||||||
controller: p1,
|
|
||||||
validator: (v) {
|
|
||||||
if (v == null) return null;
|
|
||||||
final val = p0.text == v;
|
|
||||||
if (validateSame != val) {
|
|
||||||
Future.delayed(Duration(microseconds: 1),
|
|
||||||
() => setState(() => validateSame = val));
|
|
||||||
}
|
|
||||||
return val
|
|
||||||
? null
|
|
||||||
: translate('The confirmation is not identical.');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.close_rounded),
|
|
||||||
label: Text(translate("Cancel")),
|
|
||||||
onPressed: close,
|
|
||||||
),
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.done_rounded),
|
|
||||||
label: Text(translate("Ok")),
|
|
||||||
onPressed:
|
|
||||||
(validateLength && validateSame) ? submit : null,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).paddingOnly(top: 20)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
TextFormField(
|
||||||
],
|
obscureText: true,
|
||||||
),
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: translate('Confirmation'),
|
||||||
|
),
|
||||||
|
controller: p1,
|
||||||
|
validator: (v) {
|
||||||
|
if (v == null) return null;
|
||||||
|
final val = p0.text == v;
|
||||||
|
if (validateSame != val) {
|
||||||
|
Future.delayed(Duration(microseconds: 1),
|
||||||
|
() => setState(() => validateSame = val));
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
? null
|
||||||
|
: translate('The confirmation is not identical.');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
])),
|
||||||
onCancel: close,
|
onCancel: close,
|
||||||
onSubmit: (validateLength && validateSame) ? submit : null,
|
onSubmit: (validateLength && validateSame) ? submit : null,
|
||||||
|
actions: [
|
||||||
|
dialogButton(
|
||||||
|
'Cancel',
|
||||||
|
icon: Icon(Icons.close_rounded),
|
||||||
|
onPressed: close,
|
||||||
|
isOutline: true,
|
||||||
|
),
|
||||||
|
dialogButton(
|
||||||
|
'OK',
|
||||||
|
icon: Icon(Icons.done_rounded),
|
||||||
|
onPressed: (validateLength && validateSame) ? submit : null,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -233,22 +216,20 @@ void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.close_rounded),
|
|
||||||
label: Text(translate("Cancel")),
|
|
||||||
onPressed: close,
|
|
||||||
),
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.done_rounded),
|
|
||||||
label: Text(translate("Ok")),
|
|
||||||
onPressed: submit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).paddingOnly(top: 20)
|
|
||||||
]),
|
]),
|
||||||
|
actions: [
|
||||||
|
dialogButton(
|
||||||
|
'Cancel',
|
||||||
|
icon: Icon(Icons.close_rounded),
|
||||||
|
onPressed: cancel,
|
||||||
|
isOutline: true,
|
||||||
|
),
|
||||||
|
dialogButton(
|
||||||
|
'OK',
|
||||||
|
icon: Icon(Icons.done_rounded),
|
||||||
|
onPressed: submit,
|
||||||
|
),
|
||||||
|
],
|
||||||
onSubmit: submit,
|
onSubmit: submit,
|
||||||
onCancel: cancel,
|
onCancel: cancel,
|
||||||
);
|
);
|
||||||
|
@ -595,9 +595,10 @@ class FileModel extends ChangeNotifier {
|
|||||||
final count = entries.length > 1 ? "${i + 1}/${entries.length}" : "";
|
final count = entries.length > 1 ? "${i + 1}/${entries.length}" : "";
|
||||||
content = "$dirShow\n\n${entries[i].path}".trim();
|
content = "$dirShow\n\n${entries[i].path}".trim();
|
||||||
final confirm = await showRemoveDialog(
|
final confirm = await showRemoveDialog(
|
||||||
count.isEmpty ? title : "$title ($count)",
|
count.isEmpty ? title : "$title ($count)",
|
||||||
content,
|
content,
|
||||||
item.isDirectory);
|
item.isDirectory,
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
if (confirm == true) {
|
if (confirm == true) {
|
||||||
sendRemoveFile(entries[i].path, i, items.isLocal!);
|
sendRemoveFile(entries[i].path, i, items.isLocal!);
|
||||||
@ -647,7 +648,7 @@ class FileModel extends ChangeNotifier {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
contentBoxConstraints:
|
contentBoxConstraints:
|
||||||
BoxConstraints(minHeight: 80, minWidth: 400, maxWidth: 400),
|
BoxConstraints(minHeight: 100, minWidth: 400, maxWidth: 400),
|
||||||
content: Column(
|
content: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -673,24 +674,22 @@ class FileModel extends ChangeNotifier {
|
|||||||
setState(() => removeCheckboxRemember = v);
|
setState(() => removeCheckboxRemember = v);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink()
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.close_rounded),
|
|
||||||
label: Text(translate("Cancel")),
|
|
||||||
onPressed: cancel,
|
|
||||||
),
|
|
||||||
ElevatedButton.icon(
|
|
||||||
icon: Icon(Icons.done_rounded),
|
|
||||||
label: Text(translate("Ok")),
|
|
||||||
onPressed: submit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).paddingOnly(top: 20)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
actions: [
|
||||||
|
dialogButton(
|
||||||
|
"Cancel",
|
||||||
|
icon: Icon(Icons.close_rounded),
|
||||||
|
onPressed: cancel,
|
||||||
|
isOutline: true,
|
||||||
|
),
|
||||||
|
dialogButton(
|
||||||
|
"OK",
|
||||||
|
icon: Icon(Icons.done_rounded),
|
||||||
|
onPressed: submit,
|
||||||
|
),
|
||||||
|
],
|
||||||
onSubmit: submit,
|
onSubmit: submit,
|
||||||
onCancel: cancel,
|
onCancel: cancel,
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user