修复一些问题

This commit is contained in:
yuanjunyao 2023-11-30 18:06:27 +08:00
parent 5748046c60
commit 925673afa2
3 changed files with 41 additions and 31 deletions

View File

@ -71,12 +71,6 @@ 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();
@ -100,6 +94,11 @@ class HomeController extends GetxController {
} }
}); });
} }
if (account.isEmpty) {
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
Get.offAllNamed(Routes.WELCOME);
});
}
} }
@override @override
@ -117,8 +116,8 @@ class HomeController extends GetxController {
Future explorePress() async { Future explorePress() async {
if (explored.value) { if (explored.value) {
availableApp.value = true;
if (exploreTimer == null) { if (exploreTimer == null) {
availableApp.value = true;
exploreTimer = Timer.periodic(repeatPeriod, (timer) { exploreTimer = Timer.periodic(repeatPeriod, (timer) {
if (countTime <= 0) { if (countTime <= 0) {
explored.value = false; explored.value = false;
@ -148,6 +147,7 @@ class HomeController extends GetxController {
remainTime.value = countTime; remainTime.value = countTime;
}); });
} else { } else {
availableApp.value = false;
exploreTimer!.cancel(); exploreTimer!.cancel();
exploreTimer = null; exploreTimer = null;
} }
@ -223,7 +223,7 @@ class HomeController extends GetxController {
4. 4.
''')); '''));
knowledgePoints.add(KnowledgePoint( 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); .obs);
knowledgePointDialogues.add(KnowledgePointDialogue( knowledgePointDialogues.add(KnowledgePointDialogue(
kpId: 2, id: 0, isGpt: true, text: '''让我们来了解一下炎帝和黄帝,这两位是中国历史上非常重要的传说人物。 kpId: 2, id: 0, isGpt: true, text: '''让我们来了解一下炎帝和黄帝,这两位是中国历史上非常重要的传说人物。

View File

@ -32,17 +32,11 @@ class HomeView extends GetView<HomeController> {
child: Obx( child: Obx(
() => Scaffold( () => Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: AnimatedSwitcher( body: controller.create.value
duration: const Duration(milliseconds: 500), ? Center(
child: KeyedSubtree( child: Images.homeCreate,
key: ValueKey(controller.create.value), )
child: controller.create.value : buildBody(context),
? Center(
child: Images.homeCreate,
)
: buildBody(context),
),
),
), ),
), ),
), ),
@ -332,7 +326,7 @@ class HomeView extends GetView<HomeController> {
child: Text( child: Text(
'科学竞赛参与', '科学竞赛参与',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyles.boldWhiteShadow12_111, style: TextStyles.whiteShadow12_111,
), ),
), ),
), ),
@ -346,7 +340,7 @@ class HomeView extends GetView<HomeController> {
child: Text( child: Text(
'英语能力加强', '英语能力加强',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyles.boldWhiteShadow12_111, style: TextStyles.whiteShadow12_111,
), ),
), ),
), ),
@ -360,7 +354,7 @@ class HomeView extends GetView<HomeController> {
child: Text( child: Text(
'拓展科学知识', '拓展科学知识',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyles.boldWhiteShadow12_111, style: TextStyles.whiteShadow12_111,
), ),
), ),
), ),
@ -400,7 +394,7 @@ class HomeView extends GetView<HomeController> {
child: Text( child: Text(
'课外阅读提升', '课外阅读提升',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyles.boldWhiteShadow12_111, style: TextStyles.whiteShadow12_111,
), ),
), ),
), ),
@ -414,7 +408,7 @@ class HomeView extends GetView<HomeController> {
child: Text( child: Text(
'科学兴趣培养', '科学兴趣培养',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyles.boldWhiteShadow12_111, style: TextStyles.whiteShadow12_111,
), ),
), ),
), ),
@ -428,7 +422,7 @@ class HomeView extends GetView<HomeController> {
child: Text( child: Text(
'基础教学能力', '基础教学能力',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyles.boldWhiteShadow12_111, style: TextStyles.whiteShadow12_111,
), ),
), ),
), ),
@ -547,7 +541,8 @@ class HomeView extends GetView<HomeController> {
right: 60.w, right: 60.w,
top: 346.h, top: 346.h,
child: AnimatedVisibilityWidget( child: AnimatedVisibilityWidget(
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( child: Visibility(
@ -736,6 +731,7 @@ class HomeView extends GetView<HomeController> {
} }
Widget exploreAppWidget(ExploreApp app) { Widget exploreAppWidget(ExploreApp app) {
final imageId = 'home/${controller.availableApp.value ? app.icon : app.grayIcon}';
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (controller.availableApp.value) {} if (controller.availableApp.value) {}
@ -743,11 +739,17 @@ class HomeView extends GetView<HomeController> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
LoadAssetImage( AnimatedSwitcher(
'home/${controller.availableApp.value ? app.icon : app.grayIcon}', duration: kThemeAnimationDuration * 2,
height: 74.w, child: KeyedSubtree(
width: 74.w, key: ValueKey(imageId),
fit: BoxFit.fill, child: LoadAssetImage(
imageId,
height: 74.w,
width: 74.w,
fit: BoxFit.fill,
),
),
), ),
const RSizedBox(height: 2), const RSizedBox(height: 2),
Text( Text(

View File

@ -281,6 +281,12 @@ class TextStyles {
shadows: [Shadows.txtShadow111], shadows: [Shadows.txtShadow111],
); );
static TextStyle whiteShadow12_111 = TextStyle(
fontSize: Dimens.font_sp12.sp,
color: Colors.white,
shadows: [Shadows.txtShadow111],
);
static TextStyle boldWhiteShadow12_111 = TextStyle( static TextStyle boldWhiteShadow12_111 = TextStyle(
fontSize: Dimens.font_sp12.sp, fontSize: Dimens.font_sp12.sp,
color: Colors.white, color: Colors.white,
@ -319,6 +325,8 @@ class TextStyles {
static TextStyle mediumWhiteShadow12_111 = TextStyle( static TextStyle mediumWhiteShadow12_111 = TextStyle(
fontSize: Dimens.font_sp12.sp, fontSize: Dimens.font_sp12.sp,
color: Colors.white, color: Colors.white,
fontFamily: 'alph-b',
fontWeight: FontWeight.bold,
shadows: [Shadows.txtShadow111], shadows: [Shadows.txtShadow111],
); );
static TextStyle mediumWhite21_024 = TextStyle( static TextStyle mediumWhite21_024 = TextStyle(