feat: 增加连续点击样式处理
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'dart:math';
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -11,6 +12,9 @@ import 'package:kaer_with_panels/app/services/global_overlay_service.dart';
|
||||
import 'package:kaer_with_panels/app/services/singbox_imp/kr_sing_box_imp.dart';
|
||||
import 'package:kaer_with_panels/singbox/model/singbox_status.dart';
|
||||
|
||||
DateTime? _hiConnectBtnNextAllowedAt;
|
||||
const Duration _hiConnectBtnDebounce = Duration(milliseconds: 800);
|
||||
|
||||
/// ✅ 按钮组件(带多层呼吸同心圆动画)
|
||||
class HIAnimatedConnectButton extends GetView<KRHomeController> {
|
||||
final VoidCallback? onTriggerSubscriptionAnimation;
|
||||
@@ -88,11 +92,16 @@ class HIAnimatedConnectButton extends GetView<KRHomeController> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
HapticFeedback.lightImpact();
|
||||
if (isSwitching) {
|
||||
print(
|
||||
'🔵 Switch UI 正在更新,切换中点击了按钮: status=${status.runtimeType}, isConnected=$isConnected, isSwitching=$isSwitching');
|
||||
final _now = DateTime.now();
|
||||
if (_hiConnectBtnNextAllowedAt != null &&
|
||||
_now.isBefore(_hiConnectBtnNextAllowedAt!)) {
|
||||
_hiConnectBtnNextAllowedAt =
|
||||
_now.add(_hiConnectBtnDebounce);
|
||||
return;
|
||||
}
|
||||
_hiConnectBtnNextAllowedAt =
|
||||
_now.add(_hiConnectBtnDebounce);
|
||||
|
||||
final current = controller
|
||||
.kr_subscribeService.kr_currentSubscribe.value;
|
||||
bool hasValidSubscription = false;
|
||||
|
||||
Reference in New Issue
Block a user