|
|
|
@ -208,8 +208,9 @@ class TranslationView extends GetView<TranslationController> { |
|
|
|
children: [ |
|
|
|
// 悬浮窗切换按钮(仅在支持的模式下显示) |
|
|
|
Obx(() { |
|
|
|
if (controller.currentMode.value == 'call' || |
|
|
|
controller.currentMode.value == 'audioVideo') { |
|
|
|
if (Platform.isAndroid && |
|
|
|
(controller.currentMode.value == 'call' || |
|
|
|
controller.currentMode.value == 'audioVideo')) { |
|
|
|
return IconButton( |
|
|
|
icon: Icon( |
|
|
|
controller.isFloatingWindowEnabled.value |
|
|
|
@ -269,106 +270,150 @@ class TranslationView extends GetView<TranslationController> { |
|
|
|
}), |
|
|
|
], |
|
|
|
bottom: PreferredSize( |
|
|
|
preferredSize: Size.fromHeight(50.h), |
|
|
|
preferredSize: Size.fromHeight( |
|
|
|
controller.currentMode.value == 'call' ? 70.h : 50.h, |
|
|
|
), |
|
|
|
child: Padding( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
child: Column( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
// 源语言选择 |
|
|
|
Expanded( |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () => LanguageSelectionDialog.show(true, isDarkMode), |
|
|
|
child: Container( |
|
|
|
padding: |
|
|
|
EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
// 原语言选择行 |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
// 源语言选择 |
|
|
|
Expanded( |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () => |
|
|
|
LanguageSelectionDialog.show(true, isDarkMode), |
|
|
|
child: Container( |
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
horizontal: 8.w, vertical: 4.h), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Obx(() => Text( |
|
|
|
'${controller.sourceLanguage.value.split(' ')[0]}' |
|
|
|
.tr, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
|
), |
|
|
|
textAlign: TextAlign.center, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
)), |
|
|
|
), |
|
|
|
), |
|
|
|
child: Obx(() => Text( |
|
|
|
'${controller.sourceLanguage.value.split(' ')[0]}' |
|
|
|
.tr, // Just show the Chinese part |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
|
), |
|
|
|
textAlign: TextAlign.center, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
)), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
// 语言互换按钮 |
|
|
|
GestureDetector( |
|
|
|
onTap: controller.swapLanguages, |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.symmetric(horizontal: 8.w), |
|
|
|
padding: EdgeInsets.all(4.r), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? AppColors.primary.withOpacity(0.2) |
|
|
|
: Colors.blue[50], |
|
|
|
shape: BoxShape.circle, |
|
|
|
// 语言互换按钮 |
|
|
|
GestureDetector( |
|
|
|
onTap: controller.swapLanguages, |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.symmetric(horizontal: 8.w), |
|
|
|
padding: EdgeInsets.all(4.r), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? AppColors.primary.withOpacity(0.2) |
|
|
|
: Colors.blue[50], |
|
|
|
shape: BoxShape.circle, |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
Icons.swap_horiz, |
|
|
|
color: isDarkMode ? AppColors.primary : Colors.blue, |
|
|
|
size: 20.sp, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
Icons.swap_horiz, |
|
|
|
color: isDarkMode ? AppColors.primary : Colors.blue, |
|
|
|
size: 20.sp, |
|
|
|
|
|
|
|
// 目标语言选择 |
|
|
|
Expanded( |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () => |
|
|
|
LanguageSelectionDialog.show(false, isDarkMode), |
|
|
|
child: Container( |
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
horizontal: 8.w, vertical: 4.h), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Obx(() => Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Flexible( |
|
|
|
child: Text( |
|
|
|
'${controller.targetLanguage.value.split(' ')[0]}' |
|
|
|
.tr, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white |
|
|
|
: Colors.black, |
|
|
|
), |
|
|
|
textAlign: TextAlign.center, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
), |
|
|
|
//只在通话翻译模式下显示电话图标 |
|
|
|
if (controller.currentMode.value == 'call') ...[ |
|
|
|
SizedBox(width: 4.w), |
|
|
|
Icon( |
|
|
|
Icons.phone_in_talk, |
|
|
|
size: 20.sp, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white70 |
|
|
|
: Colors.grey[600], |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
)), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
|
|
|
|
// 目标语言选择 |
|
|
|
Expanded( |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () => LanguageSelectionDialog.show(false, isDarkMode), |
|
|
|
child: Container( |
|
|
|
padding: |
|
|
|
EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
// 通话模式下的“对方 / 我”标签行 |
|
|
|
if (controller.currentMode.value == 'call') ...[ |
|
|
|
SizedBox(height: 6.h), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
'me'.tr, //我 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
textAlign: TextAlign.center, |
|
|
|
), |
|
|
|
), |
|
|
|
child: Obx(() => Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Flexible( |
|
|
|
child: Text( |
|
|
|
'${controller.targetLanguage.value.split(' ')[0]}' |
|
|
|
.tr, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: |
|
|
|
isDarkMode ? Colors.white : Colors.black, |
|
|
|
), |
|
|
|
textAlign: TextAlign.center, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
), |
|
|
|
//只在通话翻译模式下显示电话图标 |
|
|
|
if (controller.currentMode.value == 'call') ...[ |
|
|
|
SizedBox(width: 4.w), |
|
|
|
Icon( |
|
|
|
Icons.phone_in_talk, |
|
|
|
size: 20.sp, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white70 |
|
|
|
: Colors.grey[600], |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
)), |
|
|
|
), |
|
|
|
// 预留与上方互换按钮大致等宽的间距,保证对齐 |
|
|
|
SizedBox(width: 44.w), |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
'counterPart'.tr, //对方 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
textAlign: TextAlign.center, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
|