修复一些问题

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; occupationName = SpUtil.getString(Constant.occupationName).nullSafe;
occupationId = SpUtil.getInt(Constant.occupationId, defValue: 2)!; occupationId = SpUtil.getInt(Constant.occupationId, defValue: 2)!;
create.value = SpUtil.getBool(Constant.create, defValue: true)!; create.value = SpUtil.getBool(Constant.create, defValue: true)!;
if (account.isEmpty) {
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
Get.offAllNamed(Routes.WELCOME);
});
return;
}
initLeftExploreApps(); initLeftExploreApps();
initRightExploreApps(); initRightExploreApps();
initArtistGoals(); initArtistGoals();
@ -572,11 +578,15 @@ class HomeController extends GetxController {
await Future.delayed(const Duration(seconds: 1)); 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!); t!.kpId == selectKnowledge.value!.id && t.id == sendCount && t.isGpt!);
if (knowledgePointDialogue == null) {
return;
}
chatMsg = ChatMsg( chatMsg = ChatMsg(
id: Guid.newGuid.toString(), id: Guid.newGuid.toString(),
text: knowledgePointDialogue!.text, text: knowledgePointDialogue.text,
isBot: 1, isBot: 1,
knowledgeId: selectKnowledge.value!.id, knowledgeId: selectKnowledge.value!.id,
); );

View File

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

View File

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

View File

@ -121,7 +121,7 @@ class SelectController extends GetxController {
enName: 'academician', enName: 'academician',
vImage: 'btn_female_pic_academician', vImage: 'btn_female_pic_academician',
hImage: 'pic_female_academician', hImage: 'pic_female_academician',
enable: false, enable: true,
)); ));
occupations.add(Occupation( occupations.add(Occupation(
id: 2, id: 2,
@ -218,9 +218,9 @@ class SelectController extends GetxController {
} }
Future recommendOccupation(int id) async { Future recommendOccupation(int id) async {
confirm.value = true;
var occupation = selectOccupations.firstWhere((t) => t.value.id == id); var occupation = selectOccupations.firstWhere((t) => t.value.id == id);
selectOccupation.value = occupation.value; selectOccupation.value = occupation.value;
confirm.value = true;
for (var occupation in selectOccupations) { for (var occupation in selectOccupations) {
occupation.update((val) { occupation.update((val) {
val!.selected = false; val!.selected = false;

View File

@ -5,15 +5,21 @@ class ShowUp extends HookWidget {
const ShowUp({ const ShowUp({
super.key, super.key,
required this.child, required this.child,
this.duration,
}); });
final Widget child; final Widget child;
final Duration? duration;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final controller = final controller =
useAnimationController(duration: const Duration(milliseconds: 300)); useAnimationController(duration: const Duration(milliseconds: 300));
useMemoized(() { useMemoized(() async {
if (duration != null) {
await Future.delayed(duration!);
}
controller.forward(); controller.forward();
}); });
return FadeTransition( return FadeTransition(