|
|
|
@ -210,86 +210,82 @@ class TranslationDetailView extends GetView<TranslationDetailController> { |
|
|
|
|
|
|
|
// 构建会话详情中的翻译项 |
|
|
|
Widget _buildSessionItemWidget(TranslationItem item, bool isDarkMode) { |
|
|
|
final context = Get.context!; |
|
|
|
return Container( |
|
|
|
width: double.infinity, |
|
|
|
margin: EdgeInsets.only(bottom: 16.h), |
|
|
|
margin: const EdgeInsets.only(bottom: 8), |
|
|
|
padding: const EdgeInsets.all(12), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? AppColors.cardBackground : Colors.white, |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withAlpha(isDarkMode ? 30 : 8), |
|
|
|
blurRadius: 8, |
|
|
|
offset: Offset(0, 2), |
|
|
|
color: item.isIntermediate |
|
|
|
? Colors.grey.withOpacity(0.1) // 中间结果使用浅灰色底色 |
|
|
|
: (item.sourceLanguageCode == controller.currentItem.sourceLanguageCode |
|
|
|
? Theme.of(context) |
|
|
|
.colorScheme |
|
|
|
.primary |
|
|
|
.withOpacity(0.08) // 源语言匹配时使用主题色底色 |
|
|
|
: Theme.of(context) |
|
|
|
.colorScheme |
|
|
|
.secondary |
|
|
|
.withOpacity(0.08)), // 否则使用次要色底色 |
|
|
|
borderRadius: BorderRadius.circular(12), |
|
|
|
border: Border.all( |
|
|
|
color: item.isIntermediate |
|
|
|
? Colors.grey.withOpacity(0.2) |
|
|
|
: Colors.transparent, |
|
|
|
width: 1, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
// 源文本部分 |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.fromLTRB(20.r, 20.r, 20.r, 10.r), |
|
|
|
child: Text( |
|
|
|
// 源文本 |
|
|
|
Text( |
|
|
|
item.sourceText, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15.sp, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
fontSize: 16, |
|
|
|
color: Theme.of(context).textTheme.bodyLarge?.color, |
|
|
|
), |
|
|
|
), |
|
|
|
// 翻译文本部分 |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.fromLTRB(20.r, 10.r, 20.r, 16.r), |
|
|
|
child: Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
if (item.translatedText.isNotEmpty) ...[ |
|
|
|
const SizedBox(height: 8), |
|
|
|
// 翻译文本 |
|
|
|
Text( |
|
|
|
item.translatedText, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[700], |
|
|
|
fontWeight: FontWeight.normal, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 12.w), |
|
|
|
_buildPlayButton(() => controller.playTranslationItem(item), isDarkMode), |
|
|
|
], |
|
|
|
fontSize: 16, |
|
|
|
color: Theme.of(context).textTheme.bodyMedium?.color, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
// 语言信息和播放按钮 |
|
|
|
const SizedBox(height: 4), |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
'${item.sourceLanguageName.tr} → ${item.targetLanguageName.tr}', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12, |
|
|
|
color: Theme.of(context).textTheme.bodySmall?.color, |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 构建播放按钮 |
|
|
|
Widget _buildPlayButton(VoidCallback onTap, bool isDarkMode) { |
|
|
|
return Material( |
|
|
|
color: Colors.transparent, |
|
|
|
child: InkWell( |
|
|
|
onTap: onTap, |
|
|
|
borderRadius: BorderRadius.circular(20.r), |
|
|
|
splashColor: isDarkMode ? AppColors.primary.withOpacity(0.2) : Colors.blue.withOpacity(0.2), |
|
|
|
child: Container( |
|
|
|
width: 28.w, |
|
|
|
height: 28.h, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? AppColors.primary.withAlpha(10) : Colors.blue.withAlpha(10), |
|
|
|
shape: BoxShape.circle, |
|
|
|
), |
|
|
|
if (!item.isIntermediate) |
|
|
|
GestureDetector( |
|
|
|
onTap: () => controller.playTranslationItem(item), |
|
|
|
child: Icon( |
|
|
|
Icons.volume_up, |
|
|
|
color: Colors.white, |
|
|
|
size: 16.sp, |
|
|
|
size: 20, |
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 构建总结视图 |
|
|
|
Widget _buildSummaryWidget(bool isDarkMode) { |
|
|
|
final String combinedSourceText = _getCombinedSourceText(); |
|
|
|
|