Skip to content

Commit 0a50827

Browse files
committed
wot standards added
1 parent 1e4d1fd commit 0a50827

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

lib/screens/Discovery/Discovery.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class DiscoveryState extends State<Discovery> {
3232
}).catchError((onError) {
3333
print("Error fetching device list");
3434
});
35-
print("Fetch called");
3635
});
3736
}
3837

@@ -66,8 +65,11 @@ class DiscoveryState extends State<Discovery> {
6665
itemCount: devices.length,
6766
itemBuilder: (BuildContext context, int index) {
6867
return new DeviceListItem(
69-
deviceID: devices[index].id,
70-
deviceName: devices[index].name);
68+
id: devices[index].id,
69+
type: devices[index].type,
70+
title: devices[index].title,
71+
description: devices[index].description,
72+
);
7173
})),
7274
);
7375
}

lib/screens/Discovery/widgets/DeviceListItem.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import 'package:flutter/material.dart';
22

33
class DeviceListItem extends StatelessWidget {
4-
DeviceListItem({this.deviceID, this.deviceName});
4+
DeviceListItem({this.id, this.type, this.title, this.description});
55

6-
final String deviceID;
7-
final String deviceName;
6+
final String id;
7+
final String type;
8+
final String title;
9+
final String description;
810

911
@override
1012
Widget build(BuildContext context) {
@@ -17,8 +19,8 @@ class DeviceListItem extends StatelessWidget {
1719
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
1820
ListTile(
1921
leading: Icon(Icons.album),
20-
title: Text(this.deviceName),
21-
subtitle: Text("Sample device description"))
22+
title: Text(this.title),
23+
subtitle: Text(this.description))
2224
]),
2325
),
2426
),

lib/util/apis/discovery.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Future<List<Device>> getDiscoveredList([Map<String, String> data = const {}]) {
1414
var parsedJson = jsonDecode(response.body);
1515

1616
List<Device> devices = new List<Device>();
17-
if (parsedJson["deviceArray"] is List) {
18-
for (var item in parsedJson["deviceArray"]) {
19-
devices.add(new Device(item["id"], item["name"]));
17+
if (parsedJson["devices"] is List) {
18+
for (var item in parsedJson["devices"]) {
19+
devices.add(new Device(item["id"], item["type"], item["title"], item["description"]));
2020
}
2121
}
2222

lib/util/data/Device.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
class Device {
2-
Device(this.id, this.name);
2+
Device(this.id, this.type, this.title, this.description);
33

44
final String id;
5-
final String name;
5+
final String type;
6+
final String title;
7+
final String description;
68
}

0 commit comments

Comments
 (0)