|
|
|
@ -10,31 +10,31 @@ class PairingView extends StatefulWidget { |
|
|
|
State<PairingView> createState() => _PairingViewState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _PairingViewState extends State<PairingView> |
|
|
|
class _PairingViewState extends State<PairingView> |
|
|
|
with TickerProviderStateMixin { |
|
|
|
late AnimationController _pulseController; |
|
|
|
late AnimationController _rotationController; |
|
|
|
late Animation<double> _pulseAnimation; |
|
|
|
late Animation<double> _rotationAnimation; |
|
|
|
|
|
|
|
|
|
|
|
PairingController get controller => Get.find<PairingController>(); |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
|
|
// 脉搏动画控制器 |
|
|
|
_pulseController = AnimationController( |
|
|
|
duration: const Duration(milliseconds: 1500), |
|
|
|
vsync: this, |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// 旋转动画控制器 |
|
|
|
_rotationController = AnimationController( |
|
|
|
duration: const Duration(milliseconds: 2000), |
|
|
|
vsync: this, |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// 脉搏动画 |
|
|
|
_pulseAnimation = Tween<double>( |
|
|
|
begin: 0.8, |
|
|
|
@ -43,7 +43,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
parent: _pulseController, |
|
|
|
curve: Curves.easeInOut, |
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
// 旋转动画 |
|
|
|
_rotationAnimation = Tween<double>( |
|
|
|
begin: 0.0, |
|
|
|
@ -52,7 +52,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
parent: _rotationController, |
|
|
|
curve: Curves.linear, |
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
// 开始动画 |
|
|
|
_pulseController.repeat(reverse: true); |
|
|
|
_rotationController.repeat(); |
|
|
|
@ -228,7 +228,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
if (isLoading) _buildPulseAnimation(primaryColor, secondaryColor), |
|
|
|
|
|
|
|
// 特殊的安全连接动画 - 只在建立安全连接时显示 |
|
|
|
if (state == PairingState.waitingBle) |
|
|
|
if (state == PairingState.waitingBle) |
|
|
|
_buildSecureConnectionAnimation(primaryColor, secondaryColor), |
|
|
|
|
|
|
|
// 设备关联动画 - 只在关联设备时显示 |
|
|
|
@ -268,8 +268,9 @@ class _PairingViewState extends State<PairingView> |
|
|
|
animation: _pulseAnimation, |
|
|
|
builder: (context, child) { |
|
|
|
final value = _pulseAnimation.value; |
|
|
|
final opacity = 0.4 - (_pulseController.value * 0.3); // 0.4 到 0.1 的透明度变化 |
|
|
|
|
|
|
|
final opacity = |
|
|
|
0.4 - (_pulseController.value * 0.3); // 0.4 到 0.1 的透明度变化 |
|
|
|
|
|
|
|
return Container( |
|
|
|
width: 200.w * value, |
|
|
|
height: 200.w * value, |
|
|
|
@ -312,7 +313,8 @@ class _PairingViewState extends State<PairingView> |
|
|
|
} |
|
|
|
|
|
|
|
// 构建安全连接特殊动画 - 多层波纹效果 |
|
|
|
Widget _buildSecureConnectionAnimation(Color primaryColor, Color secondaryColor) { |
|
|
|
Widget _buildSecureConnectionAnimation( |
|
|
|
Color primaryColor, Color secondaryColor) { |
|
|
|
return Stack( |
|
|
|
alignment: Alignment.center, |
|
|
|
children: [ |
|
|
|
@ -322,7 +324,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
builder: (context, child) { |
|
|
|
final value = _pulseAnimation.value; |
|
|
|
final opacity = 0.3 - (_pulseController.value * 0.2); |
|
|
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
width: 180.w * value, |
|
|
|
height: 180.w * value, |
|
|
|
@ -336,7 +338,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
// 第二层波纹 - 延迟动画 |
|
|
|
AnimatedBuilder( |
|
|
|
animation: _pulseAnimation, |
|
|
|
@ -344,7 +346,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
final delayedValue = (_pulseController.value + 0.3) % 1.0; |
|
|
|
final value = 0.8 + (delayedValue * 0.4); |
|
|
|
final opacity = 0.25 - (delayedValue * 0.15); |
|
|
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
width: 160.w * value, |
|
|
|
height: 160.w * value, |
|
|
|
@ -358,7 +360,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
// 第三层波纹 - 更大延迟 |
|
|
|
AnimatedBuilder( |
|
|
|
animation: _pulseAnimation, |
|
|
|
@ -366,7 +368,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
final delayedValue = (_pulseController.value + 0.6) % 1.0; |
|
|
|
final value = 0.8 + (delayedValue * 0.4); |
|
|
|
final opacity = 0.2 - (delayedValue * 0.1); |
|
|
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
width: 140.w * value, |
|
|
|
height: 140.w * value, |
|
|
|
@ -464,7 +466,7 @@ class _PairingViewState extends State<PairingView> |
|
|
|
case PairingState.checking: |
|
|
|
return 'preparingPairingEnvironment'.tr; // 正在准备配对环境... |
|
|
|
case PairingState.waitingClassic: |
|
|
|
return 'connectDeepSoundViaSystemBluetooth'.tr; // 请先通过系统蓝牙连接DeapSound设备 |
|
|
|
return 'connectDeepSoundViaSystemBluetooth'.tr; // 请先通过系统蓝牙连接Voitrans设备 |
|
|
|
case PairingState.verifying: |
|
|
|
return 'verifyingDevice'.tr; // 正在验证设备... |
|
|
|
case PairingState.binding: |
|
|
|
@ -484,9 +486,9 @@ class _PairingViewState extends State<PairingView> |
|
|
|
return 'lackPermissions'.tr; // 缺少蓝牙权限 |
|
|
|
case ErrorType.noClassicDevice: |
|
|
|
return 'connectDeepSoundViaSystemBluetooth' |
|
|
|
.tr; // 请先通过系统蓝牙连接DeapSound设备 |
|
|
|
.tr; // 请先通过系统蓝牙连接Voitrans设备 |
|
|
|
case ErrorType.deviceNotMatch: |
|
|
|
return 'ensureConnectedDeepSoundDevice'.tr; // 请确保连接的是DeapSound设备 |
|
|
|
return 'ensureConnectedDeepSoundDevice'.tr; // 请确保连接的是Voitrans设备 |
|
|
|
case ErrorType.deviceBound: |
|
|
|
return 'deviceAlreadyBoundToOtherAccount'.tr; // 该设备已被其他账号绑定 |
|
|
|
case ErrorType.associationFailed: |
|
|
|
|