|
|
|
@ -170,23 +170,89 @@ class HomeView extends GetView<HomeController> { |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? Colors.grey[800] : Colors.grey[200], |
|
|
|
shape: BoxShape.circle, |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.grey.withOpacity(0.2), |
|
|
|
blurRadius: 4, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
child: IconButton( |
|
|
|
icon: Icon(Icons.settings_outlined, |
|
|
|
size: 16.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[600]), |
|
|
|
padding: EdgeInsets.zero, |
|
|
|
onPressed: () { |
|
|
|
Get.toNamed(Routes.settings); |
|
|
|
}, |
|
|
|
// boxShadow: [ |
|
|
|
// BoxShadow( |
|
|
|
// color: Colors.grey.withOpacity(0.2), |
|
|
|
// blurRadius: 4, |
|
|
|
// offset: const Offset(0, 2), |
|
|
|
// ), |
|
|
|
// ], |
|
|
|
), |
|
|
|
child: Obx(() => PopupMenuButton( |
|
|
|
padding: EdgeInsets.zero, |
|
|
|
// 中文注释:缩小弹窗整体宽度,让展开窗口更紧凑 |
|
|
|
constraints: BoxConstraints( |
|
|
|
minWidth: 120.w, |
|
|
|
maxWidth: 140.w, |
|
|
|
), |
|
|
|
icon: Icon( |
|
|
|
controller.isTtsInterruptEnabled.value |
|
|
|
? Icons.voice_over_off |
|
|
|
: Icons.voice_over_off_outlined, |
|
|
|
size: 12.sp, |
|
|
|
color: controller.isTtsInterruptEnabled.value |
|
|
|
? Theme.of(Get.context!).colorScheme.primary // 使用主题主色 |
|
|
|
: (isDarkMode ? Colors.white70 : Colors.grey[600]), |
|
|
|
), |
|
|
|
elevation: 0, // 中文注释:去除弹窗阴影,实现扁平化 |
|
|
|
// 中文注释:将弹窗位置整体上移,使菜单与“Voitrans”更为平齐 |
|
|
|
offset: Offset(0, -10.h), |
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
borderRadius: BorderRadius.circular(10.w), // 中文注释:略微减小圆角 |
|
|
|
side: BorderSide.none, // 中文注释:移除边框线,边缘不明显 |
|
|
|
), |
|
|
|
color: isDarkMode ? Colors.grey[900] : Colors.grey[50], |
|
|
|
itemBuilder: (context) => [ |
|
|
|
PopupMenuItem( |
|
|
|
// 中文注释:降低菜单项高度并收紧默认内边距,减少上下留白 |
|
|
|
height: 15.h, |
|
|
|
padding: |
|
|
|
EdgeInsets.symmetric(horizontal: 2.w, vertical: 0.h), |
|
|
|
child: Obx(() => Row( |
|
|
|
mainAxisSize: MainAxisSize.max, // 中文注释:收紧行宽度 |
|
|
|
mainAxisAlignment: |
|
|
|
MainAxisAlignment.spaceBetween, // 让 Switch 靠右 |
|
|
|
children: [ |
|
|
|
Icon( |
|
|
|
controller.isTtsInterruptEnabled.value |
|
|
|
? Icons.voice_over_off |
|
|
|
: Icons.voice_over_off_outlined, |
|
|
|
color: controller.isTtsInterruptEnabled.value |
|
|
|
? Theme.of(context).colorScheme.primary |
|
|
|
: (isDarkMode |
|
|
|
? Colors.grey[400] |
|
|
|
: Colors.grey), |
|
|
|
size: 14.sp, // 中文注释:进一步缩小图标尺寸 |
|
|
|
), |
|
|
|
SizedBox(width: 4.w), |
|
|
|
Text( |
|
|
|
// 翻译键代表的中文文本内容:语言打断 |
|
|
|
'language_interrupt'.tr, // 语言打断 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.sp, |
|
|
|
height: 1.0, // 中文注释:降低行高,减小垂直占用 |
|
|
|
), |
|
|
|
), |
|
|
|
//SizedBox(width: 0.w), // 中文注释:控制文字与开关间距 |
|
|
|
Transform.scale( |
|
|
|
scale: 0.6, // 中文注释:缩放开关控件,减小视觉尺寸 |
|
|
|
child: Switch( |
|
|
|
value: controller.isTtsInterruptEnabled.value, |
|
|
|
onChanged: (value) => |
|
|
|
controller.toggleTtsInterrupt(), |
|
|
|
activeColor: |
|
|
|
Theme.of(context).colorScheme.primary, |
|
|
|
materialTapTargetSize: |
|
|
|
MaterialTapTargetSize.shrinkWrap, |
|
|
|
// 中文注释:删除不支持的 visualDensity 参数,保留缩放缩小尺寸 |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
)), |
|
|
|
onTap: () => controller.toggleTtsInterrupt(), |
|
|
|
), |
|
|
|
], |
|
|
|
)), |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
|