Browse Source

修改选择模版页面

newdev_shunjiawei
tanlongsheng 1 year ago
parent
commit
77c1c26871
  1. 33
      lib/modules/meeting/views/generate_bottom_sheet.dart
  2. 4
      lib/modules/meeting/views/meeting_details_view.dart
  3. 199
      lib/modules/meeting/views/meeting_view.dart
  4. 22
      lib/modules/meeting/views/speech_tab.dart
  5. 14
      lib/modules/meeting/views/summary_tab.dart
  6. 296
      lib/modules/meeting/views/template_all_view.dart
  7. 104
      lib/modules/meeting/views/template_view.dart
  8. 4
      pubspec.yaml

33
lib/modules/meeting/views/generate_bottom_sheet.dart

@ -30,6 +30,17 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> {
'auto_graph': Icons.auto_graph,
'add_to_drive_outlined': Icons.add_to_drive_outlined,
'perm_phone_msg': Icons.perm_phone_msg,
'assignment': Icons.assignment,
'lightbulb': Icons.lightbulb,
'note': Icons.note,
'rate_review': Icons.rate_review,
'event_repeat': Icons.event_repeat,
'handshake': Icons.handshake,
'restart_alt': Icons.restart_alt,
'rocket_launch': Icons.rocket_launch,
'code': Icons.code,
'bar_chart': Icons.bar_chart,
'school': Icons.school,
'auto_fix_high': Icons.auto_fix_high,
};
@ -145,11 +156,14 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> {
),
GestureDetector(
onTap: () async {
var result = await Get.to(TemplateView(
_templateData,
_lastTemplateData['id'] ?? 0,
_categoryTemplateList,
));
var result = await Get.to(
() => TemplateView(
_templateData,
_lastTemplateData['id'] ?? 0,
_categoryTemplateList,
),
preventDuplicates: false,
);
if (result != null) {
_scrollController.jumpTo(0);
List list = List.from(_originalTemplate);
@ -228,8 +242,8 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> {
value: _languageText,
isBorder: false,
onTap: () {
showModalBottomSheet(
context: context,
Get.bottomSheet(
RecordLanguageBottomSheet(_language),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
@ -237,9 +251,6 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> {
top: Radius.circular(12.r),
),
),
builder: (BuildContext context) {
return RecordLanguageBottomSheet(_language);
},
).then((value) {
if (value != null) {
setState(() {
@ -268,7 +279,7 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> {
_storage.write("meeting_last_template_Data", _templateData);
_storage.write("meeting_template_list", _templateList);
Get.back();
// _controller.summaryCreate();
_controller.summaryCreate();
},
child: Container(
height: 48.w,

4
lib/modules/meeting/views/meeting_details_view.dart

@ -22,7 +22,7 @@ class MeetingDetailsView extends GetView<MeetingDetailsController> {
() => Scaffold(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
appBar: _buildAppBar(isDarkMode),
body: _buildBody(context, isDarkMode),
body: _buildBody(isDarkMode),
),
);
}
@ -166,7 +166,7 @@ class MeetingDetailsView extends GetView<MeetingDetailsController> {
}
// 构建主体内容
Widget _buildBody(BuildContext context, bool isDarkMode) {
Widget _buildBody(bool isDarkMode) {
double initialPosition = 0;
return Column(
children: [

199
lib/modules/meeting/views/meeting_view.dart

@ -245,125 +245,120 @@ class MeetingView extends GetView<MeetingController> {
bool isDarkMode,
int id,
) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
clipBehavior: Clip.hardEdge,
builder: (BuildContext context) {
return Padding(
padding: MediaQuery.of(context).viewInsets,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 20.w),
color: isDarkMode ? AppColors.darkBackground : Colors.grey[50],
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'editMeetingTitle'.tr, // 编辑会议标题
Get.bottomSheet(
Padding(
padding: MediaQuery.of(context).viewInsets,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 20.w),
color: isDarkMode ? AppColors.darkBackground : Colors.grey[50],
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'editMeetingTitle'.tr, // 编辑会议标题
style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87,
fontSize: 16.sp,
),
),
Container(
height: 48.w,
margin: EdgeInsets.only(top: 10.w, bottom: 20.w),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isDarkMode
? Colors.white.withOpacity(0.05)
: Colors.white,
borderRadius: BorderRadius.circular(12.w),
boxShadow: [
BoxShadow(
color: isDarkMode
? Colors.black.withOpacity(0.2)
: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: TextField(
controller: controller.titleController,
style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87,
fontSize: 16.sp,
),
),
Container(
height: 48.w,
margin: EdgeInsets.only(top: 10.w, bottom: 20.w),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isDarkMode
? Colors.white.withOpacity(0.05)
: Colors.white,
borderRadius: BorderRadius.circular(12.w),
boxShadow: [
BoxShadow(
color: isDarkMode
? Colors.black.withOpacity(0.2)
: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: TextField(
controller: controller.titleController,
style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87,
decoration: InputDecoration(
hintText: 'maxCharacters'.tr,
hintStyle: TextStyle(
color: isDarkMode ? Colors.white70 : Colors.black54,
fontSize: 16.sp,
),
decoration: InputDecoration(
hintText: 'maxCharacters'.tr,
hintStyle: TextStyle(
color: isDarkMode ? Colors.white70 : Colors.black54,
fontSize: 16.sp,
),
fillColor: Colors.transparent,
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(horizontal: 10.w),
),
fillColor: Colors.transparent,
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(horizontal: 10.w),
),
),
Padding(
padding: EdgeInsets.only(top: 30.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
Get.back();
},
child: Container(
width: 120.w,
height: 40.w,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(
width: 2.w,
color:
isDarkMode ? AppColors.primary : Colors.blue,
),
borderRadius: BorderRadius.circular(12.w),
),
child: Text(
'cancel'.tr, // 取消
style: TextStyle(
fontSize: 14.sp,
color:
isDarkMode ? AppColors.primary : Colors.blue,
),
),
Padding(
padding: EdgeInsets.only(top: 30.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
Get.back();
},
child: Container(
width: 120.w,
height: 40.w,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(
width: 2.w,
color: isDarkMode ? AppColors.primary : Colors.blue,
),
borderRadius: BorderRadius.circular(12.w),
),
),
GestureDetector(
onTap: () {
String title = controller.titleController.text;
controller.editMeetingTitle(id, title);
},
child: Container(
width: 120.w,
height: 40.w,
alignment: Alignment.center,
decoration: BoxDecoration(
child: Text(
'cancel'.tr, // 取消
style: TextStyle(
fontSize: 14.sp,
color: isDarkMode ? AppColors.primary : Colors.blue,
borderRadius: BorderRadius.circular(12.w),
),
child: Text(
'confirm'.tr, // 确认
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,
),
),
),
),
GestureDetector(
onTap: () {
String title = controller.titleController.text;
controller.editMeetingTitle(id, title);
},
child: Container(
width: 120.w,
height: 40.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: isDarkMode ? AppColors.primary : Colors.blue,
borderRadius: BorderRadius.circular(12.w),
),
child: Text(
'confirm'.tr, // 确认
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,
),
),
),
],
),
),
],
),
],
),
),
],
),
);
},
),
),
isScrollControlled: true,
clipBehavior: Clip.hardEdge,
);
}
}

22
lib/modules/meeting/views/speech_tab.dart

@ -52,8 +52,8 @@ class SpeechTab extends GetView<MeetingDetailsController> {
GestureDetector(
onTap: () {
if (controller.isSpeakerText.value) return;
showModalBottomSheet(
context: context,
Get.bottomSheet(
SpeakerBottomSheet(item['id'], item['speaker']),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
@ -61,10 +61,6 @@ class SpeechTab extends GetView<MeetingDetailsController> {
top: Radius.circular(12.r),
),
),
builder: (BuildContext context) {
return SpeakerBottomSheet(
item['id'], item['speaker']);
},
);
},
child: Padding(
@ -270,8 +266,8 @@ class SpeechTab extends GetView<MeetingDetailsController> {
Icons.supervisor_account,
'命名发言者',
() {
showModalBottomSheet(
context: context,
Get.bottomSheet(
const SpeakerAllBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
@ -279,9 +275,6 @@ class SpeechTab extends GetView<MeetingDetailsController> {
top: Radius.circular(12.r),
),
),
builder: (BuildContext context) {
return const SpeakerAllBottomSheet();
},
);
},
),
@ -292,8 +285,8 @@ class SpeechTab extends GetView<MeetingDetailsController> {
Icons.auto_awesome,
'生成',
() {
showModalBottomSheet(
context: context,
Get.bottomSheet(
const GenerateBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
@ -301,9 +294,6 @@ class SpeechTab extends GetView<MeetingDetailsController> {
top: Radius.circular(12.r),
),
),
builder: (BuildContext context) {
return const GenerateBottomSheet();
},
);
},
),

14
lib/modules/meeting/views/summary_tab.dart

@ -298,8 +298,8 @@ class _SummaryTabState extends State<SummaryTab> {
Icons.supervisor_account,
'编辑发言者',
() {
showModalBottomSheet(
context: context,
Get.bottomSheet(
const SpeakerAllBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
@ -307,9 +307,6 @@ class _SummaryTabState extends State<SummaryTab> {
top: Radius.circular(12.r),
),
),
builder: (BuildContext context) {
return const SpeakerAllBottomSheet();
},
);
},
),
@ -320,8 +317,8 @@ class _SummaryTabState extends State<SummaryTab> {
Icons.auto_awesome,
'生成',
() {
showModalBottomSheet(
context: context,
Get.bottomSheet(
const GenerateBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
@ -329,9 +326,6 @@ class _SummaryTabState extends State<SummaryTab> {
top: Radius.circular(12.r),
),
),
builder: (BuildContext context) {
return const GenerateBottomSheet();
},
);
},
),

296
lib/modules/meeting/views/template_all_view.dart

@ -0,0 +1,296 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../data/services/db/sqflite_api.dart';
class TemplateAllView extends StatefulWidget {
final String title;
final int categoryid;
final Map templateData;
final int lastTemplateId;
const TemplateAllView(
this.title, this.categoryid, this.templateData, this.lastTemplateId,
{super.key});
@override
State<TemplateAllView> createState() => _TemplateAllViewState();
}
class _TemplateAllViewState extends State<TemplateAllView> {
final Map _icons = {
'auto_stories': Icons.auto_stories,
'auto_graph': Icons.auto_graph,
'add_to_drive_outlined': Icons.add_to_drive_outlined,
'perm_phone_msg': Icons.perm_phone_msg,
'assignment': Icons.assignment,
'lightbulb': Icons.lightbulb,
'note': Icons.note,
'rate_review': Icons.rate_review,
'event_repeat': Icons.event_repeat,
'handshake': Icons.handshake,
'restart_alt': Icons.restart_alt,
'rocket_launch': Icons.rocket_launch,
'code': Icons.code,
'bar_chart': Icons.bar_chart,
'school': Icons.school,
'auto_fix_high': Icons.auto_fix_high,
};
List _templateList = [];
Map _templateData = {};
@override
void initState() {
super.initState();
_getTemplate();
}
void _getTemplate() async {
List list = await SqfliteApi.getMeetingTemplateList(widget.categoryid);
List templateList = [];
for (var element in list) {
Map item = {
...element,
'tag': element['tag'].isNotEmpty ? element['tag'].split(',') : [],
};
if (element['id'] == widget.templateData['id']) {
templateList.insert(0, item);
_templateData = widget.templateData;
} else {
templateList.add(item);
}
}
setState(() {
_templateList = templateList;
});
}
@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(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(
widget.title,
style: TextStyle(
fontSize: 17.sp,
fontWeight: FontWeight.w600,
color: isDarkMode ? Colors.white : Colors.black,
),
),
centerTitle: true,
);
}
// 构建主体内容
Widget _buildBody(bool isDarkMode) {
return Column(
children: [
Expanded(
child: GridView.builder(
itemCount: _templateList.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 12.w,
crossAxisSpacing: 12.w,
childAspectRatio: 1.sw / 2 / 150.w,
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 20.w),
itemBuilder: (BuildContext context, int index) {
Map data = _templateList[index];
return _item(data);
},
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 20.w),
child: GestureDetector(
onTap: () {
if (_templateData.isNotEmpty) {
Get.back();
Get.back(result: _templateData);
}
},
child: Container(
height: 48.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: _templateData.isNotEmpty ? Colors.black : Colors.grey,
borderRadius: BorderRadius.circular(12.r),
),
child: Text(
'就用这个模版',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
),
),
),
),
),
],
);
}
Widget _item(Map template) {
return Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14.w),
),
child: GestureDetector(
onTap: () {
setState(() {
_templateData = template;
});
},
child: Stack(
children: [
Container(
padding: EdgeInsets.all(5.w),
decoration: BoxDecoration(
color: Colors.white,
gradient: _templateData['id'] == template['id']
? const LinearGradient(
colors: [Colors.blue, Colors.pinkAccent],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
)
: null,
),
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(
_icons[template['icon']],
color: Colors.orange,
size: 30.w,
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.w),
child: Text(
template['name'],
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
fontWeight: FontWeight.bold,
),
),
),
template['tag'].isNotEmpty
? Wrap(
spacing: 5.w,
children: List.generate(
template['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(
template['tag'][idx],
style: TextStyle(
fontSize: 10.sp,
color: Colors.grey[600],
),
),
);
},
),
)
: Text(
template['desc'],
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
color: Colors.grey[600],
),
),
],
),
),
),
if (widget.lastTemplateId == template['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,
),
),
),
),
if (_templateData['id'] == template['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,
),
),
),
],
),
),
);
}
}

