mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-01 05:45:04 +01:00
opt.
This commit is contained in:
@@ -259,10 +259,11 @@ class _ServerPageState extends State<ServerPage>
|
||||
context: context,
|
||||
);
|
||||
},
|
||||
msg: 'Suspend ${srv.spi.name}',
|
||||
typ: l10n.suspend,
|
||||
name: srv.spi.name,
|
||||
),
|
||||
icon: const Icon(Icons.stop),
|
||||
tooltip: 'Suspend',
|
||||
tooltip: l10n.suspend,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => _askFor(
|
||||
@@ -270,10 +271,11 @@ class _ServerPageState extends State<ServerPage>
|
||||
ShellFunc.shutdown.exec,
|
||||
context: context,
|
||||
),
|
||||
msg: 'Shutdown ${srv.spi.name}',
|
||||
typ: l10n.shutdown,
|
||||
name: srv.spi.name,
|
||||
),
|
||||
icon: const Icon(Icons.power_off),
|
||||
tooltip: 'Shutdown',
|
||||
tooltip: l10n.shutdown,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => _askFor(
|
||||
@@ -281,10 +283,11 @@ class _ServerPageState extends State<ServerPage>
|
||||
ShellFunc.reboot.exec,
|
||||
context: context,
|
||||
),
|
||||
msg: 'Reboot ${srv.spi.name}',
|
||||
typ: l10n.reboot,
|
||||
name: srv.spi.name,
|
||||
),
|
||||
icon: const Icon(Icons.restart_alt),
|
||||
tooltip: 'Reboot',
|
||||
tooltip: l10n.reboot,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => AppRoute.serverEdit(spi: srv.spi).go(context),
|
||||
@@ -542,10 +545,14 @@ class _ServerPageState extends State<ServerPage>
|
||||
return 107;
|
||||
}
|
||||
|
||||
void _askFor({required void Function() func, required String msg}) {
|
||||
void _askFor({
|
||||
required void Function() func,
|
||||
required String typ,
|
||||
required String name,
|
||||
}) {
|
||||
context.showRoundDialog(
|
||||
title: Text(l10n.attention),
|
||||
child: Text(l10n.askContinue(msg)),
|
||||
child: Text(l10n.askContinue('$typ ${l10n.server}($name)')),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -332,44 +332,45 @@ class _SettingPageState extends State<SettingPage> {
|
||||
onTap: () async {
|
||||
final ctrl = TextEditingController(text: primaryColor.toHex);
|
||||
await context.showRoundDialog(
|
||||
title: Text(l10n.primaryColorSeed),
|
||||
child: StatefulBuilder(builder: (context, setState) {
|
||||
final children = <Widget>[
|
||||
/// Plugin [dynamic_color] is not supported on iOS
|
||||
if (!isIOS)
|
||||
ListTile(
|
||||
title: Text(l10n.followSystem),
|
||||
trailing: StoreSwitch(
|
||||
prop: _setting.useSystemPrimaryColor,
|
||||
func: (_) => setState(() {}),
|
||||
),
|
||||
)
|
||||
];
|
||||
if (!_setting.useSystemPrimaryColor.fetch()) {
|
||||
children.addAll([
|
||||
Input(
|
||||
onSubmitted: _onSaveColor,
|
||||
controller: ctrl,
|
||||
hint: '#8b2252',
|
||||
icon: Icons.colorize,
|
||||
title: Text(l10n.primaryColorSeed),
|
||||
child: StatefulBuilder(builder: (context, setState) {
|
||||
final children = <Widget>[
|
||||
/// Plugin [dynamic_color] is not supported on iOS
|
||||
if (!isIOS)
|
||||
ListTile(
|
||||
title: Text(l10n.followSystem),
|
||||
trailing: StoreSwitch(
|
||||
prop: _setting.useSystemPrimaryColor,
|
||||
func: (_) => setState(() {}),
|
||||
),
|
||||
ColorPicker(
|
||||
color: primaryColor,
|
||||
onColorChanged: (c) => ctrl.text = c.toHex,
|
||||
)
|
||||
]);
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: children,
|
||||
);
|
||||
}),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => _onSaveColor(ctrl.text),
|
||||
child: Text(l10n.ok),
|
||||
),
|
||||
]);
|
||||
)
|
||||
];
|
||||
if (!_setting.useSystemPrimaryColor.fetch()) {
|
||||
children.addAll([
|
||||
Input(
|
||||
onSubmitted: _onSaveColor,
|
||||
controller: ctrl,
|
||||
hint: '#8b2252',
|
||||
icon: Icons.colorize,
|
||||
),
|
||||
ColorPicker(
|
||||
color: primaryColor,
|
||||
onColorChanged: (c) => ctrl.text = c.toHex,
|
||||
)
|
||||
]);
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: children,
|
||||
);
|
||||
}),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => _onSaveColor(ctrl.text),
|
||||
child: Text(l10n.ok),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -128,9 +128,9 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
|
||||
Future<void> _runSnippet(Snippet snippet) async {
|
||||
final servers = await context.showPickDialog<Server>(
|
||||
items: Pros.server.servers.toList(),
|
||||
name: (e) => e.spi.name,
|
||||
);
|
||||
items: Pros.server.servers.toList(),
|
||||
name: (e) => e.spi.name,
|
||||
);
|
||||
if (servers == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
final fileName = file.path.split('/').last;
|
||||
context.showRoundDialog(
|
||||
title: Text(l10n.delete),
|
||||
child: Text(l10n.askContinue('${l10n.delete}: $fileName')),
|
||||
child: Text(l10n.askContinue('${l10n.delete} $fileName')),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
|
||||
@@ -412,10 +412,10 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
final useRmr = Stores.setting.sftpRmrDir.fetch();
|
||||
final text = () {
|
||||
if (isDir && !useRmr) {
|
||||
return l10n.askContinue(
|
||||
'${l10n.dirEmpty}\n${l10n.delete} ${l10n.files}(${file.filename})');
|
||||
return l10n
|
||||
.askContinue('${l10n.dirEmpty}\n${l10n.delete} ${file.filename}');
|
||||
}
|
||||
return l10n.askContinue('${l10n.delete} ${l10n.files}(${file.filename})');
|
||||
return l10n.askContinue('${l10n.delete} ${file.filename}');
|
||||
}();
|
||||
context.showRoundDialog(
|
||||
child: Text(text),
|
||||
|
||||
@@ -96,9 +96,9 @@ void _onTapMoreBtns(
|
||||
break;
|
||||
case ServerTabMenuType.snippet:
|
||||
final snippets = await context.showPickDialog<Snippet>(
|
||||
items: Pros.snippet.snippets,
|
||||
name: (e) => e.name,
|
||||
);
|
||||
items: Pros.snippet.snippets,
|
||||
name: (e) => e.name,
|
||||
);
|
||||
if (snippets == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user