|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:get/get.dart'; |
|
|
|
import 'package:intl/intl.dart'; // 用于 DateFormat |
|
|
|
import '../../../data/services/ble_manager.dart'; |
|
|
|
import '../controllers/mobile_elf_controller.dart'; |
|
|
|
|
|
|
|
class MobileElfView extends GetView<MobileElfController> { |
|
|
|
@ -144,6 +145,18 @@ class MobileElfView extends GetView<MobileElfController> { |
|
|
|
|
|
|
|
/// 右上角状态胶囊 + 通话计时 |
|
|
|
Widget _buildStatusPill() { |
|
|
|
// 未连接设备优先展示(用户更直观的可恢复状态) |
|
|
|
if (!BleManager.to.isConnectedRx.value) { |
|
|
|
return Container( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 3.h), |
|
|
|
decoration: BoxDecoration(color: const Color(0xFFFEF2F2), borderRadius: BorderRadius.circular(20.r)), |
|
|
|
child: Row(mainAxisSize: MainAxisSize.min, children: [ |
|
|
|
Icon(Icons.bluetooth_disabled_rounded, size: 11.sp, color: _red), |
|
|
|
SizedBox(width: 4.w), |
|
|
|
Text('deviceNotConnected'.tr, style: TextStyle(fontSize: 11.sp, color: _red, fontWeight: FontWeight.w500)), |
|
|
|
]), |
|
|
|
); |
|
|
|
} |
|
|
|
if (controller.credentialFailed.value) { |
|
|
|
return Container( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 3.h), |
|
|
|
@ -483,6 +496,7 @@ class MobileElfView extends GetView<MobileElfController> { |
|
|
|
child: Column( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
if (!BleManager.to.isConnectedRx.value) _buildDeviceRequiredBar(isDark), |
|
|
|
if (showStatusBar) _buildStatusBar(s, inCall, isDark), |
|
|
|
if (inCall) |
|
|
|
_buildInCallInputBar(isDark) |
|
|
|
@ -495,6 +509,28 @@ class MobileElfView extends GetView<MobileElfController> { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// ── 未连接设备警示横幅 ──────────────────────────────────────────────────── |
|
|
|
|
|
|
|
Widget _buildDeviceRequiredBar(bool isDark) { |
|
|
|
return Container( |
|
|
|
width: double.infinity, |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), |
|
|
|
color: const Color(0xFFFEF2F2), |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Icon(Icons.bluetooth_disabled_rounded, size: 16.sp, color: _red), |
|
|
|
SizedBox(width: 8.w), |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
'mobileElfNeedDevice'.tr, |
|
|
|
style: TextStyle(fontSize: 13.sp, color: _red, fontWeight: FontWeight.w500), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// ── 状态提示栏 ──────────────────────────────────────────────────────────── |
|
|
|
|
|
|
|
Widget _buildStatusBar(MobileElfStatus s, bool inCall, bool isDark) { |
|
|
|
@ -633,7 +669,8 @@ class MobileElfView extends GetView<MobileElfController> { |
|
|
|
final s = controller.status.value; |
|
|
|
final ptt = controller.pttRecording.value; |
|
|
|
|
|
|
|
final locked = controller.credentialFailed.value; |
|
|
|
final notConnected = !BleManager.to.isConnectedRx.value; |
|
|
|
final locked = controller.credentialFailed.value || notConnected; |
|
|
|
final disabled = locked || (!ptt && s != MobileElfStatus.idle && s != MobileElfStatus.error); |
|
|
|
final pttClickable = !locked && s == MobileElfStatus.speaking; |
|
|
|
final sideDisabled = locked || ptt || (disabled && !pttClickable); |
|
|
|
|