104
lib/modules/meeting/views/template_view.dart

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'template_all_view.dart';
class TemplateView extends StatefulWidget {
final Map templateData;
final int lastTemplateId;
@ -20,30 +22,54 @@ class _TemplateViewState extends State<TemplateView> {
'auto_graph': Icons.auto_graph,
'add_to_drive_outlined': Icons.add_to_drive_outlined,
'perm_phone_msg': Icons.perm_phone_msg,
'assignment': Icons.assignment,
'lightbulb': Icons.lightbulb,
'note': Icons.note,
'rate_review': Icons.rate_review,
'event_repeat': Icons.event_repeat,
'handshake': Icons.handshake,
'restart_alt': Icons.restart_alt,
'rocket_launch': Icons.rocket_launch,
'code': Icons.code,
'bar_chart': Icons.bar_chart,
'school': Icons.school,
'auto_fix_high': Icons.auto_fix_high,
};
final List _categoryTemplateList = [];
Map _templateData = {};
@override
void initState() {
super.initState();
Map templateMap = widget.categoryList.firstWhere(
(item) => item['id'] == widget.templateData['categoryid'],
orElse: () => {},
);
if (templateMap.isNotEmpty) {
List template = templateMap['template'];
int index =
template.indexWhere((v) => v['id'] == widget.templateData['id']);
if (index != -1) {
Map itemToMove = template.removeAt(index);
template.insert(0, itemToMove);
} else {
template.insert(0, widget.templateData);
_getTemplate();
}
void _getTemplate() async {
for (var element in widget.categoryList) {
List templateList = [];
bool isAdd = false;
if (element['id'] == widget.templateData['categoryid']) {
isAdd = true;
}
for (var template in element['template']) {
if (template['id'] == widget.templateData['id']) {
isAdd = false;
templateList.insert(0, template);
} else {
templateList.add(template);
}
}
if (isAdd) {
templateList.insert(0, widget.templateData);
}
_templateData = widget.templateData;
_categoryTemplateList.add({
'id': element['id'],
'name': element['name'],
'template': templateList,
});
}
_templateData = widget.templateData;
}
@override
@ -53,7 +79,7 @@ class _TemplateViewState extends State<TemplateView> {
return Scaffold(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
appBar: _buildAppBar(isDarkMode),
body: _buildBody(context, isDarkMode),
body: _buildBody(isDarkMode),
);
}
@ -83,14 +109,14 @@ class _TemplateViewState extends State<TemplateView> {
}
// 构建主体内容
Widget _buildBody(BuildContext context, bool isDarkMode) {
Widget _buildBody(bool isDarkMode) {
return Column(
children: [
Expanded(
child: ListView.builder(
itemCount: widget.categoryList.length,
itemCount: _categoryTemplateList.length,
itemBuilder: (BuildContext context, int index) {
Map data = widget.categoryList[index];
Map data = _categoryTemplateList[index];
return _item(data);
},
),
@ -125,23 +151,33 @@ class _TemplateViewState extends State<TemplateView> {
Widget _item(Map data) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.w),
child: Row(
children: [
Text(
data['name'],
style: TextStyle(
fontSize: 18.sp,
color: Colors.black87,
fontWeight: FontWeight.bold,
GestureDetector(
onTap: () {
Get.to(() => TemplateAllView(
data['name'],
data['id'],
_templateData,
widget.lastTemplateId,
));
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.w),
child: Row(
children: [
Text(
data['name'],
style: TextStyle(
fontSize: 18.sp,
color: Colors.black87,
fontWeight: FontWeight.bold,
),
),
),
const Icon(
Icons.keyboard_arrow_right,
color: Colors.grey,
)
],
const Icon(
Icons.keyboard_arrow_right,
color: Colors.grey,
)
],
),
),
),
Container(

4
pubspec.yaml

@ -12,7 +12,7 @@ dependencies:
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.6
get: ^4.6.6
get: ^4.7.2
json_annotation: ^4.9.0
get_storage: ^2.1.1
http: ^1.3.0
@ -31,7 +31,7 @@ dependencies:
logger: ^2.0.2+1
flutter_blue_plus: ^1.31.16
just_audio: ^0.9.36
webview_flutter: ^4.12.0
webview_flutter: ^4.13.0
flutter_easyloading: ^3.0.5
package_info_plus: ^8.3.0
file_picker: ^10.1.5

Loading…
Cancel
Save