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.'** /// **'{count} container running.'**
String dockerStatusRunningFmt(Object count); 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. /// No description provided for @download.
/// ///
/// In en, this message translates to: /// In en, this message translates to:

View File

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

View File

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

View File

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

View File

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

View File

@@ -27,6 +27,8 @@ class SettingStore extends PersistentStore {
'timeOut', 'timeOut',
5, 5,
); );
/// Duration of [timeout]
Duration get timeoutD => Duration(seconds: timeout.fetch());
/// Record history of SFTP path and etc. /// Record history of SFTP path and etc.
late final recordHistory = StoreProperty( late final recordHistory = StoreProperty(
@@ -64,9 +66,6 @@ class SettingStore extends PersistentStore {
defaultLaunchPageIdx, defaultLaunchPageIdx,
); );
// Version of store db
late final storeVersion = StoreProperty(box, 'storeVersion', 0);
late final termColorIdx = StoreProperty(box, 'termColorIdx', 0); late final termColorIdx = StoreProperty(box, 'termColorIdx', 0);
// Max retry count when connect to server // Max retry count when connect to server
@@ -184,6 +183,17 @@ class SettingStore extends PersistentStore {
false, false,
); );
/// Duration of [timeout] /// Use double column servers page on Desktop
Duration get timeoutD => Duration(seconds: timeout.fetch()); 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", "dockerNotInstalled": "Docker ist nicht installiert",
"dockerStatusRunningAndStoppedFmt": "{runningCount} aktiv, {stoppedCount} container gestoppt.", "dockerStatusRunningAndStoppedFmt": "{runningCount} aktiv, {stoppedCount} container gestoppt.",
"dockerStatusRunningFmt": "{count} Container aktiv", "dockerStatusRunningFmt": "{count} Container aktiv",
"doubleColumnMode": "Doppelspaltiger Modus",
"download": "Download", "download": "Download",
"edit": "Bearbeiten", "edit": "Bearbeiten",
"editVirtKeys": "Virtuelle Tasten bearbeiten", "editVirtKeys": "Virtuelle Tasten bearbeiten",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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