more style bug fix

This commit is contained in:
rustdesk 2022-09-20 18:09:02 +08:00
parent 7ad876afe9
commit 13fe2164d4
3 changed files with 39 additions and 49 deletions

View File

@ -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";

View File

@ -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>
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>
: 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>
_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: () async {
onTap: () { await bind.mainSetLocalOption(
peerCardUiType.value = PeerUiType.grid; key: 'peer-card-ui-type',
}, value: type.index.toString());
child: Icon( peerCardUiType.value = type;
Icons.grid_view_rounded, },
size: 18, child: Icon(
color: peerCardUiType.value == PeerUiType.grid type == PeerUiType.grid
? MyTheme.color(context).text ? Icons.grid_view_rounded
: MyTheme.color(context).lightText, : Icons.list,
)), size: 18,
), color: peerCardUiType.value == type
), ? MyTheme.color(context).text
Obx( : MyTheme.color(context).lightText,
() => Container( )),
padding: EdgeInsets.all(4.0), ),
decoration: ))
peerCardUiType.value == PeerUiType.list ? activeDeco : null, .toList(),
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,
)),
),
),
],
); );
} }
} }

View File

@ -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", "允许远程修改配置"),