-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yukiho
committed
Nov 7, 2020
1 parent
f4434f2
commit 6cd1dca
Showing
11 changed files
with
337 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ':app' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
PODS: | ||
- Flutter (1.0.0) | ||
- flutter_blue (0.0.1): | ||
- Flutter | ||
- flutter_blue/Protos (= 0.0.1) | ||
- flutter_blue/Protos (0.0.1): | ||
- Flutter | ||
- Protobuf (~> 3.11.4) | ||
- flutter_nfc_reader (0.0.1): | ||
- Flutter | ||
- VYNFCKit | ||
- Protobuf (3.11.4) | ||
- VYNFCKit (0.3.2) | ||
|
||
DEPENDENCIES: | ||
- Flutter (from `Flutter`) | ||
- flutter_blue (from `.symlinks/plugins/flutter_blue/ios`) | ||
- flutter_nfc_reader (from `.symlinks/plugins/flutter_nfc_reader/ios`) | ||
|
||
SPEC REPOS: | ||
trunk: | ||
- Protobuf | ||
- VYNFCKit | ||
|
||
EXTERNAL SOURCES: | ||
Flutter: | ||
:path: Flutter | ||
flutter_blue: | ||
:path: ".symlinks/plugins/flutter_blue/ios" | ||
flutter_nfc_reader: | ||
:path: ".symlinks/plugins/flutter_nfc_reader/ios" | ||
|
||
SPEC CHECKSUMS: | ||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec | ||
flutter_blue: eeb381dc4727a0954dede73515f683865494b370 | ||
flutter_nfc_reader: 67d71071d779d28b827ea50dcbe00d09286f253d | ||
Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7 | ||
VYNFCKit: 86a9b711fd1f34f6f7128a2a883cd58dbd781b9d | ||
|
||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c | ||
|
||
COCOAPODS: 1.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,97 @@ | ||
import 'package:amazon_cognito_identity_dart_2/cognito.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_blue/flutter_blue.dart'; | ||
import './AccountMenu.dart'; | ||
|
||
class RegTempDevice extends StatelessWidget { | ||
class RegTempDevice extends StatefulWidget { | ||
final CognitoUserSession _session; | ||
|
||
RegTempDevice(this._session); | ||
|
||
@override | ||
_RegTempDeviceState createState() => _RegTempDeviceState(_session); | ||
} | ||
|
||
class _RegTempDeviceState extends State<RegTempDevice> { | ||
final CognitoUserSession _session; | ||
|
||
List<ScanResult> deviceList; | ||
|
||
_RegTempDeviceState(this._session); | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_scan(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
List<Widget> _widgets = []; | ||
|
||
if(deviceList == null) { | ||
deviceList = []; | ||
} | ||
for(var result in deviceList) { | ||
_widgets.add(Card( | ||
child: ListTile( | ||
title: Text(result.device.name), | ||
trailing: Icon(Icons.arrow_right), | ||
onTap: () => { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute(builder: (context) => AccountMenu(_session)) | ||
) | ||
}, | ||
), | ||
)); | ||
} | ||
|
||
var base = <Widget>[ | ||
ListTile(title: Text('検温デバイス設定')), | ||
Padding( | ||
padding: EdgeInsets.only(top: 10.0, right: 30.0, bottom: 10.0, left: 30.0), | ||
child: Text( | ||
'下に表示されるリストの中から、登録するデバイスを選択してください。' | ||
), | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(top: 10.0, right: 30.0, bottom: 10.0, left: 30.0), | ||
child: Text( | ||
'表示されない場合は、以下の2点をご確認ください。\n ・機器の電源が入っているか\n ・スマートフォンと機器を近づけているか' | ||
), | ||
), | ||
ListTile(title: Text('検出した検温デバイス一覧')), | ||
]; | ||
|
||
base.addAll(_widgets); | ||
|
||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('検温デバイス設定'), | ||
), | ||
body: ListView( | ||
children: <Widget>[ | ||
ListTile(title: Text('検温デバイス設定')), | ||
Padding( | ||
padding: EdgeInsets.only(top: 10.0, right: 30.0, bottom: 10.0, left: 30.0), | ||
child: Text( | ||
'下に表示されるリストの中から、登録するデバイスを選択してください。' | ||
), | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(top: 10.0, right: 30.0, bottom: 10.0, left: 30.0), | ||
child: Text( | ||
'表示されない場合は、以下の2点をご確認ください。\n ・機器の電源が入っているか\n ・スマートフォンと機器を近づけているか' | ||
), | ||
), | ||
ListTile(title: Text('検出した検温デバイス一覧')), | ||
Card( | ||
child: ListTile( | ||
title: Text('MAKURA Device'), | ||
trailing: Icon(Icons.arrow_right), | ||
onTap: () => { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute(builder: (context) => AccountMenu(_session)) | ||
) | ||
}, | ||
), | ||
), | ||
], | ||
children: base, | ||
) | ||
); | ||
} | ||
|
||
_scan() { | ||
FlutterBlue flutterBlue = FlutterBlue.instance; | ||
// Start scanning | ||
flutterBlue.startScan(timeout: Duration(seconds: 4)); | ||
|
||
// Listen to scan results | ||
flutterBlue.scanResults.listen((results) { | ||
// do something with scan results | ||
for (ScanResult r in results) { | ||
print('${r.device.name} found! rssi: ${r.rssi}'); | ||
} | ||
// deviceList = results; | ||
}); | ||
|
||
// Stop scanning | ||
flutterBlue.stopScan(); | ||
print('Scan stoped.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.