|
|
@@ -0,0 +1,317 @@
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:get/get.dart';
|
|
|
+import 'package:keyboard/base/base_view.dart';
|
|
|
+import 'package:keyboard/module/intimacy_analyse/analyse_report/widget/report_item_widget.dart';
|
|
|
+import 'package:keyboard/module/intimacy_analyse/analyse_report/widget/report_title_widget.dart';
|
|
|
+
|
|
|
+import '../../../data/model/intimacy_analyse_report.dart';
|
|
|
+import '../../../resource/assets.gen.dart';
|
|
|
+import '../../../resource/colors.gen.dart';
|
|
|
+import '../../../widget/avatar/avatar_image_widget.dart';
|
|
|
+import 'intimacy_analyse_report_view_controller.dart';
|
|
|
+
|
|
|
+/// 亲密度分析-分析报告Tab页
|
|
|
+class IntimacyAnalyseReportView
|
|
|
+ extends BaseView<IntimacyAnalyseReportController> {
|
|
|
+ const IntimacyAnalyseReportView({super.key});
|
|
|
+
|
|
|
+ @override
|
|
|
+ Color backgroundColor() {
|
|
|
+ return Colors.transparent;
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget buildBody(BuildContext context) {
|
|
|
+ return Stack(
|
|
|
+ children: [
|
|
|
+ Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 35.h),
|
|
|
+ // 亲密度档案
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [_buildIntimacyArchives()],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 12.h),
|
|
|
+ // 切换亲密度
|
|
|
+ _buildIntimacyArchivesSwitchLayout(),
|
|
|
+ SizedBox(height: 18.h),
|
|
|
+ // 报告预览
|
|
|
+ Expanded(child: _buildReportPreview()),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ // 解锁按钮
|
|
|
+ Positioned.fill(
|
|
|
+ child: Align(
|
|
|
+ alignment: Alignment.bottomCenter,
|
|
|
+ child: _buildBottomLayout(),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 亲密档案
|
|
|
+ Widget _buildIntimacyArchives() {
|
|
|
+ return SizedBox(
|
|
|
+ height: 100.h,
|
|
|
+ width: 200.w,
|
|
|
+ child: Stack(
|
|
|
+ // 默认内容都居中
|
|
|
+ alignment: Alignment.center,
|
|
|
+ children: [
|
|
|
+ // 用户1
|
|
|
+ Positioned(
|
|
|
+ left: 0,
|
|
|
+ child: _buildAvatar(
|
|
|
+ "",
|
|
|
+ defaultImage: Assets.images.iconDefaultAvatarMale.image().image,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 用户2
|
|
|
+ Positioned(
|
|
|
+ left: 92.w,
|
|
|
+ top: 0,
|
|
|
+ child: _buildAvatar(
|
|
|
+ "",
|
|
|
+ defaultImage: Assets.images.iconDefaultAvatarFemale.image().image,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 爱心
|
|
|
+ Positioned(
|
|
|
+ child: Assets.images.iconIntimacyAnalyseLove.image(
|
|
|
+ width: 42.w,
|
|
|
+ height: 42.2.w,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 亲密档案切换布局
|
|
|
+ Widget _buildIntimacyArchivesSwitchLayout() {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.clickIntimacyArchivesSwitch();
|
|
|
+ },
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ "自己&小瑞",
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.black80,
|
|
|
+ fontSize: 13.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 2.5.w),
|
|
|
+ Assets.images.iconIntimacyAnalyseArrow.image(width: 15, height: 15),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 报告预览布局-顶部布局-包含:图标和标题
|
|
|
+ Widget _buildReportPreviewTopLayout() {
|
|
|
+ return Row(
|
|
|
+ children: [
|
|
|
+ Assets.images.iconIntimacyAnalyseReportPreviewLove.image(
|
|
|
+ width: 50,
|
|
|
+ height: 48,
|
|
|
+ ),
|
|
|
+ Assets.images.iconIntimacyAnalyseReportPreviewTitle.image(
|
|
|
+ width: 178,
|
|
|
+ height: 24,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 报告预览
|
|
|
+ Widget _buildReportPreview() {
|
|
|
+ return Obx(() {
|
|
|
+ // 卡片背景
|
|
|
+ return Stack(
|
|
|
+ // 让大小,撑满父组件
|
|
|
+ fit: StackFit.expand,
|
|
|
+ children: [
|
|
|
+ // 中间内容
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(left: 12, right: 12, bottom: 0),
|
|
|
+ padding: EdgeInsets.only(bottom: 12),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ image: DecorationImage(
|
|
|
+ image: Assets.images.bgIntimacyAnalyseReportPreview.provider(),
|
|
|
+ fit: BoxFit.fill,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 圆角背景
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ // 图标和标题
|
|
|
+ _buildReportPreviewTopLayout(),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(
|
|
|
+ top: 51,
|
|
|
+ left: 12,
|
|
|
+ right: 12,
|
|
|
+ bottom: 5,
|
|
|
+ ),
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(20.r),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Padding(
|
|
|
+ padding: const EdgeInsets.only(
|
|
|
+ left: 14,
|
|
|
+ right: 14,
|
|
|
+ top: 20,
|
|
|
+ bottom: 14,
|
|
|
+ ),
|
|
|
+ // 内容
|
|
|
+ child: Stack(
|
|
|
+ // 撑满父组件
|
|
|
+ fit: StackFit.expand,
|
|
|
+ children: [
|
|
|
+ SingleChildScrollView(
|
|
|
+ child: _buildReportContent(
|
|
|
+ controller.reportPreviewData.value,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 底部阴影
|
|
|
+ Positioned(
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ bottom: 0,
|
|
|
+ child: Container(
|
|
|
+ child: Assets.images.bgIntimacyAnalyseReportPreviewMask.image(
|
|
|
+ height: 126,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 报告内容
|
|
|
+ Widget _buildReportContent(IntimacyAnalyseReport report) {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ // 报告列表
|
|
|
+ ...report.list.map((ele) {
|
|
|
+ return ReportItemWidget(item: ele);
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 底部布局
|
|
|
+ Widget _buildBottomLayout() {
|
|
|
+ return Column(
|
|
|
+ // 高度包裹内容,否则会撑满父组件
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ children: [
|
|
|
+ _buildReportPreviewBubble(),
|
|
|
+ _buildUnlockBtn(),
|
|
|
+ SizedBox(height: 20.h),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 报告预览布局-气泡
|
|
|
+ Widget _buildReportPreviewBubble() {
|
|
|
+ return Container(
|
|
|
+ margin: EdgeInsets.only(left: 16, right: 58, bottom: 3),
|
|
|
+ padding: EdgeInsets.only(bottom: 3, right: 15),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ image: DecorationImage(
|
|
|
+ image: Assets.images.bgIntimacyAnalyseReportPreviewBubble.provider(),
|
|
|
+ fit: BoxFit.fill,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ // 人物图片
|
|
|
+ Assets.images.iconIntimacyAnalyseReportPreviewBubbleSymbol.image(
|
|
|
+ width: 47,
|
|
|
+ height: 28,
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.only(left: 38, top: 7, bottom: 8),
|
|
|
+ child: Text(
|
|
|
+ controller.reportPreviewBubbleText.value,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.black65,
|
|
|
+ fontSize: 11.sp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 解锁按钮
|
|
|
+ Widget _buildUnlockBtn() {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.clickUnlockBtn();
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 16.w),
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 14.h),
|
|
|
+ width: double.maxFinite,
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: ColorName.colorBrand,
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(50.r),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Assets.images.iconIntimacyAnalyseUnlock.image(
|
|
|
+ width: 22,
|
|
|
+ height: 22,
|
|
|
+ ),
|
|
|
+ SizedBox(width: 4.w),
|
|
|
+ Text(
|
|
|
+ "解锁分析",
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 圆形头像
|
|
|
+ Widget _buildAvatar(String? imageUrl, {ImageProvider? defaultImage}) {
|
|
|
+ return CircleAvatarWidget(
|
|
|
+ imageUrl: imageUrl,
|
|
|
+ placeholderImage: defaultImage,
|
|
|
+ borderColor: ColorName.white,
|
|
|
+ borderWidth: 3.0,
|
|
|
+ backgroundColor: ColorName.white,
|
|
|
+ size: 96.0,
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|