修复一些问题

This commit is contained in:
yuanjunyao 2023-11-30 17:12:13 +08:00
parent 997f5e0a88
commit 5748046c60
6 changed files with 55 additions and 33 deletions

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -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,
);

View File

@ -550,11 +550,14 @@ class HomeView extends GetView<HomeController> {
animationWidgetBuilder: AnimatedVisibilityWidget.fadeAnimationWidgetBuilder,
duration: const Duration(milliseconds: 800),
isVisible: controller.explored2.value >= 1,
child: Visibility(
visible: controller.explored2.value >= 1,
child: const LanternWidget(
brightCount: 0,
),
),
),
),
Positioned(
left: 168.w,
top: 244.h,

View File

@ -12,7 +12,9 @@ class LanternWidget extends GetView {
@override
Widget build(BuildContext context) {
return Container(
return ShowUp(
duration: const Duration(seconds: 2),
child: Container(
height: 90.h,
width: 180.w,
decoration: const BoxDecoration(
@ -40,6 +42,7 @@ class LanternWidget extends GetView {
: Container(),
],
),
),
);
}
}

View File

@ -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;

View File

@ -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(