소스 검색

每次进入我的页面都关闭扫描打印机按钮

daxu0403 7 년 전
부모
커밋
9074346243
1개의 변경된 파일19개의 추가작업 그리고 18개의 파일을 삭제
  1. 19 18
      lib/pages/my_page.dart

+ 19 - 18
lib/pages/my_page.dart

@@ -89,23 +89,23 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
     bluetooth.getEchannel().receiveBroadcastStream().listen(onEvent, onError: onError);
     bluetooth.isEnableBluetooth().then((value){//如果蓝牙打开的情况下去拿缓存的蓝牙相关数据
        if(value){
-          getKey('check').then((value) {
-            if (value == null) {
-              setState(() {
-                check = false;
-              });
-            } else if (value == 'false') {
-              setState(() {
-                check = false;
-              });
-            } else if (value == 'true') {
-              setState(() {
-                check = true;
-              });
-            }
-          });
+          // getKey('check').then((value) {
+          //   if (value == null) {
+          //     setState(() {
+          //       check = false;
+          //     });
+          //   } else if (value == 'false') {
+          //     setState(() {
+          //       check = false;
+          //     });
+          //   } else if (value == 'true') {
+          //     setState(() {
+          //       check = true;
+          //     });
+          //   }
+          // });
           getKey('btList').then((value) {
-            if (value != '' && check == true) {
+            //if (value != '') {
               List tempList = [];
               for (int i = 0; i < 999; i++) {
                 if (value.indexOf('&') != -1) {
@@ -129,7 +129,7 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
                   });
                 }
               });
-            }
+            //}
           });
        }
       });
@@ -462,6 +462,7 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
                                     btLinkStatus = false;
                                   });
                                   setKey('check', 'true');
+                                  setKey('checkedBt','');
                                   bluetooth.scanBT(); //
                               });
                             });
@@ -541,7 +542,7 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
   Widget _btList() {
     return Container(
       padding: EdgeInsets.all(ScreenUtil.getInstance().setHeight(30)),
-      child: (btList.length > 0 && check == true) ? ListView.builder(
+      child: (btList.length > 0) ? ListView.builder(
         itemCount: btList.length,
         itemBuilder: (BuildContext context, int index) {
           return _btItem(btList[index], index);