|
|
@@ -1,10 +1,15 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
|
|
|
import 'package:keyboard/base/base_view.dart';
|
|
|
|
|
|
+import '../../../../data/bean/option_select_config.dart';
|
|
|
+import '../../../../data/bean/option_select_item.dart';
|
|
|
import '../../../../resource/assets.gen.dart';
|
|
|
import '../../../../resource/colors.gen.dart';
|
|
|
import '../../../../resource/string.gen.dart';
|
|
|
+import '../../widget/option_select_widget.dart';
|
|
|
+import '../../widget/step/upload_step_card.dart';
|
|
|
import '../../widget/step_card.dart';
|
|
|
import 'conversation_analysis_controller.dart';
|
|
|
|
|
|
@@ -22,19 +27,104 @@ class ConversationAnalysisView
|
|
|
Widget buildBody(BuildContext context) {
|
|
|
return Stack(
|
|
|
children: [
|
|
|
- Column(
|
|
|
- children: [
|
|
|
- // 上传聊天记录例子卡片
|
|
|
- _buildChatRecordSampleCard(),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ Obx(() {
|
|
|
+ return _buildContentList();
|
|
|
+ }),
|
|
|
// 上传截图按钮
|
|
|
Positioned.fill(
|
|
|
child: Align(
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
- child: _buildBottomLayout(context),
|
|
|
+ child: Obx(() {
|
|
|
+ return _buildBottomLayout(context);
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 内容列表
|
|
|
+ Widget _buildContentList() {
|
|
|
+ Widget contentWidget;
|
|
|
+ if (controller.isUploadPage.value) {
|
|
|
+ contentWidget = Column(
|
|
|
+ children: [
|
|
|
+ // 上传聊天记录卡片
|
|
|
+ _buildUploadCard(),
|
|
|
+ // 选项卡片
|
|
|
+ _buildOptionCard(),
|
|
|
+ // 距离底部有一定间距
|
|
|
+ SizedBox(height: 90.h),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ // 例子列表
|
|
|
+ contentWidget = Column(
|
|
|
+ children: [
|
|
|
+ // 上传聊天记录例子卡片
|
|
|
+ _buildChatRecordSampleCard(),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return SingleChildScrollView(child: contentWidget);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 上传步骤卡片
|
|
|
+ Widget _buildUploadCard() {
|
|
|
+ return UploadStepCard(
|
|
|
+ stepTitle: StringName.intimacyConversationAnalysis,
|
|
|
+ stepDesc: StringName.intimacyConversationAnalysisCardTip,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 选项卡片
|
|
|
+ Widget _buildOptionCard() {
|
|
|
+ return StepCard(
|
|
|
+ hasStep: false,
|
|
|
+ contentWidget: Column(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(left: 12.w, top: 17.h, right: 12.w),
|
|
|
+ padding: EdgeInsets.only(
|
|
|
+ left: 12.w,
|
|
|
+ top: 12.h,
|
|
|
+ right: 12.w,
|
|
|
+ bottom: 12.h,
|
|
|
+ ),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(16.r),
|
|
|
+ ),
|
|
|
+ child: Obx(() {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ // 添加选项行
|
|
|
+ for (var optionConfig in controller.optionSelectConfigList)
|
|
|
+ _buildOptionRow(optionConfig),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }),
|
|
|
),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 构建一行选择选项行
|
|
|
+ Widget _buildOptionRow(OptionSelectConfig config) {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ // 选择项
|
|
|
+ OptionSelectWidget(
|
|
|
+ optionSelect: config,
|
|
|
+ optionSelectCallback: (
|
|
|
+ OptionSelectConfig rowConfig,
|
|
|
+ OptionSelectItem optionItem,
|
|
|
+ ) {
|
|
|
+ controller.selectOption(rowConfig, optionItem);
|
|
|
+ },
|
|
|
),
|
|
|
+ SizedBox(height: 20.h),
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
@@ -98,11 +188,72 @@ class ConversationAnalysisView
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ /// 解锁按钮
|
|
|
+ Widget _buildUnlockBtn(BuildContext context) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.clickUnlockBtn(context);
|
|
|
+ },
|
|
|
+ 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(
|
|
|
+ StringName.intimacyUnlockAnalyse,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
/// 上传截图按钮
|
|
|
- Widget _buildUploadScreenshotBtn() {
|
|
|
+ Widget _buildUploadScreenshotBtn(BuildContext context) {
|
|
|
+ return _buildGradientBtn(
|
|
|
+ btnText: StringName.intimacyUploadScreenshot,
|
|
|
+ onPressed: () {
|
|
|
+ controller.clickUploadBtn(context);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 查看分析按钮
|
|
|
+ Widget _buildLookAnalyseBtn(BuildContext context) {
|
|
|
+ return _buildGradientBtn(
|
|
|
+ btnText: StringName.intimacyAnalyseLookAnalyse,
|
|
|
+ onPressed: () {
|
|
|
+ controller.clickLookAnalyseBtn(context);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 渐变按钮
|
|
|
+ Widget _buildGradientBtn({
|
|
|
+ required String btnText,
|
|
|
+ required VoidCallback onPressed,
|
|
|
+ }) {
|
|
|
return GestureDetector(
|
|
|
onTap: () {
|
|
|
- controller.clickUploadScreenshotBtn();
|
|
|
+ onPressed();
|
|
|
},
|
|
|
child: Container(
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
|
|
@@ -121,7 +272,7 @@ class ConversationAnalysisView
|
|
|
),
|
|
|
child: Center(
|
|
|
child: Text(
|
|
|
- StringName.intimacyUploadScreenshot,
|
|
|
+ btnText,
|
|
|
style: TextStyle(
|
|
|
color: ColorName.white,
|
|
|
fontSize: 16.sp,
|
|
|
@@ -135,13 +286,27 @@ class ConversationAnalysisView
|
|
|
|
|
|
/// 底部布局
|
|
|
Widget _buildBottomLayout(BuildContext context) {
|
|
|
+ Widget btn;
|
|
|
+ // 已解锁
|
|
|
+ if (controller.isUnlock.value) {
|
|
|
+ btn = _buildUnlockBtn(context);
|
|
|
+ } else {
|
|
|
+ // 未解锁,已在上传阶段,则显示查看分析按钮
|
|
|
+ if (controller.isUploadPage.value) {
|
|
|
+ btn = _buildLookAnalyseBtn(context);
|
|
|
+ } else {
|
|
|
+ // 例子阶段,则显示上传截图按钮
|
|
|
+ btn = _buildUploadScreenshotBtn(context);
|
|
|
+ }
|
|
|
+ }
|
|
|
return Column(
|
|
|
// 高度包裹内容
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- // 上传截图按钮
|
|
|
- _buildUploadScreenshotBtn(), SizedBox(height: 20.h),
|
|
|
+ // 操作按钮
|
|
|
+ btn,
|
|
|
+ SizedBox(height: 20.h),
|
|
|
],
|
|
|
);
|
|
|
}
|