Commit 211a0d84 authored by hywang's avatar hywang

1.修复扫描蓝牙设备异常

parent 446eab12
...@@ -44,13 +44,13 @@ class BleService extends GetxService { ...@@ -44,13 +44,13 @@ class BleService extends GetxService {
}); });
_scanResultsSubscription = FlutterBluePlus.scanResults.listen((results) { _scanResultsSubscription = FlutterBluePlus.scanResults.listen((results) {
List<ScanResult> tempList = List.from(results); // List<ScanResult> tempList = List.from(results);
for (var element in tempList) { // for (var element in tempList) {
if (!EmptyUtils.isStrNotEmpty(element.device.platformName)) { // if (!EmptyUtils.isStrNotEmpty(element.device.platformName)) {
tempList.remove(element); // tempList.remove(element);
} // }
} // }
scanResults.value = tempList; scanResults.value = results;
}, onError: (e) { }, onError: (e) {
DialogUtils.showToast('扫描错误'); DialogUtils.showToast('扫描错误');
}); });
......
...@@ -32,8 +32,8 @@ class SettingPage extends StatelessWidget { ...@@ -32,8 +32,8 @@ class SettingPage extends StatelessWidget {
itemCount: BleService.to.scanResults.length, itemCount: BleService.to.scanResults.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return ListTile( return ListTile(
title: Text(BleService.to.scanResults[index].device.advName), title: Text(BleService.to.scanResults[index].device.platformName),
subtitle: Text(BleService.to.scanResults[index].device.platformName), subtitle: Text(BleService.to.scanResults[index].device.remoteId.toString()),
onTap: ()=>{ onTap: ()=>{
logic.connectBle(context,index), logic.connectBle(context,index),
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment