Skip to content

Commit

Permalink
0.0.4 update
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoh281 authored Mar 30, 2021
1 parent 6328537 commit 73c1bf7
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,61 @@ Add ios/Info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>Used to Location's Info for Using Beacon when In Use.</string>
```
## Usage
```
late Stream<ESPTouchResult>? _stream;
@override
void initState() {
_stream = EsptouchSmartconfig.run(widget.ssid, widget.bssid,
widget.password, widget.deviceCount, widget.isBroadcast);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.of(context).pop(_results);
}),
backgroundColor: Colors.red,
title: Text(
'Task',
),
),
body: Container(
child: StreamBuilder<ESPTouchResult>(
stream: _stream,
builder: (context, AsyncSnapshot<ESPTouchResult> snapshot) {
if (snapshot.hasError) {
return error(context, 'Error in StreamBuilder');
}
switch (snapshot.connectionState) {
case ConnectionState.active:
_results.add(snapshot.data!);
return resultList(context, ConnectionState.active);
case ConnectionState.none:
return noneState(context);
case ConnectionState.done:
if (snapshot.hasData) {
_results.add(snapshot.data!);
return resultList(context, ConnectionState.done);
} else
return noneState(context);
case ConnectionState.waiting:
return waitingState(context);
}
},
),
),
);
}
```


## Reference

Expand Down

0 comments on commit 73c1bf7

Please sign in to comment.