From 925673afa261042c1f85a8536179ec6d030b0f6b Mon Sep 17 00:00:00 2001 From: yuanjunyao <785570262@qq.com> Date: Thu, 30 Nov 2023 18:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/controllers/home_controller.dart | 16 +++---- lib/app/modules/home/views/home_view.dart | 48 ++++++++++--------- lib/app/shared/constants/styles.dart | 8 ++++ 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/lib/app/modules/home/controllers/home_controller.dart b/lib/app/modules/home/controllers/home_controller.dart index 408a6ae..2ccbe6e 100644 --- a/lib/app/modules/home/controllers/home_controller.dart +++ b/lib/app/modules/home/controllers/home_controller.dart @@ -71,12 +71,6 @@ class HomeController extends GetxController { occupationName = SpUtil.getString(Constant.occupationName).nullSafe; occupationId = SpUtil.getInt(Constant.occupationId, defValue: 2)!; create.value = SpUtil.getBool(Constant.create, defValue: true)!; - if (account.isEmpty) { - SchedulerBinding.instance.addPostFrameCallback((timeStamp) { - Get.offAllNamed(Routes.WELCOME); - }); - return; - } initLeftExploreApps(); initRightExploreApps(); initArtistGoals(); @@ -100,6 +94,11 @@ class HomeController extends GetxController { } }); } + if (account.isEmpty) { + SchedulerBinding.instance.addPostFrameCallback((timeStamp) { + Get.offAllNamed(Routes.WELCOME); + }); + } } @override @@ -117,8 +116,8 @@ class HomeController extends GetxController { Future explorePress() async { if (explored.value) { - availableApp.value = true; if (exploreTimer == null) { + availableApp.value = true; exploreTimer = Timer.periodic(repeatPeriod, (timer) { if (countTime <= 0) { explored.value = false; @@ -148,6 +147,7 @@ class HomeController extends GetxController { remainTime.value = countTime; }); } else { + availableApp.value = false; exploreTimer!.cancel(); exploreTimer = null; } @@ -223,7 +223,7 @@ class HomeController extends GetxController { 4.月亮的相位: • 观察月亮如何在一个月内从新月变为满月再回到新月。这些变化是由月亮围绕地球旋转,我们从地球上看到的月亮被太阳照亮的部分发生变化造成的。''')); knowledgePoints.add(KnowledgePoint( - id: 2, right: 751.0, top: 198.0, title: '中国历史:炎帝和皇帝', leared: false) + id: 2, right: 751.0, top: 198.0, title: '中国历史:炎帝和黄帝', leared: false) .obs); knowledgePointDialogues.add(KnowledgePointDialogue( kpId: 2, id: 0, isGpt: true, text: '''让我们来了解一下炎帝和黄帝,这两位是中国历史上非常重要的传说人物。 diff --git a/lib/app/modules/home/views/home_view.dart b/lib/app/modules/home/views/home_view.dart index c2bd95c..d297cc6 100644 --- a/lib/app/modules/home/views/home_view.dart +++ b/lib/app/modules/home/views/home_view.dart @@ -32,17 +32,11 @@ class HomeView extends GetView { child: Obx( () => Scaffold( backgroundColor: Colors.transparent, - body: AnimatedSwitcher( - duration: const Duration(milliseconds: 500), - child: KeyedSubtree( - key: ValueKey(controller.create.value), - child: controller.create.value - ? Center( - child: Images.homeCreate, - ) - : buildBody(context), - ), - ), + body: controller.create.value + ? Center( + child: Images.homeCreate, + ) + : buildBody(context), ), ), ), @@ -332,7 +326,7 @@ class HomeView extends GetView { child: Text( '科学竞赛参与', textAlign: TextAlign.center, - style: TextStyles.boldWhiteShadow12_111, + style: TextStyles.whiteShadow12_111, ), ), ), @@ -346,7 +340,7 @@ class HomeView extends GetView { child: Text( '英语能力加强', textAlign: TextAlign.center, - style: TextStyles.boldWhiteShadow12_111, + style: TextStyles.whiteShadow12_111, ), ), ), @@ -360,7 +354,7 @@ class HomeView extends GetView { child: Text( '拓展科学知识', textAlign: TextAlign.center, - style: TextStyles.boldWhiteShadow12_111, + style: TextStyles.whiteShadow12_111, ), ), ), @@ -400,7 +394,7 @@ class HomeView extends GetView { child: Text( '课外阅读提升', textAlign: TextAlign.center, - style: TextStyles.boldWhiteShadow12_111, + style: TextStyles.whiteShadow12_111, ), ), ), @@ -414,7 +408,7 @@ class HomeView extends GetView { child: Text( '科学兴趣培养', textAlign: TextAlign.center, - style: TextStyles.boldWhiteShadow12_111, + style: TextStyles.whiteShadow12_111, ), ), ), @@ -428,7 +422,7 @@ class HomeView extends GetView { child: Text( '基础教学能力', textAlign: TextAlign.center, - style: TextStyles.boldWhiteShadow12_111, + style: TextStyles.whiteShadow12_111, ), ), ), @@ -547,7 +541,8 @@ class HomeView extends GetView { right: 60.w, top: 346.h, child: AnimatedVisibilityWidget( - animationWidgetBuilder: AnimatedVisibilityWidget.fadeAnimationWidgetBuilder, + animationWidgetBuilder: + AnimatedVisibilityWidget.fadeAnimationWidgetBuilder, duration: const Duration(milliseconds: 800), isVisible: controller.explored2.value >= 1, child: Visibility( @@ -736,6 +731,7 @@ class HomeView extends GetView { } Widget exploreAppWidget(ExploreApp app) { + final imageId = 'home/${controller.availableApp.value ? app.icon : app.grayIcon}'; return GestureDetector( onTap: () { if (controller.availableApp.value) {} @@ -743,11 +739,17 @@ class HomeView extends GetView { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - LoadAssetImage( - 'home/${controller.availableApp.value ? app.icon : app.grayIcon}', - height: 74.w, - width: 74.w, - fit: BoxFit.fill, + AnimatedSwitcher( + duration: kThemeAnimationDuration * 2, + child: KeyedSubtree( + key: ValueKey(imageId), + child: LoadAssetImage( + imageId, + height: 74.w, + width: 74.w, + fit: BoxFit.fill, + ), + ), ), const RSizedBox(height: 2), Text( diff --git a/lib/app/shared/constants/styles.dart b/lib/app/shared/constants/styles.dart index 129b686..ecb5265 100644 --- a/lib/app/shared/constants/styles.dart +++ b/lib/app/shared/constants/styles.dart @@ -281,6 +281,12 @@ class TextStyles { shadows: [Shadows.txtShadow111], ); + static TextStyle whiteShadow12_111 = TextStyle( + fontSize: Dimens.font_sp12.sp, + color: Colors.white, + shadows: [Shadows.txtShadow111], + ); + static TextStyle boldWhiteShadow12_111 = TextStyle( fontSize: Dimens.font_sp12.sp, color: Colors.white, @@ -319,6 +325,8 @@ class TextStyles { static TextStyle mediumWhiteShadow12_111 = TextStyle( fontSize: Dimens.font_sp12.sp, color: Colors.white, + fontFamily: 'alph-b', + fontWeight: FontWeight.bold, shadows: [Shadows.txtShadow111], ); static TextStyle mediumWhite21_024 = TextStyle(