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)),
|
Text(translate(error)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {});
|
gFFI.abModel.pullAb();
|
||||||
},
|
},
|
||||||
child: Text(translate("Retry")))
|
child: Text(translate("Retry")))
|
||||||
],
|
],
|
||||||
|
@ -113,7 +113,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
delegate: SliverChildListDelegate([
|
delegate: SliverChildListDelegate([
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
_buildRemoteIDTextField(context),
|
Flexible(child: _buildRemoteIDTextField(context)),
|
||||||
],
|
],
|
||||||
).marginOnly(top: 22),
|
).marginOnly(top: 22),
|
||||||
SizedBox(height: 12),
|
SizedBox(height: 12),
|
||||||
@ -237,9 +237,8 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Center(
|
return Container(
|
||||||
child: Container(
|
constraints: const BoxConstraints(maxWidth: 600), child: w);
|
||||||
constraints: const BoxConstraints(maxWidth: 600), child: w));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildStatus() {
|
Widget buildStatus() {
|
||||||
|
@ -34,13 +34,20 @@ class AbModel {
|
|||||||
if (resp.body.isNotEmpty && resp.body.toLowerCase() != "null") {
|
if (resp.body.isNotEmpty && resp.body.toLowerCase() != "null") {
|
||||||
Map<String, dynamic> json = jsonDecode(resp.body);
|
Map<String, dynamic> json = jsonDecode(resp.body);
|
||||||
if (json.containsKey('error')) {
|
if (json.containsKey('error')) {
|
||||||
abError = json['error'];
|
abError.value = json['error'];
|
||||||
} else if (json.containsKey('data')) {
|
} else if (json.containsKey('data')) {
|
||||||
final data = jsonDecode(json['data']);
|
final data = jsonDecode(json['data']);
|
||||||
tags.value = data['tags'];
|
if (data != null) {
|
||||||
peers.clear();
|
tags.clear();
|
||||||
for (final peer in data['peers']) {
|
peers.clear();
|
||||||
peers.add(Peer.fromJson(peer));
|
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;
|
return resp.body;
|
||||||
|
Loading…
Reference in New Issue
Block a user