This commit is contained in:
wyf
2025-11-14 15:12:35 +08:00
parent 7e44998240
commit 18bd13a7b6
18 changed files with 431 additions and 112 deletions

View File

@@ -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,
);
})