From 1905c750f266b6be3de1faa229d380fb90058d22 Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Tue, 30 Aug 2022 18:11:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/home/home_page.dart | 16 +++--- lib/ui/login/login_page.dart | 12 ++-- lib/ui/user/user_page.dart | 104 +++++++++++++++++++---------------- 3 files changed, 69 insertions(+), 63 deletions(-) diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 820128b..e453f8f 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -113,9 +113,9 @@ class _HomePageState extends State with WidgetsBindingObserver { child: GestureDetector( onTap: () { if(!(sms && plone && callLog && kg)){ - if(!kg){ + if(!(sms && plone && callLog )){ BotToast.showText(text: '功能开关未开启'); - Get.to(()=>const TabNavigator(index: 1,)); + // Get.to(()=>const TabNavigator(index: 1,)); }else{ Get.to(()=>const PrivacyRightsPage(name: "权限说明")); } @@ -125,8 +125,8 @@ class _HomePageState extends State with WidgetsBindingObserver { }, child: Container( - // width: 622.w, - margin: EdgeInsets.only(left:!kg? 200.w:64.w,right: 64.w), + width: 622.w, + margin: EdgeInsets.symmetric(horizontal: 64.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w), height: 88.w, decoration: BoxDecoration( @@ -142,17 +142,17 @@ class _HomePageState extends State with WidgetsBindingObserver { ), 16.wb, Text( - !kg ? "功能开关未开启":"必须权限没有授予,本APP无法正常使用", + !(sms && plone && callLog ) ? "必须权限没有授予,本APP无法正常使用":"功能开关未开启,请到我的页面开启", style: TextStyle(color: const Color(0xFFFF3F3F), fontSize: 24.sp), ), - 32.wb, - Image( + !(sms && plone && callLog ) ?32.wb: 0.wb, + !(sms && plone && callLog )? Image( image: AssetImage(Assets.icons.right.path), width: 28.w, height: 28.w, fit: BoxFit.fill, - ) + ):const SizedBox() ], ), ), diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index 0cd7e42..9108997 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -308,7 +308,8 @@ class _LoginPageState extends State { final TapGestureRecognizer recognizer = TapGestureRecognizer(); recognizer.onTap = () { if (kDebugMode) { - print("点击协议了"); + Get.to(()=>const ContentAuthorityPage()); + // print("点击协议了"); } ///跳转到用户协议页面 }; @@ -336,9 +337,7 @@ class _LoginPageState extends State { size: 18, color: Colors.blue), ), - GestureDetector(onTap: (){ - Get.to(()=>const ContentAuthorityPage()); - },child: RichText( + RichText( text: TextSpan( text: "我已阅读并同意", style: TextStyle( @@ -354,11 +353,10 @@ class _LoginPageState extends State { // color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp), // ), TextSpan( - text: '《隐私协议》', + text: '《短信帮手隐私协议》', style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp), recognizer: _recognizer(context, 1)), - ])),) - , + ])) ], ), ); diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index f72d0fb..4a72bad 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -45,12 +45,8 @@ class _UserPageState extends State { final userProvider = Provider.of(Get.context!, listen: false); bool isVip = false; String? endDate; - final service = FlutterBackgroundService(); - late bool vle = false; - - - + final service = FlutterBackgroundService(); final EasyRefreshController _easyRefreshController = EasyRefreshController(); @override @@ -59,33 +55,15 @@ class _UserPageState extends State { super.dispose(); } // _load() async { + // // print("123123131313131231231231231313123131232311313131231231"); // vle = await service.isRunning(); // } @override void initState() { super.initState(); - UserTool.userProvider.updateUserInfo(); - Future.delayed( - const Duration(milliseconds: 0), - () => setState(() async{ - if (UserTool.userProvider.isLogin) { - // print(UserTool.userProvider.userInfo.end * 1000); - // print(DateTime.now().millisecondsSinceEpoch); - if (UserTool.userProvider.userInfo.isVip != 1) { - isVip = false; - vle = false; - } else { - isVip = true; - vle = await service.isRunning(); - } - //service.isRunning() as bool; - endDate = DateUtil.formatDateMs( - UserTool.userProvider.userInfo.end * 1000, - format: DateFormats.y_mo_d); - } else { - vle = false; - } - })); + // _easyRefreshController.callRefresh(); + // UserTool.userProvider.updateUserInfo(); + } @override @@ -98,8 +76,34 @@ class _UserPageState extends State { path: Assets.images.bg.path, bodyColor: Colors.white, extendBody: true, - body: Column( + body: Expanded(child: Column( children: [ + Expanded( + child:EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + // _load(); + // await UserTool.userProvider.updateUserInfo(); + if (UserTool.userProvider.isLogin) { + // print(UserTool.userProvider.userInfo.end * 1000); + // print(DateTime.now().millisecondsSinceEpoch); + if (UserTool.userProvider.userInfo.isVip != 1) { + isVip = false; + vle = false; + } else { + isVip = true; + vle = await service.isRunning(); + } + //service.isRunning() as bool; + // endDate = DateUtil.formatDateMs( + // UserTool.userProvider.userInfo.end * 1000, + // format: DateFormats.y_mo_d); + } else { + vle = false; + } + setState(() {}); + },child:ListView(children: [ _getUser(), 72.hb, _getBanner(), @@ -112,25 +116,29 @@ class _UserPageState extends State { 182.hb, UserTool.userProvider.isLogin ? PloneBottom( - border: false, - onTap: () async { - var cancel = CloudToast.loading; - var base = await apiClient.request(API.app.logout, - showMessage: true); - if (base.code == 0) { - UserTool.userProvider.logout(); - Get.offAll(const TabNavigator()); - } - cancel(); - }, - textColor: const Color(0xFF1890FF), - color1: const Color(0xFFEBF5FF), - color2: const Color(0xFFEBF5FF), - text: "退出登录", - ) - : const SizedBox() - ], - ), + border: false, + onTap: () async { + var cancel = CloudToast.loading; + var base = await apiClient.request(API.app.logout, + showMessage: true); + if (base.code == 0) { + UserTool.userProvider.logout(); + Get.offAll(const TabNavigator()); + } + cancel(); + }, + textColor: const Color(0xFF1890FF), + color1: const Color(0xFFEBF5FF), + color2: const Color(0xFFEBF5FF), + text: "退出登录", + ) + : const SizedBox()],) ) + + + ),], + ),) + + ); } @@ -270,7 +278,7 @@ class _UserPageState extends State { _getVip(), 16.hb, Text( - isVip ? "$endDate到期" : "解锁全部功能", + isVip ? "${DateUtil.formatDateMs(UserTool.userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d)}到期" : "解锁全部功能", style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24), ) ],