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