|
|
@ -258,7 +258,7 @@ class TranslationDetailView extends GetView<TranslationDetailController> { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
// 语言信息和播放按钮 |
|
|
// 语言信息和操作按钮 |
|
|
const SizedBox(height: 4), |
|
|
const SizedBox(height: 4), |
|
|
Row( |
|
|
Row( |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
@ -270,15 +270,39 @@ class TranslationDetailView extends GetView<TranslationDetailController> { |
|
|
color: Theme.of(context).textTheme.bodySmall?.color, |
|
|
color: Theme.of(context).textTheme.bodySmall?.color, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
if (!item.isIntermediate) |
|
|
Row( |
|
|
GestureDetector( |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
onTap: () => controller.playTranslationItem(item), |
|
|
children: [ |
|
|
child: Icon( |
|
|
// 删除按钮 |
|
|
Icons.volume_up, |
|
|
if (!item.isIntermediate) |
|
|
size: 20, |
|
|
InkWell( |
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
onTap: () => _showDeleteItemConfirmDialog(item), |
|
|
), |
|
|
borderRadius: BorderRadius.circular(6.r), |
|
|
), |
|
|
splashColor: Colors.red.withValues(alpha: 0.1), |
|
|
|
|
|
highlightColor: Colors.red.withValues(alpha: 0.05), |
|
|
|
|
|
child: Container( |
|
|
|
|
|
padding: EdgeInsets.all(6.w), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
Icons.delete_outline, |
|
|
|
|
|
size: 16.sp, |
|
|
|
|
|
color: isDarkMode ? Colors.grey[500] : Colors.grey[400], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
// 播放按钮 |
|
|
|
|
|
if (!item.isIntermediate) ...[ |
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
GestureDetector( |
|
|
|
|
|
onTap: () => controller.playTranslationItem(item), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
Icons.volume_up, |
|
|
|
|
|
size: 20.sp, |
|
|
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
@ -592,6 +616,102 @@ class TranslationDetailView extends GetView<TranslationDetailController> { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 显示删除单条记录确认对话框 |
|
|
|
|
|
void _showDeleteItemConfirmDialog(TranslationItem item) { |
|
|
|
|
|
final isDarkMode = Get.isDarkMode; |
|
|
|
|
|
|
|
|
|
|
|
Get.dialog( |
|
|
|
|
|
AlertDialog( |
|
|
|
|
|
backgroundColor: isDarkMode ? AppColors.cardBackground : Colors.white, |
|
|
|
|
|
title: Text( |
|
|
|
|
|
'删除翻译记录', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 18.sp, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
content: Column( |
|
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Text( |
|
|
|
|
|
'确定要删除这条翻译记录吗?此操作无法撤销。', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
color: isDarkMode ? Colors.grey[300] : Colors.black87, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(height: 12.h), |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.all(12.w), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: isDarkMode ? Colors.grey[800] : Colors.grey[100], |
|
|
|
|
|
borderRadius: BorderRadius.circular(8.r), |
|
|
|
|
|
), |
|
|
|
|
|
child: Column( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Text( |
|
|
|
|
|
item.sourceText, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
color: isDarkMode ? Colors.grey[300] : Colors.black87, |
|
|
|
|
|
), |
|
|
|
|
|
maxLines: 2, |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
if (item.translatedText.isNotEmpty) ...[ |
|
|
|
|
|
SizedBox(height: 4.h), |
|
|
|
|
|
Text( |
|
|
|
|
|
item.translatedText, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
color: isDarkMode ? Colors.grey[400] : Colors.black54, |
|
|
|
|
|
), |
|
|
|
|
|
maxLines: 2, |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
actions: [ |
|
|
|
|
|
TextButton( |
|
|
|
|
|
onPressed: () => Get.back(), |
|
|
|
|
|
child: Text( |
|
|
|
|
|
'cancel'.tr, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
TextButton( |
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
Get.back(); |
|
|
|
|
|
// 删除指定的翻译记录 |
|
|
|
|
|
controller.deleteTranslationItem(item); |
|
|
|
|
|
}, |
|
|
|
|
|
child: Text( |
|
|
|
|
|
'confirm'.tr, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
color: Colors.red, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 分享内容方法 |
|
|
// 分享内容方法 |
|
|
void _shareContent() { |
|
|
void _shareContent() { |
|
|
String shareText = ''; |
|
|
String shareText = ''; |
|
|
|