new: settings of containerTrySudo usePodman

This commit is contained in:
lollipopkit
2024-02-18 16:54:13 +08:00
parent 61ddb56639
commit b802c97a8d
23 changed files with 224 additions and 103 deletions

View File

@@ -59,7 +59,7 @@ class _ContainerPageState extends State<ContainerPage> {
return Scaffold(
appBar: CustomAppBar(
centerTitle: true,
title: TwoLineText(up: 'Container', down: widget.spi.name),
title: TwoLineText(up: l10n.container, down: widget.spi.name),
actions: [
IconButton(
onPressed: () async {
@@ -358,7 +358,7 @@ class _ContainerPageState extends State<ContainerPage> {
Future<void> _showEditHostDialog() async {
final id = widget.spi.id;
final host = Stores.docker.fetch(id);
final host = Stores.container.fetch(id);
final ctrl = TextEditingController(text: host);
await context.showRoundDialog(
title: Text(l10n.dockerEditHost),
@@ -379,7 +379,7 @@ class _ContainerPageState extends State<ContainerPage> {
void _onSaveDockerHost(String val) {
context.pop();
Stores.docker.put(widget.spi.id, val.trim());
Stores.container.put(widget.spi.id, val.trim());
_container.refresh();
}

View File

@@ -120,12 +120,7 @@ class _SettingPageState extends State<SettingPage> {
TextButton(
onPressed: () {
if (!BuildMode.isDebug) return;
Stores.docker.box.deleteFromDisk();
Stores.server.box.deleteFromDisk();
Stores.setting.box.deleteFromDisk();
Stores.history.box.deleteFromDisk();
Stores.snippet.box.deleteFromDisk();
Stores.key.box.deleteFromDisk();
Stores.all.map((e) => e.box.deleteFromDisk());
exit(0);
},
child: Text(l10n.ok,
@@ -144,6 +139,8 @@ class _SettingPageState extends State<SettingPage> {
_buildApp(),
_buildTitle(l10n.server),
_buildServer(),
_buildTitle(l10n.container),
_buildContainer(),
_buildTitle('SSH'),
_buildSSH(),
_buildTitle('SFTP'),
@@ -180,6 +177,7 @@ class _SettingPageState extends State<SettingPage> {
_buildAppColor(),
//_buildLaunchPage(),
_buildCheckUpdate(),
_buildCollapseUI(),
];
/// Platform specific settings
@@ -204,7 +202,6 @@ class _SettingPageState extends State<SettingPage> {
Widget _buildServer() {
return Column(
children: [
_buildCollapseUI(),
_buildServerFuncBtns(),
_buildServerSeq(),
_buildServerDetailCardSeq(),
@@ -219,6 +216,15 @@ class _SettingPageState extends State<SettingPage> {
);
}
Widget _buildContainer() {
return Column(
children: [
_buildUsePodman(),
_buildContainerTrySudo(),
].map((e) => CardX(child: e)).toList(),
);
}
Widget _buildSSH() {
return Column(
children: [
@@ -1136,4 +1142,19 @@ class _SettingPageState extends State<SettingPage> {
trailing: StoreSwitch(prop: _setting.collapseUIDefault),
);
}
Widget _buildUsePodman() {
return ListTile(
title: Text(l10n.usePodmanByDefault),
trailing: StoreSwitch(prop: _setting.usePodman),
);
}
Widget _buildContainerTrySudo() {
return ListTile(
title: Text(l10n.trySudo),
subtitle: Text(l10n.containerTrySudoTip, style: UIs.textGrey),
trailing: StoreSwitch(prop: _setting.containerTrySudo),
);
}
}