new: setting of doubleColumn on Desktop

This commit is contained in:
lollipopkit
2023-09-07 18:54:35 +08:00
parent b55b8bf831
commit 03f9e88bad
13 changed files with 58 additions and 21 deletions

View File

@@ -416,6 +416,12 @@ abstract class S {
/// **'{count} container running.'**
String dockerStatusRunningFmt(Object count);
/// No description provided for @doubleColumnMode.
///
/// In en, this message translates to:
/// **'Double column mode'**
String get doubleColumnMode;
/// No description provided for @download.
///
/// In en, this message translates to:

View File

@@ -171,6 +171,9 @@ class SDe extends S {
return '$count Container aktiv';
}
@override
String get doubleColumnMode => 'Doppelspaltiger Modus';
@override
String get download => 'Download';

View File

@@ -171,6 +171,9 @@ class SEn extends S {
return '$count container running.';
}
@override
String get doubleColumnMode => 'Double column mode';
@override
String get download => 'Download';

View File

@@ -171,6 +171,9 @@ class SId extends S {
return '$count wadah berjalan.';
}
@override
String get doubleColumnMode => 'Mode kolom ganda';
@override
String get download => 'Unduh';

View File

@@ -171,6 +171,9 @@ class SZh extends S {
return '$count个容器正在运行';
}
@override
String get doubleColumnMode => '双列模式';
@override
String get download => '下载';
@@ -897,6 +900,9 @@ class SZhTw extends SZh {
return '$count個容器正在運行';
}
@override
String get doubleColumnMode => '雙列模式';
@override
String get download => '下載';

View File

@@ -27,6 +27,8 @@ class SettingStore extends PersistentStore {
'timeOut',
5,
);
/// Duration of [timeout]
Duration get timeoutD => Duration(seconds: timeout.fetch());
/// Record history of SFTP path and etc.
late final recordHistory = StoreProperty(
@@ -64,9 +66,6 @@ class SettingStore extends PersistentStore {
defaultLaunchPageIdx,
);
// Version of store db
late final storeVersion = StoreProperty(box, 'storeVersion', 0);
late final termColorIdx = StoreProperty(box, 'termColorIdx', 0);
// Max retry count when connect to server
@@ -184,6 +183,17 @@ class SettingStore extends PersistentStore {
false,
);
/// Duration of [timeout]
Duration get timeoutD => Duration(seconds: timeout.fetch());
/// Use double column servers page on Desktop
late final doubleColumnServersPage = StoreProperty(
box,
'doubleColumnServersPage',
isDesktop,
);
// Never show these settings for users
// ------BEGIN------
/// Version of store db
late final storeVersion = StoreProperty(box, 'storeVersion', 0);
// ------END------
}

View File

@@ -53,6 +53,7 @@
"dockerNotInstalled": "Docker ist nicht installiert",
"dockerStatusRunningAndStoppedFmt": "{runningCount} aktiv, {stoppedCount} container gestoppt.",
"dockerStatusRunningFmt": "{count} Container aktiv",
"doubleColumnMode": "Doppelspaltiger Modus",
"download": "Download",
"edit": "Bearbeiten",
"editVirtKeys": "Virtuelle Tasten bearbeiten",

View File

@@ -53,6 +53,7 @@
"dockerNotInstalled": "Docker not installed",
"dockerStatusRunningAndStoppedFmt": "{runningCount} running, {stoppedCount} container stopped.",
"dockerStatusRunningFmt": "{count} container running.",
"doubleColumnMode": "Double column mode",
"download": "Download",
"edit": "Edit",
"editVirtKeys": "Edit virtual keys",

View File

@@ -53,6 +53,7 @@
"dockerNotInstalled": "Docker tidak terpasang",
"dockerStatusRunningAndStoppedFmt": "{runningCount} running, {stoppedCount} container stopped.",
"dockerStatusRunningFmt": "{count} wadah berjalan.",
"doubleColumnMode": "Mode kolom ganda",
"download": "Unduh",
"edit": "Edit",
"editVirtKeys": "Edit kunci virtual",

View File

@@ -53,6 +53,7 @@
"dockerNotInstalled": "Docker 未安装",
"dockerStatusRunningAndStoppedFmt": "{runningCount}个正在运行, {stoppedCount}个已停止",
"dockerStatusRunningFmt": "{count}个容器正在运行",
"doubleColumnMode": "双列模式",
"download": "下载",
"edit": "编辑",
"editVirtKeys": "编辑虚拟按键",

View File

@@ -53,6 +53,7 @@
"dockerNotInstalled": "Docker 未安裝",
"dockerStatusRunningAndStoppedFmt": "{runningCount}個正在運行, {stoppedCount}個已停止",
"dockerStatusRunningFmt": "{count}個容器正在運行",
"doubleColumnMode": "雙列模式",
"download": "下載",
"edit": "編輯",
"editVirtKeys": "編輯虛擬按鍵",

View File

@@ -36,22 +36,15 @@ class ServerPage extends StatefulWidget {
class _ServerPageState extends State<ServerPage>
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
late MediaQueryData _media;
late ServerProvider _serverProvider;
late SettingStore _settingStore;
late S _s;
final _flipedCardIds = <String>{};
final _serverProvider = locator<ServerProvider>();
final _setting = locator<SettingStore>();
String? _tag;
bool _useDoubleColumn = false;
@override
void initState() {
super.initState();
_serverProvider = locator<ServerProvider>();
_settingStore = locator<SettingStore>();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
@@ -90,7 +83,7 @@ class _ServerPageState extends State<ServerPage>
}
final filtered = _filterServers(pro);
if (_useDoubleColumn) {
if (_useDoubleColumn && _setting.doubleColumnServersPage.fetch()) {
return _buildBodyMedium(pro);
}
return _buildBodySmall(provider: pro, filtered: filtered);
@@ -297,9 +290,9 @@ class _ServerPageState extends State<ServerPage>
),
),
height13,
if (_settingStore.moveOutServerTabFuncBtns.fetch() &&
if (_setting.moveOutServerTabFuncBtns.fetch() &&
// Discussion #146
!_settingStore.serverTabUseOldUI.fetch())
!_setting.serverTabUseOldUI.fetch())
SizedBox(
height: 27,
child: ServerFuncBtns(spi: spi, s: _s),
@@ -325,7 +318,7 @@ class _ServerPageState extends State<ServerPage>
),
),
);
} else if (_settingStore.serverTabUseOldUI.fetch()) {
} else if (_setting.serverTabUseOldUI.fetch()) {
rightCorner = ServerFuncBtnsTopRight(spi: spi, s: _s);
}
return Padding(
@@ -400,7 +393,7 @@ class _ServerPageState extends State<ServerPage>
Widget _buildNet(ServerStatus ss) {
return ValueListenableBuilder<NetViewType>(
valueListenable: _settingStore.netViewType.listenable(),
valueListenable: _setting.netViewType.listenable(),
builder: (_, val, __) {
final data = val.build(ss);
return AnimatedSwitcher(
@@ -518,9 +511,9 @@ class _ServerPageState extends State<ServerPage>
if (_flipedCardIds.contains(id)) {
return 77.0;
}
if (_settingStore.moveOutServerTabFuncBtns.fetch() &&
if (_setting.moveOutServerTabFuncBtns.fetch() &&
// Discussion #146
!_settingStore.serverTabUseOldUI.fetch()) {
!_setting.serverTabUseOldUI.fetch()) {
return 132;
}
return 107;

View File

@@ -204,6 +204,7 @@ class _SettingPageState extends State<SettingPage> {
_buildMaxRetry(),
_buildDiskIgnorePath(),
_buildDeleteServers(),
if (isDesktop) _buildDoubleColumnServersPage(),
].map((e) => RoundRectCard(e)).toList(),
);
}
@@ -1057,4 +1058,11 @@ class _SettingPageState extends State<SettingPage> {
trailing: buildSwitch(context, _setting.sftpRmrfDir),
);
}
Widget _buildDoubleColumnServersPage() {
return ListTile(
title: Text(_s.doubleColumnMode),
trailing: buildSwitch(context, _setting.doubleColumnServersPage),
);
}
}