@@ -36,6 +36,7 @@ class _DiscoveryState extends State<Discovery> {
3636 _updateDeviceList (fetchedDevices);
3737 _updateFetchStatus (FetchStatus .FETCHING );
3838 }).catchError ((onError) {
39+ _clearDeviceList ();
3940 _updateFetchStatus (FetchStatus .CONNECTION_ERROR );
4041 print (onError);
4142 });
@@ -85,16 +86,30 @@ class _DiscoveryState extends State<Discovery> {
8586 );
8687 break ;
8788 case FetchStatus .FETCHING :
88- _child = ListView .builder (
89- itemCount: _devices.length,
90- itemBuilder: (BuildContext context, int index) {
91- return new DeviceListItem (
92- id: _devices[index].id,
93- type: _devices[index].type,
94- title: _devices[index].title,
95- description: _devices[index].description,
96- );
97- });
89+ if (_devices.length == 0 ) {
90+ _child = Row (
91+ mainAxisAlignment: MainAxisAlignment .center,
92+ crossAxisAlignment: CrossAxisAlignment .center,
93+ children: < Widget > [
94+ Icon (Icons .location_disabled),
95+ Padding (
96+ padding: EdgeInsets .only (left: 12 ),
97+ ),
98+ Text ("No Devices Found" )
99+ ],
100+ );
101+ } else {
102+ _child = ListView .builder (
103+ itemCount: _devices.length,
104+ itemBuilder: (BuildContext context, int index) {
105+ return new DeviceListItem (
106+ id: _devices[index].id,
107+ type: _devices[index].type,
108+ title: _devices[index].title,
109+ description: _devices[index].description,
110+ );
111+ });
112+ }
98113 break ;
99114 case FetchStatus .CONNECTION_ERROR :
100115 _child = Row (
@@ -105,7 +120,7 @@ class _DiscoveryState extends State<Discovery> {
105120 Padding (
106121 padding: EdgeInsets .only (left: 12 ),
107122 ),
108- Text ("Dock Broken " )
123+ Text ("Dock Unreachable " )
109124 ],
110125 );
111126 break ;
0 commit comments