From 6d5f8bbf2cc43c369e17328c0ce5642f6776f299 Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Thu, 26 Jun 2025 18:00:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0askai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meeting/views/ai_bottom_sheet.dart | 141 ++++++++++++++++++ lib/modules/meeting/views/overview_tab.dart | 18 +++ lib/modules/meeting/views/speech_tab.dart | 19 +++ lib/modules/meeting/views/summary_tab.dart | 18 +++ 4 files changed, 196 insertions(+) create mode 100644 lib/modules/meeting/views/ai_bottom_sheet.dart diff --git a/lib/modules/meeting/views/ai_bottom_sheet.dart b/lib/modules/meeting/views/ai_bottom_sheet.dart new file mode 100644 index 000000000..9243acad8 --- /dev/null +++ b/lib/modules/meeting/views/ai_bottom_sheet.dart @@ -0,0 +1,141 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../controllers/meeting_details_controller.dart'; + +class AIBottomSheet extends StatefulWidget { + const AIBottomSheet({super.key}); + + @override + State createState() => _AIBottomSheetState(); +} + +class _AIBottomSheetState extends State { + final _controller = Get.find(); + + List _dataList = []; + + final List _cruxList = [ + '添加代办事项', + '提取结论', + '生成关键指标', + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 1.sh - 50.h, + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Column( + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 10.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + 26.horizontalSpace, + Text( + 'Ask AI', + style: TextStyle( + fontSize: 16.sp, + color: Colors.black87, + fontWeight: FontWeight.bold, + ), + ), + GestureDetector( + onTap: () => Get.back(), + child: Container( + width: 26.w, + height: 26.w, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(26.r), + ), + child: Icon( + Icons.close, + size: 18.w, + color: Colors.grey[400], + ), + ), + ) + ], + ), + ), + Expanded( + child: _dataList.isNotEmpty ? SizedBox() : _empty(), + ), + _inputBox(), + ], + ), + ); + } + + Widget _empty() { + return Padding( + padding: EdgeInsets.symmetric(vertical: 10.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '今天我能帮您做点什么呢?', + style: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + ), + Padding( + padding: EdgeInsets.only(top: 10.w, bottom: 30.w), + child: Row( + children: [ + Icon( + Icons.audio_file_outlined, + size: 14.w, + color: Colors.grey[500], + ), + 2.horizontalSpace, + Text( + _controller.meetingData.value.title, + style: TextStyle( + color: Colors.grey[500], + fontSize: 12.sp, + ), + ), + ], + ), + ), + ...List.generate( + _cruxList.length, + (int index) => Container( + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 8.w), + margin: EdgeInsets.symmetric(vertical: 5.w), + decoration: BoxDecoration( + color: Colors.grey[100], + borderRadius: BorderRadius.circular(20.r), + border: Border.all( + color: Colors.grey[300]!, + ), + ), + child: Text( + _cruxList[index], + style: TextStyle(fontSize: 12.sp), + ), + ), + ), + ], + ), + ); + } + + Widget _inputBox() { + return Container( + height: 40.w, + padding: EdgeInsets.symmetric(horizontal: 10.w), + decoration: BoxDecoration(), + child: Row( + children: [], + ), + ); + } +} diff --git a/lib/modules/meeting/views/overview_tab.dart b/lib/modules/meeting/views/overview_tab.dart index 3f65ed1a9..0dde125c7 100644 --- a/lib/modules/meeting/views/overview_tab.dart +++ b/lib/modules/meeting/views/overview_tab.dart @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../controllers/meeting_details_controller.dart'; +import 'ai_bottom_sheet.dart'; import 'generate_bottom_sheet.dart'; class OverviewTab extends StatefulWidget { @@ -94,6 +95,23 @@ class _OverviewTabState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ + if (_controller.meetingDetails.value.tasktype >= 3) + _button( + Icons.auto_awesome, + 'Ask AI', + () { + Get.bottomSheet( + const AIBottomSheet(), + isScrollControlled: true, + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + top: Radius.circular(12.r), + ), + ), + ); + }, + ), if (_controller.meetingDetails.value.tasktype == 0) SizedBox( width: 150.w, diff --git a/lib/modules/meeting/views/speech_tab.dart b/lib/modules/meeting/views/speech_tab.dart index 8c043cfa5..c2530aa0d 100644 --- a/lib/modules/meeting/views/speech_tab.dart +++ b/lib/modules/meeting/views/speech_tab.dart @@ -5,6 +5,7 @@ import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import '../controllers/meeting_details_controller.dart'; +import 'ai_bottom_sheet.dart'; import 'generate_bottom_sheet.dart'; import 'speaker_all_bottom_sheet.dart'; import 'speaker_bottom_sheet.dart'; @@ -278,6 +279,24 @@ class SpeechTab extends GetView { ); }, ), + if (controller.meetingDetails.value.tasktype >= 2 && + !controller.isSpeakerText.value) + _button( + Icons.auto_awesome, + 'Ask AI', + () { + Get.bottomSheet( + const AIBottomSheet(), + isScrollControlled: true, + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + top: Radius.circular(12.r), + ), + ), + ); + }, + ), if (controller.meetingDetails.value.tasktype == 0) SizedBox( width: 150.w, diff --git a/lib/modules/meeting/views/summary_tab.dart b/lib/modules/meeting/views/summary_tab.dart index 65fe8b17e..42b050d3c 100644 --- a/lib/modules/meeting/views/summary_tab.dart +++ b/lib/modules/meeting/views/summary_tab.dart @@ -6,6 +6,7 @@ import 'package:get/get.dart'; import '../../../data/services/db/sqflite_api.dart'; import '../controllers/meeting_details_controller.dart'; +import 'ai_bottom_sheet.dart'; import 'generate_bottom_sheet.dart'; import 'speaker_all_bottom_sheet.dart'; @@ -310,6 +311,23 @@ class _SummaryTabState extends State { ); }, ), + if (_controller.meetingDetails.value.tasktype >= 3) + _button( + Icons.auto_awesome, + 'Ask AI', + () { + Get.bottomSheet( + const AIBottomSheet(), + isScrollControlled: true, + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + top: Radius.circular(12.r), + ), + ), + ); + }, + ), if (_controller.meetingDetails.value.tasktype == 0) SizedBox( width: 150.w,