From fa705507ba574c857b1667553737d23b1b7ff495 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 12 五月 2022 12:06:31 +0800
Subject: [PATCH] 后端模板代码优化

---
 src/main/resources/code/flutter_module/lib/ui/mine/settings.dart |   70 ++++++++++++++++-------------------
 1 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/src/main/resources/code/flutter_module/lib/ui/mine/settings.dart b/src/main/resources/code/flutter_module/lib/ui/mine/settings.dart
index 0e42acb..0de0a5c 100644
--- a/src/main/resources/code/flutter_module/lib/ui/mine/settings.dart
+++ b/src/main/resources/code/flutter_module/lib/ui/mine/settings.dart
@@ -57,7 +57,8 @@
 class _SettingPageState extends State<SettingPage>
     with SingleTickerProviderStateMixin {
   bool msg = false;
-  bool ad = false;
+  bool ad = true;
+  bool content = true;
   bool login = false;
 
   String cacheSize = "0B";
@@ -77,12 +78,20 @@
 
     SettingUtil.isEnablePush().then((value) {
       setState(() {
-        msg = value;
+        msg = value!;
       });
     });
 
     SettingUtil.isEnableRecommendAd().then((value) {
-      ad = value;
+      setState(() {
+        ad = value!;
+      });
+    });
+
+    SettingUtil.isEnableRecommendContent().then((value) {
+      setState(() {
+        content = value!;
+      });
     });
   }
 
@@ -125,7 +134,6 @@
         UserUtil.getUid();
         // popPage(context);
       });
-
     } else {
       ToastUtil.toast(map["msg"], context);
     }
@@ -141,7 +149,7 @@
             TopNavBar(title: "璁剧疆"),
             getBigItemView(
                 title: "鎺ㄩ�佸厤鎵撴壈",
-                content: "鍏抽棴鍚庯紝21:00-09:00涓嶆帴鍙椾换浣曟帹閫�",
+                content: "寮�鍚悗锛�21:00-9:00涓嶆帴鍙椾换浣曟帹閫�",
                 marginTop: 14,
                 marginBottom: 1,
                 checked: msg,
@@ -149,6 +157,19 @@
                   SettingUtil.setPush(value).then((value1) {
                     setState(() {
                       msg = value;
+                    });
+                  });
+                }),
+            getBigItemView(
+                title: "涓�у寲鍐呭鎺ㄨ崘",
+                content: "鍏抽棴鍚庯紝鍐呭鏁伴噺灏嗕笉鍙橈紝浣嗗唴瀹圭浉鍏冲害浼氶檷浣�",
+                marginTop: 0,
+                marginBottom: 1,
+                checked: content,
+                changed: (bool value) {
+                  SettingUtil.setRecommendContent(value).then((value1) {
+                    setState(() {
+                      content = value;
                     });
                   });
                 }),
@@ -166,36 +187,6 @@
                   });
                 }),
             getCommonItemView(
-                title: "娓呯悊缂撳瓨",
-                content: cacheSize,
-                onClick: () {
-                  showCupertinoDialog(
-                      context: context,
-                      builder: (context) {
-                        return AlertDialog(
-                          title: const Text("鏄惁娓呮缂撳瓨"),
-                          actions: <Widget>[
-                            TextButton(
-                              child: const Text('鍙栨秷'),
-                              onPressed: () {
-                                Navigator.of(context).pop();
-                              },
-                            ),
-                            TextButton(
-                              child: const Text('纭畾'),
-                              onPressed: () {
-                                CacheUtil.clear().then((value) {
-                                  ToastUtil.toast("缂撳瓨娓呴櫎鎴愬姛", context);
-                                  _getCacheSize();
-                                });
-                                Navigator.of(context).pop();
-                              },
-                            ),
-                          ],
-                        );
-                      });
-                }),
-            getCommonItemView(
                 title: "妫�鏌ユ洿鏂�",
                 content: "鐗堟湰鍙凤細$version",
                 onClick: () {
@@ -205,8 +196,9 @@
                 title: "璐︽埛娉ㄩ攢",
                 content: "",
                 onClick: () {
-
-    MySharedPreferences.getInstance().getString("unRegisterLink").then((value) {
+                  MySharedPreferences.getInstance()
+                      .getString("unRegisterLink")
+                      .then((value) {
                     if (!StringUtil.isNullOrEmpty(value)) {
                       NavigatorUtil.navigateToNextPage(context,
                           BrowserPage(title: "璐︽埛娉ㄩ攢", url: value!), (data) {});
@@ -217,7 +209,9 @@
                 title: "闅愮鎶曡瘔",
                 content: "",
                 onClick: () {
-    MySharedPreferences.getInstance().getString("feedBackLink").then((value) {
+                  MySharedPreferences.getInstance()
+                      .getString("feedBackLink")
+                      .then((value) {
                     if (!StringUtil.isNullOrEmpty(value)) {
                       NavigatorUtil.navigateToNextPage(context,
                           BrowserPage(title: "闅愮鎶曡瘔", url: value!), (data) {});

--
Gitblit v1.8.0