修复一些问题

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,8 +550,11 @@ 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: const LanternWidget( child: Visibility(
brightCount: 0, visible: controller.explored2.value >= 1,
child: const LanternWidget(
brightCount: 0,
),
), ),
), ),
), ),

View File

@ -12,33 +12,36 @@ class LanternWidget extends GetView {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return ShowUp(
height: 90.h, duration: const Duration(seconds: 2),
width: 180.w, child: Container(
decoration: const BoxDecoration( height: 90.h,
image: DecorationImage( width: 180.w,
image: Images.homeLantern, decoration: const BoxDecoration(
fit: BoxFit.fill, 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(),
],
), ),
); );
} }

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(