Revert "Refact/flutter 3.24.4 (#9870)" (#9871)

This reverts commit 5eb2c31207.
This commit is contained in:
RustDesk
2024-11-09 23:32:18 +08:00
committed by GitHub
parent 5eb2c31207
commit 912f5265f1
9 changed files with 122 additions and 153 deletions

View File

@@ -203,8 +203,6 @@ class _ConnectionPageState extends State<ConnectionPage>
bool isPeersLoading = false;
bool isPeersLoaded = false;
// https://github.com/flutter/flutter/issues/157244
Iterable<Peer> _autocompleteOpts = [];
@override
void initState() {
@@ -332,7 +330,7 @@ class _ConnectionPageState extends State<ConnectionPage>
child: Autocomplete<Peer>(
optionsBuilder: (TextEditingValue textEditingValue) {
if (textEditingValue.text == '') {
_autocompleteOpts = const Iterable<Peer>.empty();
return const Iterable<Peer>.empty();
} else if (peers.isEmpty && !isPeersLoaded) {
Peer emptyPeer = Peer(
id: '',
@@ -348,7 +346,7 @@ class _ConnectionPageState extends State<ConnectionPage>
rdpUsername: '',
loginName: '',
);
_autocompleteOpts = [emptyPeer];
return [emptyPeer];
} else {
String textWithoutSpaces =
textEditingValue.text.replaceAll(" ", "");
@@ -359,7 +357,8 @@ class _ConnectionPageState extends State<ConnectionPage>
);
}
String textToFind = textEditingValue.text.toLowerCase();
_autocompleteOpts = peers
return peers
.where((peer) =>
peer.id.toLowerCase().contains(textToFind) ||
peer.username
@@ -371,7 +370,6 @@ class _ConnectionPageState extends State<ConnectionPage>
peer.alias.toLowerCase().contains(textToFind))
.toList();
}
return _autocompleteOpts;
},
fieldViewBuilder: (
BuildContext context,
@@ -432,7 +430,6 @@ class _ConnectionPageState extends State<ConnectionPage>
optionsViewBuilder: (BuildContext context,
AutocompleteOnSelected<Peer> onSelected,
Iterable<Peer> options) {
options = _autocompleteOpts;
double maxHeight = options.length * 50;
if (options.length == 1) {
maxHeight = 52;