diff --git a/assets/images/home/pic_avatar_academician_female .jpg b/assets/images/home/pic_avatar_academician_female.jpg similarity index 100% rename from assets/images/home/pic_avatar_academician_female .jpg rename to assets/images/home/pic_avatar_academician_female.jpg diff --git a/lib/app/modules/home/controllers/home_controller.dart b/lib/app/modules/home/controllers/home_controller.dart index aab5b3f..408a6ae 100644 --- a/lib/app/modules/home/controllers/home_controller.dart +++ b/lib/app/modules/home/controllers/home_controller.dart @@ -71,6 +71,12 @@ 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(); @@ -572,11 +578,15 @@ class HomeController extends GetxController { await Future.delayed(const Duration(seconds: 1)); - var knowledgePointDialogue = knowledgePointDialogues.firstWhere((t) => + var knowledgePointDialogue = knowledgePointDialogues.firstWhereOrNull((t) => t!.kpId == selectKnowledge.value!.id && t.id == sendCount && t.isGpt!); + + if (knowledgePointDialogue == null) { + return; + } chatMsg = ChatMsg( id: Guid.newGuid.toString(), - text: knowledgePointDialogue!.text, + text: knowledgePointDialogue.text, isBot: 1, knowledgeId: selectKnowledge.value!.id, ); diff --git a/lib/app/modules/home/views/home_view.dart b/lib/app/modules/home/views/home_view.dart index c8a6410..c2bd95c 100644 --- a/lib/app/modules/home/views/home_view.dart +++ b/lib/app/modules/home/views/home_view.dart @@ -550,8 +550,11 @@ class HomeView extends GetView { animationWidgetBuilder: AnimatedVisibilityWidget.fadeAnimationWidgetBuilder, duration: const Duration(milliseconds: 800), isVisible: controller.explored2.value >= 1, - child: const LanternWidget( - brightCount: 0, + child: Visibility( + visible: controller.explored2.value >= 1, + child: const LanternWidget( + brightCount: 0, + ), ), ), ), diff --git a/lib/app/modules/home/widgets/lantern_widget.dart b/lib/app/modules/home/widgets/lantern_widget.dart index 20b621b..993b620 100644 --- a/lib/app/modules/home/widgets/lantern_widget.dart +++ b/lib/app/modules/home/widgets/lantern_widget.dart @@ -12,33 +12,36 @@ class LanternWidget extends GetView { @override Widget build(BuildContext context) { - return Container( - height: 90.h, - width: 180.w, - decoration: const BoxDecoration( - image: DecorationImage( - image: Images.homeLantern, - fit: BoxFit.fill, + return ShowUp( + duration: const Duration(seconds: 2), + child: Container( + height: 90.h, + width: 180.w, + decoration: const BoxDecoration( + image: DecorationImage( + image: Images.homeLantern, + fit: BoxFit.fill, + ), + ), + child: Stack( + clipBehavior: Clip.none, + children: [ + brightCount! >= 1 + ? Positioned( + left: -9.w, + top: 36.h, + child: Images.homeLanternBright, + ) + : Container(), + brightCount! >= 2 + ? Positioned( + left: 18.w, + top: 27.h, + child: Images.homeLanternBright, + ) + : Container(), + ], ), - ), - child: Stack( - clipBehavior: Clip.none, - children: [ - brightCount! >= 1 - ? Positioned( - left: -9.w, - top: 36.h, - child: Images.homeLanternBright, - ) - : Container(), - brightCount! >= 2 - ? Positioned( - left: 18.w, - top: 27.h, - child: Images.homeLanternBright, - ) - : Container(), - ], ), ); } diff --git a/lib/app/modules/select/controllers/select_controller.dart b/lib/app/modules/select/controllers/select_controller.dart index 158e520..e21324d 100644 --- a/lib/app/modules/select/controllers/select_controller.dart +++ b/lib/app/modules/select/controllers/select_controller.dart @@ -121,7 +121,7 @@ class SelectController extends GetxController { enName: 'academician', vImage: 'btn_female_pic_academician', hImage: 'pic_female_academician', - enable: false, + enable: true, )); occupations.add(Occupation( id: 2, @@ -218,9 +218,9 @@ class SelectController extends GetxController { } Future recommendOccupation(int id) async { - confirm.value = true; var occupation = selectOccupations.firstWhere((t) => t.value.id == id); selectOccupation.value = occupation.value; + confirm.value = true; for (var occupation in selectOccupations) { occupation.update((val) { val!.selected = false; diff --git a/lib/app/shared/widgets/show_up.dart b/lib/app/shared/widgets/show_up.dart index aade0da..22074f0 100644 --- a/lib/app/shared/widgets/show_up.dart +++ b/lib/app/shared/widgets/show_up.dart @@ -5,15 +5,21 @@ class ShowUp extends HookWidget { const ShowUp({ super.key, required this.child, + this.duration, }); final Widget child; + final Duration? duration; + @override Widget build(BuildContext context) { final controller = useAnimationController(duration: const Duration(milliseconds: 300)); - useMemoized(() { + useMemoized(() async { + if (duration != null) { + await Future.delayed(duration!); + } controller.forward(); }); return FadeTransition(