diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dart index e7c506ecc..55d13f10e 100644 --- a/flutter/lib/consts.dart +++ b/flutter/lib/consts.dart @@ -19,8 +19,8 @@ const int kDesktopDefaultDisplayHeight = 720; const kDefaultScrollAmountMultiplier = 5.0; const kDefaultScrollDuration = Duration(milliseconds: 50); const kDefaultMouseWhellThrottleDuration = Duration(milliseconds: 50); -const kFullScreenEdgeSize = 1.0; -const kWindowEdgeSize = 4.0; +const kFullScreenEdgeSize = 0.0; +const kWindowEdgeSize = 1.0; const kInvalidValueStr = "InvalidValueStr"; diff --git a/flutter/lib/desktop/pages/connection_page.dart b/flutter/lib/desktop/pages/connection_page.dart index 05cb3858a..5c127354e 100644 --- a/flutter/lib/desktop/pages/connection_page.dart +++ b/flutter/lib/desktop/pages/connection_page.dart @@ -774,27 +774,31 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> @override void initState() { () async { - await bind.mainGetLocalOption(key: 'peer_tab_index').then((value) { + await bind.mainGetLocalOption(key: 'peer-tab-index').then((value) { if (value == '') return; final tab = int.parse(value); _tabIndex.value = tab; _pageController.jumpToPage(tab); }); + await bind.mainGetLocalOption(key: 'peer-card-ui-type').then((value) { + if (value == '') return; + final tab = int.parse(value); + peerCardUiType.value = + tab == PeerUiType.list.index ? PeerUiType.list : PeerUiType.grid; + }); }(); super.initState(); } // hard code for now - void _handleTabSelection(int index) { + Future _handleTabSelection(int index) async { if (index == _tabIndex.value) return; // reset search text peerSearchText.value = ""; peerSearchTextController.clear(); _tabIndex.value = index; - () async { - await bind.mainSetLocalOption( - key: 'peer_tab_index', value: index.toString()); - }(); + await bind.mainSetLocalOption( + key: 'peer-tab-index', value: index.toString()); _pageController.jumpToPage(index); switch (index) { case 0: @@ -845,7 +849,7 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> shrinkWrap: true, controller: ScrollController(), children: super.widget.tabs.asMap().entries.map((t) { - return Obx(() => GestureDetector( + return Obx(() => InkWell( child: Container( padding: EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( @@ -867,7 +871,7 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> : MyTheme.color(context).lightText), ), )), - onTap: () => _handleTabSelection(t.key), + onTap: () async => await _handleTabSelection(t.key), )); }).toList()); } @@ -959,44 +963,30 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> _createPeerViewTypeSwitch(BuildContext context) { final activeDeco = BoxDecoration(color: MyTheme.color(context).bg); return Row( - children: [ - Obx( - () => Container( - padding: EdgeInsets.all(4.0), - decoration: - peerCardUiType.value == PeerUiType.grid ? activeDeco : null, - child: InkWell( - onTap: () { - peerCardUiType.value = PeerUiType.grid; - }, - child: Icon( - Icons.grid_view_rounded, - size: 18, - color: peerCardUiType.value == PeerUiType.grid - ? MyTheme.color(context).text - : MyTheme.color(context).lightText, - )), - ), - ), - Obx( - () => Container( - padding: EdgeInsets.all(4.0), - decoration: - peerCardUiType.value == PeerUiType.list ? activeDeco : null, - child: InkWell( - onTap: () { - peerCardUiType.value = PeerUiType.list; - }, - child: Icon( - Icons.list, - size: 18, - color: peerCardUiType.value == PeerUiType.list - ? MyTheme.color(context).text - : MyTheme.color(context).lightText, - )), - ), - ), - ], + children: [PeerUiType.grid, PeerUiType.list] + .map((type) => Obx( + () => Container( + padding: EdgeInsets.all(4.0), + decoration: peerCardUiType.value == type ? activeDeco : null, + child: InkWell( + onTap: () async { + await bind.mainSetLocalOption( + key: 'peer-card-ui-type', + value: type.index.toString()); + peerCardUiType.value = type; + }, + child: Icon( + type == PeerUiType.grid + ? Icons.grid_view_rounded + : Icons.list, + size: 18, + color: peerCardUiType.value == type + ? MyTheme.color(context).text + : MyTheme.color(context).lightText, + )), + ), + )) + .toList(), ); } } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 920013be3..664d6f05b 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -189,7 +189,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("x11 expected", "请切换到 x11"), ("Port", "端口"), ("Settings", "设置"), - ("Username", " 用户名"), + ("Username", "用户名"), ("Invalid port", "无效端口"), ("Closed manually by the peer", "被对方手动关闭"), ("Enable remote configuration modification", "允许远程修改配置"),