Commit 13fe2164 authored by rustdesk's avatar rustdesk

more style bug fix

parent 7ad876af
...@@ -19,8 +19,8 @@ const int kDesktopDefaultDisplayHeight = 720; ...@@ -19,8 +19,8 @@ const int kDesktopDefaultDisplayHeight = 720;
const kDefaultScrollAmountMultiplier = 5.0; const kDefaultScrollAmountMultiplier = 5.0;
const kDefaultScrollDuration = Duration(milliseconds: 50); const kDefaultScrollDuration = Duration(milliseconds: 50);
const kDefaultMouseWhellThrottleDuration = Duration(milliseconds: 50); const kDefaultMouseWhellThrottleDuration = Duration(milliseconds: 50);
const kFullScreenEdgeSize = 1.0; const kFullScreenEdgeSize = 0.0;
const kWindowEdgeSize = 4.0; const kWindowEdgeSize = 1.0;
const kInvalidValueStr = "InvalidValueStr"; const kInvalidValueStr = "InvalidValueStr";
......
...@@ -774,27 +774,31 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> ...@@ -774,27 +774,31 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
@override @override
void initState() { void initState() {
() async { () async {
await bind.mainGetLocalOption(key: 'peer_tab_index').then((value) { await bind.mainGetLocalOption(key: 'peer-tab-index').then((value) {
if (value == '') return; if (value == '') return;
final tab = int.parse(value); final tab = int.parse(value);
_tabIndex.value = tab; _tabIndex.value = tab;
_pageController.jumpToPage(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(); super.initState();
} }
// hard code for now // hard code for now
void _handleTabSelection(int index) { Future<void> _handleTabSelection(int index) async {
if (index == _tabIndex.value) return; if (index == _tabIndex.value) return;
// reset search text // reset search text
peerSearchText.value = ""; peerSearchText.value = "";
peerSearchTextController.clear(); peerSearchTextController.clear();
_tabIndex.value = index; _tabIndex.value = index;
() async {
await bind.mainSetLocalOption( await bind.mainSetLocalOption(
key: 'peer_tab_index', value: index.toString()); key: 'peer-tab-index', value: index.toString());
}();
_pageController.jumpToPage(index); _pageController.jumpToPage(index);
switch (index) { switch (index) {
case 0: case 0:
...@@ -845,7 +849,7 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> ...@@ -845,7 +849,7 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
shrinkWrap: true, shrinkWrap: true,
controller: ScrollController(), controller: ScrollController(),
children: super.widget.tabs.asMap().entries.map((t) { children: super.widget.tabs.asMap().entries.map((t) {
return Obx(() => GestureDetector( return Obx(() => InkWell(
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 8), padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -867,7 +871,7 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> ...@@ -867,7 +871,7 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
: MyTheme.color(context).lightText), : MyTheme.color(context).lightText),
), ),
)), )),
onTap: () => _handleTabSelection(t.key), onTap: () async => await _handleTabSelection(t.key),
)); ));
}).toList()); }).toList());
} }
...@@ -959,44 +963,30 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage> ...@@ -959,44 +963,30 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
_createPeerViewTypeSwitch(BuildContext context) { _createPeerViewTypeSwitch(BuildContext context) {
final activeDeco = BoxDecoration(color: MyTheme.color(context).bg); final activeDeco = BoxDecoration(color: MyTheme.color(context).bg);
return Row( return Row(
children: [ children: [PeerUiType.grid, PeerUiType.list]
Obx( .map((type) => Obx(
() => Container( () => Container(
padding: EdgeInsets.all(4.0), padding: EdgeInsets.all(4.0),
decoration: decoration: peerCardUiType.value == type ? activeDeco : null,
peerCardUiType.value == PeerUiType.grid ? activeDeco : null,
child: InkWell( child: InkWell(
onTap: () { onTap: () async {
peerCardUiType.value = PeerUiType.grid; await bind.mainSetLocalOption(
}, key: 'peer-card-ui-type',
child: Icon( value: type.index.toString());
Icons.grid_view_rounded, peerCardUiType.value = type;
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( child: Icon(
Icons.list, type == PeerUiType.grid
? Icons.grid_view_rounded
: Icons.list,
size: 18, size: 18,
color: peerCardUiType.value == PeerUiType.list color: peerCardUiType.value == type
? MyTheme.color(context).text ? MyTheme.color(context).text
: MyTheme.color(context).lightText, : MyTheme.color(context).lightText,
)), )),
), ),
), ))
], .toList(),
); );
} }
} }
...@@ -189,7 +189,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ...@@ -189,7 +189,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("x11 expected", "请切换到 x11"), ("x11 expected", "请切换到 x11"),
("Port", "端口"), ("Port", "端口"),
("Settings", "设置"), ("Settings", "设置"),
("Username", " 用户名"), ("Username", "用户名"),
("Invalid port", "无效端口"), ("Invalid port", "无效端口"),
("Closed manually by the peer", "被对方手动关闭"), ("Closed manually by the peer", "被对方手动关闭"),
("Enable remote configuration modification", "允许远程修改配置"), ("Enable remote configuration modification", "允许远程修改配置"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment