huxiaoqiang 4 年 前
コミット
a7fe495756

+ 20 - 0
images/svg/失败.svg

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="95px" height="95px" viewBox="0 0 95 95" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 54.1 (76490) - https://sketchapp.com -->
+    <title>失败</title>
+    <desc>Created with Sketch.</desc>
+    <defs>
+        <polygon id="path-1" points="0 0.374346296 93.6287736 0.374346296 93.6287736 94.2037037 0 94.2037037"></polygon>
+    </defs>
+    <g id="失败" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="编组" transform="translate(1.000000, 0.000000)">
+            <mask id="mask-2" fill="white">
+                <use xlink:href="#path-1"></use>
+            </mask>
+            <g id="Clip-2"></g>
+            <path d="M46.8147453,94.2038833 L46.8147453,94.2038833 C20.9604057,94.2038833 -0.000537735849,73.1997907 -0.000537735849,47.290013 L-0.000537735849,47.2882167 C-0.000537735849,21.3784389 20.9604057,0.374346296 46.8147453,0.374346296 C72.6690849,0.374346296 93.6300283,21.3784389 93.6300283,47.2882167 L93.6300283,47.290013 C93.6300283,73.1997907 72.6690849,94.2038833 46.8147453,94.2038833" id="Fill-1" fill="#FF4233" mask="url(#mask-2)"></path>
+        </g>
+        <path d="M28.2841792,66.8612 L28.2841792,66.8612 C27.0079528,65.582237 27.0079528,63.5093111 28.2841792,62.2303481 L62.7243679,27.7163111 C64.0005943,26.4373481 66.0690849,26.4373481 67.3453113,27.7163111 C68.6197453,28.9952741 68.6197453,31.0682 67.3453113,32.347163 L32.9051226,66.8612 C31.6288962,68.140163 29.5604057,68.140163 28.2841792,66.8612" id="Fill-3" fill="#FFFFFF"></path>
+        <path d="M67.3453113,66.8612 L67.3453113,66.8612 C66.0690849,68.140163 64.0005943,68.140163 62.7243679,66.8612 L28.2841792,32.347163 C27.0079528,31.0682 27.0079528,28.9952741 28.2841792,27.7163111 C29.5604057,26.4373481 31.6288962,26.4373481 32.9051226,27.7163111 L67.3453113,62.2303481 C68.6197453,63.5093111 68.6197453,65.582237 67.3453113,66.8612" id="Fill-5" fill="#FFFFFF"></path>
+    </g>
+</svg>

+ 22 - 0
images/svg/成功.svg

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="95px" height="95px" viewBox="0 0 95 95" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 54.1 (76490) - https://sketchapp.com -->
+    <title>成功</title>
+    <desc>Created with Sketch.</desc>
+    <defs>
+        <polygon id="path-1" points="0 0.375244444 93.6287736 0.375244444 93.6287736 94.2029852 0 94.2029852"></polygon>
+    </defs>
+    <g id="成功" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <path d="M46.2056604,53.7220111 L46.2056604,53.7220111 C44.4006604,53.7220111 42.9380189,52.2580296 42.9380189,50.4491593 L42.9380189,20.2947333 C42.9380189,18.485863 44.4006604,17.0182889 46.2056604,17.0182889 C48.0106604,17.0182889 49.4733019,18.485863 49.4733019,20.2947333 L49.4733019,50.4491593 C49.4733019,52.2580296 48.0106604,53.7220111 46.2056604,53.7220111" id="Fill-3" fill="#FFFFFF"></path>
+        <path d="M43.0873302,50.4486204 L43.0873302,50.4486204 C43.0873302,48.63975 44.5499717,47.1739722 46.3549717,47.1739722 L72.6663868,47.1739722 C74.4695943,47.1739722 75.9340283,48.63975 75.9340283,50.4486204 C75.9340283,52.2574907 74.4695943,53.7214722 72.6663868,53.7214722 L46.3549717,53.7214722 C44.5499717,53.7214722 43.0873302,52.2574907 43.0873302,50.4486204" id="Fill-5" fill="#FFFFFF"></path>
+        <g id="编组" transform="translate(1.000000, 0.000000)">
+            <mask id="mask-2" fill="white">
+                <use xlink:href="#path-1"></use>
+            </mask>
+            <g id="Clip-2"></g>
+            <path d="M46.8147453,94.2029852 L46.8147453,94.2029852 C20.9604057,94.2029852 -0.000537735849,73.2006889 -0.000537735849,47.2891148 C-0.000537735849,21.3775407 20.9604057,0.375244444 46.8147453,0.375244444 C72.6690849,0.375244444 93.6300283,21.3775407 93.6300283,47.2891148 C93.6300283,73.2006889 72.6690849,94.2029852 46.8147453,94.2029852" id="Fill-1" fill="#FF4233" mask="url(#mask-2)"></path>
+        </g>
+        <path d="M39.4721321,62.6046963 L39.4721321,62.6046963 C40.7483585,63.8836593 42.8168491,63.8836593 44.0930755,62.6046963 L70.0370377,36.6033074 C71.3132642,35.3243444 71.3132642,33.2514185 70.0370377,31.9724556 C68.7608113,30.6934926 66.6941132,30.6934926 65.4178868,31.9724556 L39.4721321,57.9738444 C38.1959057,59.2528074 38.1959057,61.3257333 39.4721321,62.6046963" id="Fill-3" fill="#FFFFFF"></path>
+        <path d="M43.9875,62.4994333 L43.9875,62.4994333 C45.261934,61.2204704 45.261934,59.1475444 43.9875,57.8685815 L30.2107075,44.0640444 C28.9362736,42.7850815 26.867783,42.7850815 25.5915566,44.0640444 C24.3153302,45.3412111 24.3153302,47.4159333 25.5915566,48.6931 L39.3665566,62.4994333 C40.642783,63.7783963 42.7112736,63.7783963 43.9875,62.4994333" id="Fill-5" fill="#FFFFFF"></path>
+    </g>
+</svg>

+ 13 - 0
images/svg/等待.svg

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="95px" height="95px" viewBox="0 0 95 95" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 54.1 (76490) - https://sketchapp.com -->
+    <title>等待</title>
+    <desc>Created with Sketch.</desc>
+    <g id="等待" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="编组" fill="#FF4233">
+            <path d="M47.8143868,94.2035241 L47.8143868,94.2035241 C21.9600472,94.2035241 0.999103774,73.1994315 0.999103774,47.2896537 C0.999103774,21.3780796 21.9600472,0.373987037 47.8143868,0.373987037 C73.6687264,0.373987037 94.6296698,21.3780796 94.6296698,47.2896537 C94.6296698,73.1994315 73.6687264,94.2035241 47.8143868,94.2035241" id="Fill-1"></path>
+        </g>
+        <path d="M46.2056604,53.7220111 L46.2056604,53.7220111 C44.4006604,53.7220111 42.9380189,52.2580296 42.9380189,50.4491593 L42.9380189,20.2947333 C42.9380189,18.485863 44.4006604,17.0182889 46.2056604,17.0182889 C48.0106604,17.0182889 49.4733019,18.485863 49.4733019,20.2947333 L49.4733019,50.4491593 C49.4733019,52.2580296 48.0106604,53.7220111 46.2056604,53.7220111" id="Fill-3" fill="#FFFFFF"></path>
+        <path d="M43.0873302,50.4486204 L43.0873302,50.4486204 C43.0873302,48.63975 44.5499717,47.1739722 46.3549717,47.1739722 L72.6663868,47.1739722 C74.4695943,47.1739722 75.9340283,48.63975 75.9340283,50.4486204 C75.9340283,52.2574907 74.4695943,53.7214722 72.6663868,53.7214722 L46.3549717,53.7214722 C44.5499717,53.7214722 43.0873302,52.2574907 43.0873302,50.4486204" id="Fill-5" fill="#FFFFFF"></path>
+    </g>
+</svg>

+ 5 - 4
lib/main.dart

@@ -110,18 +110,19 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
     WidgetsBinding.instance.addObserver(this);
     WidgetsBinding.instance.addObserver(this);
     MyCookie().initP();
     MyCookie().initP();
     EventBus().on('hasNewOrder', (arg) {
     EventBus().on('hasNewOrder', (arg) {
-      print('fnlasnfiansfinasfnoasnfi---------1');
       newOrder = arg;
       newOrder = arg;
       displayPendingOrders();
       displayPendingOrders();
     });
     });
     EventBus().on('systemInformation', (arg) {
     EventBus().on('systemInformation', (arg) {
-      print('systemInformationasdasdasd');
       if (arg is SystemInformationBeanEntity) {
       if (arg is SystemInformationBeanEntity) {
-        print(
-            'systemInformationasdasdasdcccccccccccccccccccccccccccccccccccccccc');
         showSystemMessages(arg);
         showSystemMessages(arg);
       }
       }
     });
     });
+    EventBus().on('检查粘贴板', (arg) {
+      Timer(Duration(seconds: 1), () {
+        getClipboardData();
+      });
+    });
     return super.createElement();
     return super.createElement();
   }
   }
 
 

+ 1 - 0
lib/my_tools/const.dart

@@ -39,6 +39,7 @@ int orderStatePaid = 1; //已支付
 int orderStatePaying = 2; //支付中
 int orderStatePaying = 2; //支付中
 int orderStatePayFailed = 3; //支付失败
 int orderStatePayFailed = 3; //支付失败
 int orderStateOtherPaid = 4; //已代付
 int orderStateOtherPaid = 4; //已代付
+int orderStateRevoked   = 5; //已取消
 
 
 //订单类型
 //订单类型
 int orderTypeCommodity = 0; //商品
 int orderTypeCommodity = 0; //商品

+ 2 - 2
lib/my_tools/my_cookie.dart

@@ -56,7 +56,7 @@ class MyCookie {
     loginInformation = loginInformationBeanEntity;
     loginInformation = loginInformationBeanEntity;
   }
   }
 
 
-  getLoginInformation() {
+  LoginInformationBeanEntity getLoginInformation() {
     if (loginInformation == null) {
     if (loginInformation == null) {
       try {
       try {
         loginInformation = LoginInformationBeanEntity().fromJson(
         loginInformation = LoginInformationBeanEntity().fromJson(
@@ -74,7 +74,7 @@ class MyCookie {
     return loginInformation.data.user;
     return loginInformation.data.user;
   }
   }
 
 
-  getToken() {
+  String getToken() {
     return loginInformation.data.token;
     return loginInformation.data.token;
   }
   }
 
 

+ 191 - 0
lib/paegs/alipay_page/alipay_page.dart

@@ -0,0 +1,191 @@
+import 'dart:async';
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:bbyyy/beans/alipay_result_bean_entity.dart';
+import 'package:bbyyy/beans/pay_by_alipay_bean_entity.dart';
+import 'package:bbyyy/beans/smart_order_bean_entity.dart';
+import 'package:bbyyy/https/MyDio.dart';
+import 'package:bbyyy/https/my_request.dart';
+import 'package:bbyyy/my_tools/const.dart';
+import 'package:bbyyy/my_tools/dims.dart';
+import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
+import 'package:bbyyy/my_tools/event_bus.dart';
+import 'package:bbyyy/my_tools/my_colors.dart';
+import 'package:bbyyy/my_tools/my_cookie.dart';
+import 'package:bbyyy/my_tools/my_tools.dart';
+import 'package:bbyyy/my_tools/my_views.dart';
+import 'package:bbyyy/pay/pay_tools.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+import 'package:tobias/tobias.dart';
+
+class AlipayPage extends StatefulWidget {
+  int orderUID;
+
+  AlipayPage(this.orderUID);
+
+  @override
+  _AlipayPageState createState() => _AlipayPageState();
+}
+
+class _AlipayPageState extends State<AlipayPage> with WidgetsBindingObserver {
+  var titles = ['正在支付', '支付成功', '支付失败'];
+  var icons = ['images/svg/等待.svg', 'images/svg/成功.svg', 'images/svg/失败.svg'];
+  var content = ['正在支付,请稍后…', '支付成功,即将自动跳转…', '支付失败'];
+  int status = 0;
+
+  @override
+  void initState() {
+    super.initState();
+    WidgetsBinding.instance.addObserver(this);
+    Future.delayed(Duration(seconds: 1), () {
+      pay();
+    });
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      backgroundColor: Colors.white,
+      body: Column(
+        children: [
+          MyViews().myAppBar(titles[status], context, []),
+          Expanded(
+            child: Center(
+              child: Column(
+                children: [
+                  Container(
+                    height: 10,
+                    color: MyColors.cF7F7F7,
+                  ),
+                  Expanded(
+                    child: Column(
+                      children: [
+                        SvgPicture.asset(
+                          icons[status],
+                          height: 94,
+                          width: 94,
+                        ),
+                        Container(
+                          margin: EdgeInsets.only(top: 30),
+                          child: Text(
+                            content[status],
+                            style: TextStyle(
+                                color: MyColors.c666666, fontSize: 15),
+                          ),
+                        ),
+                      ],
+                      mainAxisAlignment: MainAxisAlignment.center,
+                    ),
+                  ),
+                  Expanded(child: Container()),
+                ],
+              ),
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+
+  pay() {
+    payOrder(payWayAliPay, widget.orderUID, (re, hE) {
+      if (!hE) {
+        PayByAlipayBeanEntity entity =
+            PayByAlipayBeanEntity().fromJson(json.decode(re.data.toString()));
+        EventBus().on('alipayPaymentCallback', (arg) {
+          EventBus().off('alipayPaymentCallback');
+          EasyLoading.dismiss();
+          showToast('支付成功');
+          EventBus().emit('reNoPayOrder');
+          // Navigator.pop(context);
+        });
+        print(entity.data);
+        EasyLoading.instance
+          ..contentPadding = EdgeInsets.symmetric(horizontal: 20, vertical: 12)
+          ..alignment = Alignment.center
+          ..loadingStyle = EasyLoadingStyle.light
+          ..contentMargin = EdgeInsets.all(20);
+        EasyLoading.show();
+        aliPay(entity.data).then((value) {
+          print(json.encode(value));
+          AlipayResultBeanEntity e = AlipayResultBeanEntity()
+              .fromJson(json.decode(json.encode(value)));
+          try {
+            int r = int.parse(e.resultStatus);
+            if (r == 9000) {
+              showToast('支付成功');
+              // Navigator.pop(context);
+              setState(() {
+                status = 1;
+              });
+            } else {
+              showToast(aliPayResultStatus(r));
+              revokePayOrder(widget.orderUID);
+              setState(() {
+                status = 2;
+              });
+            }
+          } catch (e) {
+            EasyLoading.dismiss();
+          }
+        });
+      }
+    }, (e) {}, context);
+  }
+
+  @override
+  void didChangeAppLifecycleState(AppLifecycleState state) {
+    super.didChangeAppLifecycleState(state);
+    if (state == AppLifecycleState.paused) {
+      print('AlipayPage went to Background');
+      count = 0;
+      status = 0;
+      setState(() {});
+    }
+    if (state == AppLifecycleState.resumed) {
+      print('AlipayPage came back to Foreground');
+      if(Platform.isIOS){
+        count = 10;
+        checkIfTheOrderIsPaid();
+      }
+    }
+  }
+
+  int count = 0;
+
+  void checkIfTheOrderIsPaid() {
+    MyDio().query({
+      "key": "order",
+      "filters": {
+        "conditions": ["uid == ${widget.orderUID}"]
+      },
+      "dims": orderDims,
+      "paging": [1, 1]
+    }, (response, hasError) {
+      if (!hasError) {
+        SmartOrderBeanEntity entity = SmartOrderBeanEntity()
+            .fromJson(json.decode(response.data.toString()));
+        if (entity.data.data[0].state == orderStatePaid) {
+          status = 1;
+          setState(() {});
+          // Timer(Duration(seconds: 1), () {
+          //   Navigator.pop(context, '支付成功');
+          // });
+        } else {
+          if (count != 0) {
+            Timer(Duration(seconds: 1), () {
+              count--;
+              checkIfTheOrderIsPaid();
+            });
+          } else {
+            count = 10;
+            status = 2;
+            setState(() {});
+          }
+        }
+      }
+    }, (error) {});
+  }
+}

+ 23 - 57
lib/paegs/gang_page/gang_in_page/pay_to_the_helper_page/pay_to_the_helper_page.dart

@@ -2,6 +2,7 @@ import 'dart:convert';
 
 
 import 'package:bbyyy/beans/alipay_result_bean_entity.dart';
 import 'package:bbyyy/beans/alipay_result_bean_entity.dart';
 import 'package:bbyyy/beans/my_shop_bean_entity.dart';
 import 'package:bbyyy/beans/my_shop_bean_entity.dart';
+import 'package:bbyyy/beans/offline_payment_bean_entity.dart';
 import 'package:bbyyy/beans/pay_by_alipay_bean_entity.dart';
 import 'package:bbyyy/beans/pay_by_alipay_bean_entity.dart';
 import 'package:bbyyy/beans/store_bean_entity.dart';
 import 'package:bbyyy/beans/store_bean_entity.dart';
 import 'package:bbyyy/beans/user_balance_entity.dart';
 import 'package:bbyyy/beans/user_balance_entity.dart';
@@ -16,10 +17,10 @@ import 'package:bbyyy/my_tools/my_colors.dart';
 import 'package:bbyyy/my_tools/my_cookie.dart';
 import 'package:bbyyy/my_tools/my_cookie.dart';
 import 'package:bbyyy/my_tools/my_tools.dart';
 import 'package:bbyyy/my_tools/my_tools.dart';
 import 'package:bbyyy/my_tools/my_views.dart';
 import 'package:bbyyy/my_tools/my_views.dart';
+import 'package:bbyyy/paegs/alipay_page/alipay_page.dart';
 import 'package:bbyyy/pay/pay_tools.dart';
 import 'package:bbyyy/pay/pay_tools.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter/services.dart';
-import 'package:bbyyy/beans/offline_payment_bean_entity.dart';
 import 'package:tobias/tobias.dart';
 import 'package:tobias/tobias.dart';
 
 
 class PayToTheHelperPage extends StatefulWidget {
 class PayToTheHelperPage extends StatefulWidget {
@@ -118,7 +119,8 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
                                       fontWeight: FontWeight.bold,
                                       fontWeight: FontWeight.bold,
                                       height: 1.3,
                                       height: 1.3,
                                       letterSpacing: 0.2),
                                       letterSpacing: 0.2),
-                                  keyboardType: TextInputType.numberWithOptions(decimal: true),
+                                  keyboardType: TextInputType.numberWithOptions(
+                                      decimal: true),
                                   onChanged: (t) {
                                   onChanged: (t) {
                                     setState(() {});
                                     setState(() {});
                                   },
                                   },
@@ -178,7 +180,8 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
         }
         }
       }, (response, hasError) {
       }, (response, hasError) {
         if (!hasError) {
         if (!hasError) {
-          OfflinePaymentBeanEntity entity = OfflinePaymentBeanEntity().fromJson(json.decode(response.data.toString()));
+          OfflinePaymentBeanEntity entity = OfflinePaymentBeanEntity()
+              .fromJson(json.decode(response.data.toString()));
           payTheOrder(entity.data);
           payTheOrder(entity.data);
         }
         }
       }, (error) {});
       }, (error) {});
@@ -210,62 +213,25 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
   void payTheOrder(int orderUID) {
   void payTheOrder(int orderUID) {
     getUserWalletBalance((re, hE) {
     getUserWalletBalance((re, hE) {
       if (!hE) {
       if (!hE) {
-        UserBalanceEntity balance = UserBalanceEntity()
-            .fromJson(json.decode(re.data.toString()));
+        UserBalanceEntity balance =
+            UserBalanceEntity().fromJson(json.decode(re.data.toString()));
         if (balance.data >= amount) {
         if (balance.data >= amount) {
-          payOrder(payWayWallet, orderUID,
-                  (re, hE) {
-                if (!hE) {
-                  showToast('支付成功');
-                  EventBus().emit('payAnOrder');
-                  Navigator.pop(context);
-                }
-              }, (e) {}, context);
+          payOrder(payWayWallet, orderUID, (re, hE) {
+            if (!hE) {
+              showToast('支付成功');
+              EventBus().emit('payAnOrder');
+              Navigator.pop(context);
+            }
+          }, (e) {}, context);
         } else {
         } else {
-          payOrder(payWayAliPay, orderUID,
-                  (re, hE) {
-                if (!hE) {
-                  PayByAlipayBeanEntity entity =
-                  PayByAlipayBeanEntity().fromJson(
-                      json.decode(re.data.toString()));
-                  EventBus().on('alipayPaymentCallback',
-                          (arg) {
-                        EventBus().off('alipayPaymentCallback');
-                        EasyLoading.dismiss();
-                        showToast('支付成功');
-                        EventBus().emit('reNoPayOrder');
-                        Navigator.pop(context);
-                      });
-                  print(entity.data);
-                  EasyLoading.instance
-                    ..contentPadding = EdgeInsets.symmetric(
-                        horizontal: 20, vertical: 12)
-                    ..alignment = Alignment.center
-                    ..loadingStyle = EasyLoadingStyle.light
-                    ..contentMargin = EdgeInsets.all(20);
-                  EasyLoading.show();
-                  aliPay(entity.data).then((value) {
-                    print(json.encode(value));
-                    AlipayResultBeanEntity e =
-                    AlipayResultBeanEntity().fromJson(
-                        json.decode(json.encode(value)));
-                    try {
-                      int r = int.parse(e.resultStatus);
-                      if (r == 9000) {
-                        showToast('支付成功');
-                        Navigator.pop(context);
-                      } else {
-                        showToast(aliPayResultStatus(r));
-                        revokePayOrder(orderUID);
-                      }
-                    } catch (e) {
-                      EasyLoading.dismiss();
-                    }
-                  });
-                  // EventBus().emit('payAnOrder');
-                }
-              }, (e) {}, context);
-          // showToast('积分余额不足');
+          _controller.clear();
+          MyTools().toPage(context, AlipayPage(orderUID), (then){
+            if(then is String){
+              if(then == '支付成功'){
+                Navigator.pop(context);
+              }
+            }
+          });
         }
         }
       }
       }
     }, (e) {}, context);
     }, (e) {}, context);

+ 1 - 0
lib/paegs/root_page/root_page.dart

@@ -46,6 +46,7 @@ class _RootPageState extends State<RootPage> {
       // 服务端返回uid
       // 服务端返回uid
       hostname: '主机名', // 服务端返回
       hostname: '主机名', // 服务端返回
     );
     );
+    EventBus().emit('检查粘贴板');
     EventBus().on('ChangePage', (arg) {
     EventBus().on('ChangePage', (arg) {
       if (RootPageView().bNIndex == 3) {
       if (RootPageView().bNIndex == 3) {
         queryPersonalInformation();
         queryPersonalInformation();

+ 4 - 2
lib/paegs/welcome_page/welcome_page.dart

@@ -30,10 +30,12 @@ class _WelcomePageState extends State<WelcomePage> {
       ..contentPadding = EdgeInsets.fromLTRB(20, 12, 20, 12)
       ..contentPadding = EdgeInsets.fromLTRB(20, 12, 20, 12)
       ..userInteractions = false;
       ..userInteractions = false;
     Timer(Duration(seconds: 1), () {
     Timer(Duration(seconds: 1), () {
-      if (MyCookie().getLoginInformation() == null) {
+      if (MyCookie().getLoginInformation() == null ||
+          MyCookie().getLoginInformation().data == null ||
+          MyCookie().getLoginInformation().data.token.isEmpty ||
+          MyCookie().getLoginInformation().data.token == '') {
         MyTools().toPage(context, LoginPage(), (then) {}, noBack: true);
         MyTools().toPage(context, LoginPage(), (then) {}, noBack: true);
       } else {
       } else {
-        // MyTools().toPage(context, RootPage(), (then){},noBack: true);
         checkLogin((r, hE) {
         checkLogin((r, hE) {
           if (!hE) {
           if (!hE) {
             MyTools().toPage(context, RootPage(), (then) {}, noBack: true);
             MyTools().toPage(context, RootPage(), (then) {}, noBack: true);