更新
This commit is contained in:
@@ -694,9 +694,47 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
// Obx(() {
|
||||
// if (blueteethBindController
|
||||
// .model.betDevicelist!.isNotEmpty) {
|
||||
// return Expanded(
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// child: SingleChildScrollView(
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// ...blueteethBindController.model.blelist!
|
||||
// .map((device) {
|
||||
// return SingleBlueteethDeviceCompoentWidget(
|
||||
// // device: device,
|
||||
// bleDevice: device,
|
||||
// );
|
||||
// })
|
||||
// .toList()
|
||||
// .divide(SizedBox(height: 30.rpx))
|
||||
// .addToEnd(SizedBox(height: 30.rpx)),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// return Container();
|
||||
// }),
|
||||
Obx(() {
|
||||
if (blueteethBindController
|
||||
.model.betDevicelist!.isNotEmpty) {
|
||||
// 对 blelist 进行排序(按 rssi 降序)
|
||||
final sortedList = [
|
||||
...blueteethBindController.model.blelist!
|
||||
];
|
||||
sortedList.sort((a, b) {
|
||||
final rssiA = a.rssi ?? -999; // 防止空值
|
||||
final rssiB = b.rssi ?? -999;
|
||||
return rssiB.compareTo(rssiA); // rssi 大的排前面
|
||||
});
|
||||
|
||||
return Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
@@ -704,10 +742,9 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
...blueteethBindController.model.blelist!
|
||||
...sortedList
|
||||
.map((device) {
|
||||
return SingleBlueteethDeviceCompoentWidget(
|
||||
// device: device,
|
||||
bleDevice: device,
|
||||
);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user