|
|
|
@ -419,6 +419,15 @@ class TranslationView extends GetView<TranslationController> { |
|
|
|
BuildContext context, TranslationItem item) { |
|
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
|
|
|
|
|
// 定义自适应颜色 |
|
|
|
final selfColor = isDarkMode |
|
|
|
? Colors.blue[800]!.withOpacity(0.15) // 深色模式:深蓝+透明度 |
|
|
|
: Colors.blue[50]!; // 浅色模式:浅蓝 |
|
|
|
|
|
|
|
final otherColor = isDarkMode |
|
|
|
? Colors.green[800]!.withOpacity(0.15) // 深色模式:深绿+透明度 |
|
|
|
: Colors.green[50]!; // 浅色模式:浅绿 |
|
|
|
|
|
|
|
return GestureDetector( |
|
|
|
onLongPressStart: (details) => _onLongPressTranslationItem( |
|
|
|
context, |
|
|
|
@ -431,20 +440,14 @@ class TranslationView extends GetView<TranslationController> { |
|
|
|
padding: const EdgeInsets.all(12), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: item.isIntermediate |
|
|
|
? Colors.grey.withOpacity(0.1) // 中间结果使用浅灰色底色 |
|
|
|
? Colors.grey.withOpacity(isDarkMode ? 0.15 : 0.1) // 中间结果 |
|
|
|
: (item.sourceLanguageCode == controller.sourceLanguageCode.value |
|
|
|
? Theme.of(context) |
|
|
|
.colorScheme |
|
|
|
.primary |
|
|
|
.withOpacity(0.08) // 源语言匹配时使用主题色底色 |
|
|
|
: Theme.of(context) |
|
|
|
.colorScheme |
|
|
|
.secondary |
|
|
|
.withOpacity(0.08)), // 否则使用次要色底色 |
|
|
|
? selfColor // 自己说的话 |
|
|
|
: otherColor), // 对方说的话 |
|
|
|
borderRadius: BorderRadius.circular(12), |
|
|
|
border: Border.all( |
|
|
|
color: item.isIntermediate |
|
|
|
? Colors.grey.withOpacity(0.2) |
|
|
|
? Colors.grey.withOpacity(isDarkMode ? 0.3 : 0.2) |
|
|
|
: Colors.transparent, |
|
|
|
width: 1, |
|
|
|
), |
|
|
|
|