From 77249274926fe7fd0939810ee1ccc1270c319aab Mon Sep 17 00:00:00 2001 From: WinUser01 Date: Mon, 20 Dec 2021 21:44:37 +0800 Subject: [PATCH] =?UTF-8?q?hyzp=5Fybqx-Commit042=EF=BC=9A=E5=9C=A8?= =?UTF-8?q?=E7=82=B9=E4=BD=8D=E4=BF=A1=E6=81=AF=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E5=AF=B9=20listDwspGetList2=20=E6=8C=89=20'i?= =?UTF-8?q?d'=20=E5=8F=B7=E6=8E=92=E5=BA=8F=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E7=82=B9=E4=BD=8D=E7=BC=96=E5=8F=B7=E4=B8=8D=E8=BF=9E=E7=BB=AD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/Works/DWSP/dwsp_getList.dart | 26 ++++++++++++++++++++++---- lib/pages/Works/SBGL/dwxx_getList.dart | 16 ++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/lib/pages/Works/DWSP/dwsp_getList.dart b/lib/pages/Works/DWSP/dwsp_getList.dart index 79fbfd0..0b4df50 100644 --- a/lib/pages/Works/DWSP/dwsp_getList.dart +++ b/lib/pages/Works/DWSP/dwsp_getList.dart @@ -49,11 +49,26 @@ class _DwspPageState extends State { //按照用户选择的_selectedValue、_descending对listDwspGetList2进行排序,并延时更新 // 在点位视频列表页面,解决点位编号不连续的问题 - int _len = listDwspGetList2.length; - for (int i = 0; i < _len; i++) { - listDwspGetList2[i]['dwbh'] = i + 1; + // int _len = listDwspGetList2.length; + // for (int i = 0; i < _len; i++) { + // listDwspGetList2[i]['dwbh'] = i + 1; + // } + + //print('listDwspGetList2 = $listDwspGetList2'); + // for (var item in listDwspGetList2) { + // print('item = $item'); + // } + + listDwspGetList2.sort((_left, _right) => _left['id'].compareTo(_right['id'])); // list排序 + for (var item in listDwspGetList2) { + print('item = $item'); } + // flutter dart list 排序 + // list.sort((_left,_right)=>_left.age.compare(_right.age)); + // 说明:age为年龄,按age排完序 需要降序的话,right.age.compare(_left.age)。 + // List.sort(),参数支持subtype(当然除bool)。 + _listSort(); firstIndex = 0; lastIndex = 7; @@ -144,8 +159,11 @@ class _DwspPageState extends State { //leading: new Icon(Icons.phone), contentPadding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 0), title: Text( - "${listDwspGetList2[indexRecord]['dwbh'].toString()}. ${listDwspGetList2[indexRecord]['dwmc']}", + "${listDwspGetList2[indexRecord]['id'].toString()}. ${listDwspGetList2[indexRecord]['dwmc']}", style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)), + // title: Text( + // "${listDwspGetList2[indexRecord]['dwbh'].toString()}. ${listDwspGetList2[indexRecord]['dwmc']}", + // style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)), // subtitle: Text( // 'dwIP:${listDwspGetList2[indexRecord]['dwip']},${listDwspGetList2[indexRecord]['dwzt']}', // style: TextStyle(fontSize: 10)), diff --git a/lib/pages/Works/SBGL/dwxx_getList.dart b/lib/pages/Works/SBGL/dwxx_getList.dart index 1ff3d85..f470493 100644 --- a/lib/pages/Works/SBGL/dwxx_getList.dart +++ b/lib/pages/Works/SBGL/dwxx_getList.dart @@ -55,9 +55,14 @@ class _SbglPageState extends State { listDwspGetList2 = listSbglGetList2; // 在点位视频列表页面,解决点位编号不连续的问题 - int _len = listDwspGetList2.length; - for (int i = 0; i < _len; i++) { - listDwspGetList2[i]['dwbh'] = i + 1; + // int _len = listDwspGetList2.length; + // for (int i = 0; i < _len; i++) { + // listDwspGetList2[i]['dwbh'] = i + 1; + // } + + listDwspGetList2.sort((_left, _right) => _left['id'].compareTo(_right['id'])); // list排序 + for (var item in listDwspGetList2) { + print('item = $item'); } listDwinfoGetList2 = listSbglGetList2; @@ -123,8 +128,11 @@ class _SbglPageState extends State { children: [ ListTile( //leading: new Icon(Icons.phone), + // title: Text( + // "${listSbglGetList2[indexRecord]['dwbh'].toString()}. ${listSbglGetList2[indexRecord]['dwmc']}", + // style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)), title: Text( - "${listSbglGetList2[indexRecord]['dwbh'].toString()}. ${listSbglGetList2[indexRecord]['dwmc']}", + "${listSbglGetList2[indexRecord]['id'].toString()}. ${listSbglGetList2[indexRecord]['dwmc']}", style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)), subtitle: Text( 'dwIP:${listSbglGetList2[indexRecord]['dwip']},${listSbglGetList2[indexRecord]['dwzt']}',