mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-08 02:12:49 +08:00
fix bug fallback peer sort setting
This commit is contained in:
parent
f042ed44bd
commit
c307013325
@ -435,7 +435,17 @@ class PeerSortDropdown extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PeerSortDropdownState extends State<PeerSortDropdown> {
|
class _PeerSortDropdownState extends State<PeerSortDropdown> {
|
||||||
String _sortType = peerSort.value;
|
@override
|
||||||
|
void initState() {
|
||||||
|
if (!PeerSortType.values.contains(peerSort.value)) {
|
||||||
|
peerSort.value = PeerSortType.remoteId;
|
||||||
|
bind.setLocalFlutterConfig(
|
||||||
|
k: "peer-sorting",
|
||||||
|
v: peerSort.value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -448,17 +458,13 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
|
|||||||
decoration: deco,
|
decoration: deco,
|
||||||
child: DropdownButtonHideUnderline(
|
child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButton2<String>(
|
child: DropdownButton2<String>(
|
||||||
value: PeerSortType.values.contains(_sortType)
|
|
||||||
? _sortType
|
|
||||||
: PeerSortType.remoteId,
|
|
||||||
onChanged: (v) async {
|
onChanged: (v) async {
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
setState(() => _sortType = v);
|
setState(() => peerSort.value = v);
|
||||||
await bind.setLocalFlutterConfig(
|
await bind.setLocalFlutterConfig(
|
||||||
k: "peer-sorting",
|
k: "peer-sorting",
|
||||||
v: _sortType,
|
v: peerSort.value,
|
||||||
);
|
);
|
||||||
peerSort.value = _sortType;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
customButton: Icon(
|
customButton: Icon(
|
||||||
@ -488,7 +494,7 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
value == _sortType
|
value == peerSort.value
|
||||||
? Icons.radio_button_checked_rounded
|
? Icons.radio_button_checked_rounded
|
||||||
: Icons.radio_button_off_rounded,
|
: Icons.radio_button_off_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
|
Loading…
Reference in New Issue
Block a user