mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-01-18 15:53:00 +08:00
judge attribute when parse ab json
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
5a7f610b59
commit
9788f3684f
@ -90,7 +90,7 @@ class _AddressBookState extends State<AddressBook> {
|
||||
Text(translate(error)),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
setState(() {});
|
||||
gFFI.abModel.pullAb();
|
||||
},
|
||||
child: Text(translate("Retry")))
|
||||
],
|
||||
|
@ -113,7 +113,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
delegate: SliverChildListDelegate([
|
||||
Row(
|
||||
children: [
|
||||
_buildRemoteIDTextField(context),
|
||||
Flexible(child: _buildRemoteIDTextField(context)),
|
||||
],
|
||||
).marginOnly(top: 22),
|
||||
SizedBox(height: 12),
|
||||
@ -237,9 +237,8 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
),
|
||||
),
|
||||
);
|
||||
return Center(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 600), child: w));
|
||||
return Container(
|
||||
constraints: const BoxConstraints(maxWidth: 600), child: w);
|
||||
}
|
||||
|
||||
Widget buildStatus() {
|
||||
|
@ -34,15 +34,22 @@ class AbModel {
|
||||
if (resp.body.isNotEmpty && resp.body.toLowerCase() != "null") {
|
||||
Map<String, dynamic> json = jsonDecode(resp.body);
|
||||
if (json.containsKey('error')) {
|
||||
abError = json['error'];
|
||||
abError.value = json['error'];
|
||||
} else if (json.containsKey('data')) {
|
||||
final data = jsonDecode(json['data']);
|
||||
tags.value = data['tags'];
|
||||
if (data != null) {
|
||||
tags.clear();
|
||||
peers.clear();
|
||||
if (data['tags'] is List) {
|
||||
tags.value = data['tags'];
|
||||
}
|
||||
if (data['peers'] is List) {
|
||||
for (final peer in data['peers']) {
|
||||
peers.add(Peer.fromJson(peer));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resp.body;
|
||||
} else {
|
||||
return "";
|
||||
|
Loading…
Reference in New Issue
Block a user