|
|
@@ -3,16 +3,22 @@ import 'package:flutter/Material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:keyboard/base/base_page.dart';
|
|
|
+import 'package:keyboard/data/repository/account_repository.dart';
|
|
|
import 'package:keyboard/module/zodiac_love_intimacy/tody/zodiac_love_today_view.dart';
|
|
|
import 'package:keyboard/module/zodiac_love_intimacy/zodiac_love_intimacy_controller.dart';
|
|
|
import 'package:keyboard/resource/colors.gen.dart';
|
|
|
+import 'package:keyboard/utils/toast_util.dart';
|
|
|
+import 'package:lottie/lottie.dart';
|
|
|
import 'package:nested_scroll_views/material.dart';
|
|
|
-
|
|
|
+import '../../di/get_it.dart';
|
|
|
import '../../resource/assets.gen.dart';
|
|
|
import '../../resource/string.gen.dart';
|
|
|
import '../../router/app_pages.dart';
|
|
|
+import '../../utils/age_zodiac_sign_util.dart';
|
|
|
+import '../../widget/avatar/avatar_image_widget.dart';
|
|
|
import '../../widget/status_bar_placeholder_widget.dart';
|
|
|
import '../../widget/top_bar.dart';
|
|
|
+import '../user_profile/user_profile_page.dart';
|
|
|
import 'enums/zodiac_love_intimacy_tab.dart';
|
|
|
import 'future_week/zodiac_love_future_week_view.dart';
|
|
|
|
|
|
@@ -21,6 +27,13 @@ class ZodiacLoveIntimacyPage extends BasePage<ZodiacLoveIntimacyController> {
|
|
|
const ZodiacLoveIntimacyPage({super.key});
|
|
|
|
|
|
static start() {
|
|
|
+ var accountRepository = getIt.get<AccountRepository>();
|
|
|
+ // 如果用户未设置生日,则要求先设置生日,才能跳转
|
|
|
+ if (accountRepository.userInfo.value?.birthday == null) {
|
|
|
+ ToastUtil.show(StringName.userNotSetBirthdayTip);
|
|
|
+ UserProfilePage.start();
|
|
|
+ return;
|
|
|
+ }
|
|
|
Get.toNamed(RoutePath.zodiacLoveIntimacy);
|
|
|
}
|
|
|
|
|
|
@@ -203,8 +216,8 @@ class ZodiacLoveIntimacyPage extends BasePage<ZodiacLoveIntimacyController> {
|
|
|
Widget _buildContent(BuildContext context) {
|
|
|
return Column(
|
|
|
children: [
|
|
|
- // 顶部概览
|
|
|
- _buildOverviewHeader(),
|
|
|
+ // 顶部基础信息
|
|
|
+ _buildTopBasicInfoHeader(),
|
|
|
// TabBar
|
|
|
_buildTabBar(),
|
|
|
// PageView
|
|
|
@@ -213,9 +226,179 @@ class ZodiacLoveIntimacyPage extends BasePage<ZodiacLoveIntimacyController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- /// 顶部概览视图
|
|
|
- Widget _buildOverviewHeader() {
|
|
|
- return Container(height: 270.h);
|
|
|
+ /// 顶部基础信息视图
|
|
|
+ Widget _buildTopBasicInfoHeader() {
|
|
|
+ return Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 70.w),
|
|
|
+ // 头像布局
|
|
|
+ _buildAvatarLayout(),
|
|
|
+ SizedBox(height: 14.w),
|
|
|
+ // 星座梗语与解读
|
|
|
+ _buildZodiacDesc(),
|
|
|
+ SizedBox(height: 16.w),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 头像布局
|
|
|
+ Widget _buildAvatarLayout() {
|
|
|
+ return Obx(() {
|
|
|
+ String? myAvatar =
|
|
|
+ controller.zodiacLoveIntimacyLoveInfoResponse.value?.imageUrl ?? "";
|
|
|
+ if (myAvatar.isEmpty) {
|
|
|
+ myAvatar = controller.userInfo.value?.imageUrl ?? "";
|
|
|
+ }
|
|
|
+ return Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ // 我的头像
|
|
|
+ _buildAvatarAndZodiac(
|
|
|
+ imageUrl: myAvatar,
|
|
|
+ zodiac: controller.myZodiacInfo,
|
|
|
+ ),
|
|
|
+ // 爱心动画
|
|
|
+ Lottie.asset(
|
|
|
+ Assets.anim.animNewUserData,
|
|
|
+ repeat: true,
|
|
|
+ width: 131.w,
|
|
|
+ fit: BoxFit.contain,
|
|
|
+ ),
|
|
|
+ // Ta的头像
|
|
|
+ _buildAvatarAndZodiac(
|
|
|
+ imageUrl:
|
|
|
+ controller
|
|
|
+ .zodiacLoveIntimacyLoveInfoResponse
|
|
|
+ .value
|
|
|
+ ?.targetImageUrl,
|
|
|
+ zodiac: controller.taZodiacInfo,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 头像和星座
|
|
|
+ Widget _buildAvatarAndZodiac({
|
|
|
+ required String? imageUrl,
|
|
|
+ required Zodiac? zodiac,
|
|
|
+ }) {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 20.w),
|
|
|
+ // 头像
|
|
|
+ CircleAvatarWidget(
|
|
|
+ image: Assets.images.iconKeyboardDefaultAvatar.provider(),
|
|
|
+ imageUrl: imageUrl,
|
|
|
+ size: 88.w,
|
|
|
+ borderColor: Colors.white,
|
|
|
+ borderWidth: 2.r,
|
|
|
+ placeholder: (_, __) => const SizedBox.shrink(),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 14.w),
|
|
|
+ // 星座
|
|
|
+ Builder(
|
|
|
+ builder: (context) {
|
|
|
+ if (zodiac != null) {
|
|
|
+ return Row(
|
|
|
+ children: [
|
|
|
+ zodiac.image.image(width: 14.w, height: 14.w),
|
|
|
+ SizedBox(width: 4.w),
|
|
|
+ Text(
|
|
|
+ zodiac.name,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 15.sp,
|
|
|
+ fontWeight: FontWeight.w700,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return const SizedBox.shrink();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 星座梗语与解读
|
|
|
+ Widget _buildZodiacDesc() {
|
|
|
+ return Obx(() {
|
|
|
+ var info = controller.zodiacLoveIntimacyLoveInfoResponse.value;
|
|
|
+ var meme = info?.meme ?? "";
|
|
|
+ var explain = info?.explain ?? "";
|
|
|
+ if (meme.isEmpty || explain.isEmpty) {
|
|
|
+ return SizedBox(height: 67.h);
|
|
|
+ }
|
|
|
+ return Container(
|
|
|
+ width: double.infinity,
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 30.w),
|
|
|
+ child: Stack(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ children: [
|
|
|
+ Positioned(
|
|
|
+ child: Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 8.w),
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: const Color(0x29B80081),
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(16.r),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ // 梗语标题
|
|
|
+ Text(
|
|
|
+ meme,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 12.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 2.h),
|
|
|
+ // 星座梗语
|
|
|
+ Text(
|
|
|
+ explain,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 12.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 左上角的逗号
|
|
|
+ Positioned(
|
|
|
+ top: 5.w,
|
|
|
+ left: 8.w,
|
|
|
+ child: Assets.images.iconNewUserZodiacLeft.image(
|
|
|
+ width: 13.w,
|
|
|
+ height: 13.w,
|
|
|
+ fit: BoxFit.contain,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 右下角的逗号
|
|
|
+ Positioned(
|
|
|
+ right: 8.w,
|
|
|
+ bottom: 5.w,
|
|
|
+ child: Assets.images.iconNewUserZodiacRight.image(
|
|
|
+ width: 13.w,
|
|
|
+ height: 13.w,
|
|
|
+ fit: BoxFit.contain,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/// PageView
|