|
|
@@ -23,71 +23,81 @@ class TalkPage extends BasePage<TalkController> {
|
|
|
|
|
|
@override
|
|
|
Widget buildBody(BuildContext context) {
|
|
|
- return DefaultTabController(
|
|
|
- length: controller.tabBeans.length,
|
|
|
- child: Stack(
|
|
|
- children: [
|
|
|
- buildTopGradient(),
|
|
|
- Scaffold(
|
|
|
- backgroundColor: Colors.transparent,
|
|
|
- appBar: AppBar(
|
|
|
- systemOverlayStyle: SystemUiOverlayStyle.dark,
|
|
|
+ return WillPopScope(
|
|
|
+ onWillPop: () async {
|
|
|
+ if (controller.isEditModel) {
|
|
|
+ controller.onEditCancel();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ child: DefaultTabController(
|
|
|
+ initialIndex: controller.tabIndex.value,
|
|
|
+ length: controller.tabBeans.length,
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ buildTopGradient(),
|
|
|
+ Scaffold(
|
|
|
backgroundColor: Colors.transparent,
|
|
|
- leading: IconButton(
|
|
|
- icon: SizedBox(
|
|
|
- width: 24.w,
|
|
|
- height: 24.w,
|
|
|
- child: Assets.images.iconBack.image()),
|
|
|
- // Custom icon
|
|
|
- onPressed: () {
|
|
|
- Get.back();
|
|
|
- },
|
|
|
+ appBar: AppBar(
|
|
|
+ actions: [
|
|
|
+ _buildEditBtnView(),
|
|
|
+ ],
|
|
|
+ systemOverlayStyle: SystemUiOverlayStyle.dark,
|
|
|
+ backgroundColor: Colors.transparent,
|
|
|
+ leading: _buildAppbarBackView(),
|
|
|
),
|
|
|
+ body: Builder(builder: (context) {
|
|
|
+ return Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
+ child: Obx(() {
|
|
|
+ return Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 8.h),
|
|
|
+ Text(controller.talkBean.value?.title.value ?? '',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 22.sp,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ color: ColorName.primaryTextColor)),
|
|
|
+ SizedBox(height: 4.h),
|
|
|
+ Text(controller.talkBean.value?.createTime ?? '',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.secondaryTextColor)),
|
|
|
+ SizedBox(height: 14.h),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ buildTabBar(context),
|
|
|
+ Divider(
|
|
|
+ height: 1,
|
|
|
+ color: const Color(0xFFf6f6f6),
|
|
|
+ indent: 12.w,
|
|
|
+ endIndent: 12.w),
|
|
|
+ SizedBox(height: 8.h),
|
|
|
+ buildTalkContentView()
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }),
|
|
|
),
|
|
|
- body: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
- child: Obx(() {
|
|
|
- return Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- SizedBox(height: 8.h),
|
|
|
- Text(controller.talkBean.value?.title.value ?? '',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 22.sp,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- color: ColorName.primaryTextColor)),
|
|
|
- SizedBox(height: 4.h),
|
|
|
- Text(controller.talkBean.value?.createTime ?? '',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: ColorName.secondaryTextColor)),
|
|
|
- SizedBox(height: 14.h),
|
|
|
- ],
|
|
|
- );
|
|
|
- }),
|
|
|
- ),
|
|
|
- buildTabBar(),
|
|
|
- Divider(
|
|
|
- height: 1,
|
|
|
- color: const Color(0xFFf6f6f6),
|
|
|
- indent: 12.w,
|
|
|
- endIndent: 12.w),
|
|
|
- SizedBox(height: 8.h),
|
|
|
- buildTalkContentView()
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- buildBottomView(),
|
|
|
- buildAIAnalysisView()
|
|
|
- ],
|
|
|
+ buildBottomView(),
|
|
|
+ buildAIAnalysisView()
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Container buildTabBar() {
|
|
|
+ Container buildTabBar(BuildContext context) {
|
|
|
+ TabController tabController = DefaultTabController.of(context);
|
|
|
+ tabController.addListener(() {
|
|
|
+ controller.updateTabIndex(tabController.index);
|
|
|
+ });
|
|
|
return Container(
|
|
|
decoration: const BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
@@ -353,6 +363,63 @@ class TalkPage extends BasePage<TalkController> {
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ Widget _buildAppbarBackView() {
|
|
|
+ return Obx(() {
|
|
|
+ return controller.isEditModel
|
|
|
+ ? IconButton(
|
|
|
+ icon: SizedBox(
|
|
|
+ width: 24.w,
|
|
|
+ height: 24.w,
|
|
|
+ child: Assets.images.iconTalkEditCancel.image()),
|
|
|
+ // Custom icon
|
|
|
+ onPressed: () {
|
|
|
+ controller.onEditCancel();
|
|
|
+ },
|
|
|
+ )
|
|
|
+ : IconButton(
|
|
|
+ icon: SizedBox(
|
|
|
+ width: 24.w,
|
|
|
+ height: 24.w,
|
|
|
+ child: Assets.images.iconBack.image()),
|
|
|
+ // Custom icon
|
|
|
+ onPressed: () {
|
|
|
+ Get.back();
|
|
|
+ },
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildEditBtnView() {
|
|
|
+ return Obx(() {
|
|
|
+ return Visibility(
|
|
|
+ visible: controller.talkBean.value?.status.value ==
|
|
|
+ TalkStatus.analysisSuccess &&
|
|
|
+ controller.tabIndex.value != 2,
|
|
|
+ child: controller.isEditModel
|
|
|
+ ? GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.onEditDoneClick();
|
|
|
+ },
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
+ child: Text(StringName.done.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 17.sp, color: ColorName.primaryTextColor)),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : IconButton(
|
|
|
+ icon: SizedBox(
|
|
|
+ width: 24.w,
|
|
|
+ height: 24.w,
|
|
|
+ child: Assets.images.iconTalkEdit.image()),
|
|
|
+ onPressed: () {
|
|
|
+ controller.onEditModelClick();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class CustomTrackShape extends RoundedRectSliderTrackShape {
|