|
|
@ -109,7 +109,6 @@ class TranslationView extends GetView<TranslationController> { |
|
|
)), |
|
|
)), |
|
|
centerTitle: true, |
|
|
centerTitle: true, |
|
|
actions: [ |
|
|
actions: [ |
|
|
|
|
|
|
|
|
Obx(() { |
|
|
Obx(() { |
|
|
if (controller.isRecording.value) { |
|
|
if (controller.isRecording.value) { |
|
|
// 录音中:显示红色计时器样式,点击可停止录音 |
|
|
// 录音中:显示红色计时器样式,点击可停止录音 |
|
|
@ -305,7 +304,8 @@ class TranslationView extends GetView<TranslationController> { |
|
|
itemCount: itemCount, |
|
|
itemCount: itemCount, |
|
|
itemBuilder: (context, index) { |
|
|
itemBuilder: (context, index) { |
|
|
// 如果是最后一项且有更多历史记录,显示加载指示器(reverse模式下) |
|
|
// 如果是最后一项且有更多历史记录,显示加载指示器(reverse模式下) |
|
|
if (index == controller.translationHistory.length && controller.hasMoreHistory.value) { |
|
|
if (index == controller.translationHistory.length && |
|
|
|
|
|
controller.hasMoreHistory.value) { |
|
|
return _buildLoadMoreIndicator(); |
|
|
return _buildLoadMoreIndicator(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -313,7 +313,8 @@ class TranslationView extends GetView<TranslationController> { |
|
|
final historyIndex = controller.translationHistory.length - 1 - index; |
|
|
final historyIndex = controller.translationHistory.length - 1 - index; |
|
|
|
|
|
|
|
|
// 检查索引是否有效(reverse模式下的索引验证) |
|
|
// 检查索引是否有效(reverse模式下的索引验证) |
|
|
if (historyIndex < 0 || historyIndex >= controller.translationHistory.length) { |
|
|
if (historyIndex < 0 || |
|
|
|
|
|
historyIndex >= controller.translationHistory.length) { |
|
|
return const SizedBox.shrink(); |
|
|
return const SizedBox.shrink(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -675,7 +676,8 @@ class TranslationView extends GetView<TranslationController> { |
|
|
borderRadius: BorderRadius.circular(16.r), // 统一圆角尺寸为16 |
|
|
borderRadius: BorderRadius.circular(16.r), // 统一圆角尺寸为16 |
|
|
), |
|
|
), |
|
|
insetPadding: EdgeInsets.symmetric(horizontal: 20.w), |
|
|
insetPadding: EdgeInsets.symmetric(horizontal: 20.w), |
|
|
child: Padding( // 使用Padding替代Container的padding |
|
|
child: Padding( |
|
|
|
|
|
// 使用Padding替代Container的padding |
|
|
padding: EdgeInsets.all(12.w), // 统一内边距 |
|
|
padding: EdgeInsets.all(12.w), // 统一内边距 |
|
|
child: Column( |
|
|
child: Column( |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
@ -703,14 +705,16 @@ class TranslationView extends GetView<TranslationController> { |
|
|
child: SingleChildScrollView( |
|
|
child: SingleChildScrollView( |
|
|
child: Column( |
|
|
child: Column( |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
children: controller.supportedLanguages.keys.map((language) { |
|
|
children: |
|
|
|
|
|
controller.supportedLanguages.keys.map((language) { |
|
|
return Obx(() { |
|
|
return Obx(() { |
|
|
final currentLanguage = isSource |
|
|
final currentLanguage = isSource |
|
|
? controller.sourceLanguage.value |
|
|
? controller.sourceLanguage.value |
|
|
: controller.targetLanguage.value; |
|
|
: controller.targetLanguage.value; |
|
|
final isSelected = currentLanguage == language; |
|
|
final isSelected = currentLanguage == language; |
|
|
|
|
|
|
|
|
return GestureDetector( // 改用手势检测器实现点击 |
|
|
return GestureDetector( |
|
|
|
|
|
// 改用手势检测器实现点击 |
|
|
onTap: () { |
|
|
onTap: () { |
|
|
if (isSource) { |
|
|
if (isSource) { |
|
|
controller.setSourceLanguage(language); |
|
|
controller.setSourceLanguage(language); |
|
|
@ -731,7 +735,8 @@ class TranslationView extends GetView<TranslationController> { |
|
|
? Colors.white.withOpacity(0.05) |
|
|
? Colors.white.withOpacity(0.05) |
|
|
: Colors.grey[200]!), |
|
|
: Colors.grey[200]!), |
|
|
borderRadius: BorderRadius.circular(12.r), // 项圆角 |
|
|
borderRadius: BorderRadius.circular(12.r), // 项圆角 |
|
|
border: Border.all( // 选中状态边框 |
|
|
border: Border.all( |
|
|
|
|
|
// 选中状态边框 |
|
|
color: isSelected |
|
|
color: isSelected |
|
|
? (isDarkMode |
|
|
? (isDarkMode |
|
|
? const Color(0xFF6200EE) |
|
|
? const Color(0xFF6200EE) |
|
|
@ -773,7 +778,8 @@ class TranslationView extends GetView<TranslationController> { |
|
|
shape: BoxShape.circle, // 圆形样式 |
|
|
shape: BoxShape.circle, // 圆形样式 |
|
|
), |
|
|
), |
|
|
child: isSelected |
|
|
child: isSelected |
|
|
? Icon( // 选中时显示对勾 |
|
|
? Icon( |
|
|
|
|
|
// 选中时显示对勾 |
|
|
Icons.check, |
|
|
Icons.check, |
|
|
size: 16.w, |
|
|
size: 16.w, |
|
|
color: Colors.white, |
|
|
color: Colors.white, |
|
|
@ -853,7 +859,8 @@ class TranslationView extends GetView<TranslationController> { |
|
|
child: GestureDetector( |
|
|
child: GestureDetector( |
|
|
onTap: () => controller.loadMoreHistory(), |
|
|
onTap: () => controller.loadMoreHistory(), |
|
|
child: Container( |
|
|
child: Container( |
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), |
|
|
padding: |
|
|
|
|
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 8), |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: Colors.red[50], |
|
|
color: Colors.red[50], |
|
|
borderRadius: BorderRadius.circular(20), |
|
|
borderRadius: BorderRadius.circular(20), |
|
|
|