|
|
|
@ -97,6 +97,50 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
Widget _item(BuildContext context, bool isDarkMode, MeetingModel data) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: () {}, |
|
|
|
onLongPressStart: (details) { |
|
|
|
RenderBox? renderBox = |
|
|
|
Overlay.of(context).context.findRenderObject() as RenderBox; |
|
|
|
final RelativeRect position = RelativeRect.fromRect( |
|
|
|
Rect.fromLTRB( |
|
|
|
details.globalPosition.dx, |
|
|
|
details.globalPosition.dy, |
|
|
|
details.globalPosition.dx + 110, // 菜单显示位置X轴坐标 |
|
|
|
details.globalPosition.dy - 40, // 菜单显示位置Y轴坐标 |
|
|
|
), |
|
|
|
Offset.zero & renderBox.size, |
|
|
|
); |
|
|
|
|
|
|
|
showMenu( |
|
|
|
context: context, |
|
|
|
position: position, |
|
|
|
color: isDarkMode ? AppColors.cardBackground : Colors.white, |
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
|
), |
|
|
|
items: [ |
|
|
|
_popupMenuEntry( |
|
|
|
Icon( |
|
|
|
Icons.edit_calendar, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
'编辑', |
|
|
|
isDarkMode ? Colors.white : Colors.black87, |
|
|
|
() { |
|
|
|
controller.titleController.text = data.title; |
|
|
|
_bottomSheet(context, isDarkMode, id: data.id); |
|
|
|
}, |
|
|
|
), |
|
|
|
_popupMenuEntry( |
|
|
|
const Icon(Icons.delete_outline, color: Colors.red), |
|
|
|
'删除', |
|
|
|
isDarkMode ? Colors.white : Colors.black87, |
|
|
|
() { |
|
|
|
controller.deleteMeeting(data.id); |
|
|
|
}, |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 8.w), |
|
|
|
margin: EdgeInsets.symmetric(vertical: 5.w), |
|
|
|
@ -172,7 +216,35 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
void _bottomSheet(BuildContext context, bool isDarkMode) { |
|
|
|
PopupMenuEntry _popupMenuEntry( |
|
|
|
Icon icon, |
|
|
|
String title, |
|
|
|
Color color, |
|
|
|
Function() onTap, |
|
|
|
) { |
|
|
|
return PopupMenuItem( |
|
|
|
onTap: onTap, |
|
|
|
child: SizedBox( |
|
|
|
width: 120.w, |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
icon, |
|
|
|
8.horizontalSpace, |
|
|
|
Text( |
|
|
|
title, |
|
|
|
style: TextStyle(color: color), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
void _bottomSheet( |
|
|
|
BuildContext context, |
|
|
|
bool isDarkMode, { |
|
|
|
int? id, |
|
|
|
}) { |
|
|
|
showModalBottomSheet( |
|
|
|
context: context, |
|
|
|
isScrollControlled: true, |
|
|
|
@ -188,7 +260,7 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
'录音标题(非必填)', |
|
|
|
id != null ? '修改录音标题(非必填)' : '录音标题(非必填)', |
|
|
|
style: TextStyle( |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
fontSize: 16.sp, |
|
|
|
@ -266,14 +338,18 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
onTap: () { |
|
|
|
int time = DateTime.now().millisecondsSinceEpoch; |
|
|
|
String title = controller.titleController.text; |
|
|
|
if (title.isEmpty) { |
|
|
|
title = |
|
|
|
'${DateUtil.formatDateMs(time, format: DateFormats.y_mo_d)} 录音'; |
|
|
|
if (id != null) { |
|
|
|
controller.editMeetingTitle(id, title); |
|
|
|
} else { |
|
|
|
if (title.isEmpty) { |
|
|
|
title = |
|
|
|
'${DateUtil.formatDateMs(time, format: DateFormats.y_mo_d)} 录音'; |
|
|
|
} |
|
|
|
Get.back(); |
|
|
|
Get.toNamed(Routes.meetingRecord, arguments: { |
|
|
|
'title': title, |
|
|
|
}); |
|
|
|
} |
|
|
|
Get.back(); |
|
|
|
Get.toNamed(Routes.meetingRecord, arguments: { |
|
|
|
'title': title, |
|
|
|
}); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
width: 120.w, |
|
|
|
|