From 7f0542b5ce4e3bf3edc44e5f22abc88dde2955c1 Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Sat, 24 May 2025 15:47:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=89=E6=8B=A9=E6=A8=A1?= =?UTF-8?q?=E7=89=88=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meeting/bindings/template_binding.dart | 10 + .../controllers/template_controller.dart | 3 + .../meeting/views/generate_bottom_sheet.dart | 301 +++++++++++------- lib/modules/meeting/views/template_view.dart | 50 +++ lib/routes/app_pages.dart | 9 + lib/routes/app_routes.dart | 1 + 6 files changed, 258 insertions(+), 116 deletions(-) create mode 100644 lib/modules/meeting/bindings/template_binding.dart create mode 100644 lib/modules/meeting/controllers/template_controller.dart create mode 100644 lib/modules/meeting/views/template_view.dart diff --git a/lib/modules/meeting/bindings/template_binding.dart b/lib/modules/meeting/bindings/template_binding.dart new file mode 100644 index 000000000..414f2f659 --- /dev/null +++ b/lib/modules/meeting/bindings/template_binding.dart @@ -0,0 +1,10 @@ +import 'package:get/get.dart'; +import '../controllers/template_controller.dart'; + +class TemplateBinding extends Bindings { + @override + void dependencies() { + // 注册控制器 + Get.lazyPut(() => TemplateController()); + } +} diff --git a/lib/modules/meeting/controllers/template_controller.dart b/lib/modules/meeting/controllers/template_controller.dart new file mode 100644 index 000000000..e61cec694 --- /dev/null +++ b/lib/modules/meeting/controllers/template_controller.dart @@ -0,0 +1,3 @@ +import 'package:get/get.dart'; + +class TemplateController extends GetxController {} diff --git a/lib/modules/meeting/views/generate_bottom_sheet.dart b/lib/modules/meeting/views/generate_bottom_sheet.dart index c23066b17..e3a14eb60 100644 --- a/lib/modules/meeting/views/generate_bottom_sheet.dart +++ b/lib/modules/meeting/views/generate_bottom_sheet.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import '../../../routes/app_routes.dart'; import '../controllers/meeting_details_controller.dart'; import 'record_language_bottom_sheet.dart'; @@ -20,6 +21,44 @@ class _GenerateBottomSheetState extends State { String _language = 'zh-CN'; int _templateId = 0; + int _lastTemplateId = 0; + final List _templateList = [ + { + 'id': 1, + 'name': '会议纪要', + 'icon': Icons.auto_stories, + 'tag': ['主题', '代办事项'], + 'desc': '', + }, + { + 'id': 2, + 'name': 'Autopilot', + 'icon': Icons.auto_graph, + 'tag': ['自适应结构', '全场景适配'], + 'desc': '', + }, + { + 'id': 3, + 'name': '推理Autopilot', + 'icon': Icons.add_to_drive_outlined, + 'tag': ['推理模型', '自动结构化'], + 'desc': '', + }, + { + 'id': 4, + 'name': '通话', + 'icon': Icons.perm_phone_msg, + 'tag': ['主题', '代办事项'], + 'desc': '', + }, + { + 'id': 5, + 'name': '自定义', + 'icon': Icons.auto_fix_high, + 'tag': [], + 'desc': '自定义模版', + }, + ]; @override Widget build(BuildContext context) { @@ -97,20 +136,32 @@ class _GenerateBottomSheetState extends State { ), ), ), - Row( - children: [ - Text( - '查看全部', - style: TextStyle( - fontSize: 12.sp, - color: Colors.grey, + GestureDetector( + onTap: () async { + var result = await Get.toNamed(Routes.template, arguments: { + 'id': _templateId, + }); + if (result != null) { + setState(() { + _templateId = result; + }); + } + }, + child: Row( + children: [ + Text( + '查看全部', + style: TextStyle( + fontSize: 12.sp, + color: Colors.grey, + ), ), - ), - const Icon( - Icons.keyboard_arrow_right, - color: Colors.grey, - ) - ], + const Icon( + Icons.keyboard_arrow_right, + color: Colors.grey, + ) + ], + ), ), ], ), @@ -119,11 +170,12 @@ class _GenerateBottomSheetState extends State { height: 130.w, margin: EdgeInsets.only(bottom: 16.w), child: ListView.builder( - itemCount: 10, + itemCount: _templateList.length, scrollDirection: Axis.horizontal, padding: EdgeInsets.symmetric(horizontal: 4.w), itemBuilder: (BuildContext context, int index) { - return _item(); + Map data = _templateList[index]; + return _item(data); }, ), ), @@ -208,7 +260,7 @@ class _GenerateBottomSheetState extends State { ); } - Widget _item() { + Widget _item(Map data) { return Container( width: 200.w, margin: EdgeInsets.symmetric(horizontal: 8.w), @@ -216,119 +268,136 @@ class _GenerateBottomSheetState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(14.w), ), - child: Stack( - children: [ - Container( - padding: EdgeInsets.all(5.w), - decoration: const BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.pinkAccent], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - child: Container( - width: double.infinity, - padding: EdgeInsets.all(10.w), + child: GestureDetector( + onTap: () { + setState(() { + _templateId = data['id']; + }); + }, + child: Stack( + children: [ + Container( + padding: EdgeInsets.all(5.w), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.w), color: Colors.white, + gradient: _templateId == data['id'] + ? const LinearGradient( + colors: [Colors.blue, Colors.pinkAccent], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ) + : null, ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 5.w), - child: Icon( - Icons.perm_phone_msg, - color: Colors.orange, - size: 30.w, - ), - ), - Padding( - padding: EdgeInsets.symmetric(vertical: 10.w), - child: Text( - '会议纪要', - style: TextStyle( - fontSize: 16.sp, - color: Colors.black87, - fontWeight: FontWeight.bold, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(10.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.w), + color: Colors.white, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 5.w), + child: Icon( + data['icon'], + color: Colors.orange, + size: 30.w, ), ), - ), - Wrap( - children: [ - Container( - padding: EdgeInsets.symmetric( - horizontal: 5.w, vertical: 2.w), - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(4.r), - ), - child: Text( - '主题', - style: TextStyle( - fontSize: 10.sp, - color: Colors.grey[600], - ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.w), + child: Text( + data['name'], + style: TextStyle( + fontSize: 16.sp, + color: Colors.black87, + fontWeight: FontWeight.bold, ), ), - ], - ), - // Text( - // '主题主题主题主题主题主题主题主题主题主题', - // overflow: TextOverflow.ellipsis, - // style: TextStyle( - // fontSize: 12.sp, - // color: Colors.grey[600], - // ), - // ), - ], + ), + data['tag'].isNotEmpty + ? Wrap( + spacing: 5.w, + children: List.generate( + data['tag'].length, + (int idx) { + return Container( + padding: EdgeInsets.symmetric( + horizontal: 5.w, vertical: 2.w), + decoration: BoxDecoration( + color: Colors.grey[200], + borderRadius: BorderRadius.circular(4.r), + ), + child: Text( + data['tag'][idx], + style: TextStyle( + fontSize: 10.sp, + color: Colors.grey[600], + ), + ), + ); + }, + ), + ) + : Text( + data['desc'], + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + color: Colors.grey[600], + ), + ), + ], + ), ), ), - ), - Positioned( - top: 0, - left: 0, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 5.w, vertical: 1.w), - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(12.w), - bottomRight: Radius.circular(4.w), + if (_lastTemplateId == data['id']) + Positioned( + top: 0, + left: 0, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 5.w, vertical: 1.w), + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(12.w), + bottomRight: Radius.circular(4.w), + ), + ), + child: Text( + '上次使用', + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + fontWeight: FontWeight.bold, + ), + ), ), ), - child: Text( - '上次使用', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.bold, + if (_templateId == data['id']) + Positioned( + right: -18.w, + bottom: -18.w, + child: Container( + width: 40.w, + height: 40.w, + padding: EdgeInsets.all(2.w), + alignment: Alignment.topLeft, + decoration: BoxDecoration( + color: Colors.pinkAccent, + borderRadius: BorderRadius.circular(40.r), + ), + child: Icon( + Icons.check, + color: Colors.white, + size: 18.w, + ), ), ), - ), - ), - Positioned( - right: -18.w, - bottom: -18.w, - child: Container( - width: 40.w, - height: 40.w, - padding: EdgeInsets.all(2.w), - alignment: Alignment.topLeft, - decoration: BoxDecoration( - color: Colors.pinkAccent, - borderRadius: BorderRadius.circular(40.r), - ), - child: Icon( - Icons.check, - color: Colors.white, - size: 18.w, - ), - ), - ), - ], + ], + ), ), ); } diff --git a/lib/modules/meeting/views/template_view.dart b/lib/modules/meeting/views/template_view.dart new file mode 100644 index 000000000..0e8c963cf --- /dev/null +++ b/lib/modules/meeting/views/template_view.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../controllers/template_controller.dart'; + +class TemplateView extends GetView { + const TemplateView({super.key}); + + @override + Widget build(BuildContext context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; + + return Scaffold( + backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], + appBar: _buildAppBar(isDarkMode), + body: _buildBody(context, isDarkMode), + ); + } + + // 构建应用栏 + PreferredSizeWidget _buildAppBar(bool isDarkMode) { + return AppBar( + backgroundColor: isDarkMode ? Colors.black : Colors.white, + elevation: 0.5, + leading: IconButton( + icon: Icon( + Icons.arrow_back_ios, + color: isDarkMode ? Colors.white : Colors.black, + size: 20.sp, + ), + onPressed: () => Get.back(), + ), + title: Text( + '选择总结模版', + style: TextStyle( + fontSize: 17.sp, + fontWeight: FontWeight.w600, + color: isDarkMode ? Colors.white : Colors.black, + ), + ), + centerTitle: true, + ); + } + + // 构建主体内容 + Widget _buildBody(BuildContext context, bool isDarkMode) { + return Container(); + } +} diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index 0cf57c7b1..0918b9a72 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -7,8 +7,10 @@ import '../modules/explore/views/explore_view.dart'; import '../modules/explore/bindings/explore_binding.dart'; import '../modules/meeting/bindings/meeting_binding.dart'; import '../modules/meeting/bindings/meeting_details_binding.dart'; +import '../modules/meeting/bindings/template_binding.dart'; import '../modules/meeting/views/meeting_details_view.dart'; import '../modules/meeting/views/meeting_view.dart'; +import '../modules/meeting/views/template_view.dart'; import '../modules/profile/views/profile_view.dart'; import '../modules/profile/bindings/profile_binding.dart'; import '../modules/chat/bindings/chat_binding.dart'; @@ -140,6 +142,13 @@ abstract class AppPages { transition: Transition.rightToLeft, transitionDuration: Duration(milliseconds: 250), ), + GetPage( + name: Routes.template, + page: () => const TemplateView(), + binding: TemplateBinding(), + transition: Transition.rightToLeft, + transitionDuration: Duration(milliseconds: 250), + ), GetPage( name: Routes.timbre, page: () => const TimbreView(), diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index ca88986e8..d1bb1c277 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -22,6 +22,7 @@ abstract class Routes { // 会议相关 static const meeting = '/meeting'; static const meetingDetails = '/meetingDetails'; + static const template = '/template'; // 语言功能 static const translation = '/translation'; // 实时翻译