Przeglądaj źródła

1、更新业务组件库

guanxinyi 1 rok temu
rodzic
commit
2c37229584
1 zmienionych plików z 0 dodań i 120 usunięć
  1. 0 120
      lib/components/delayed_trigger_button.dart

+ 0 - 120
lib/components/delayed_trigger_button.dart

@@ -1,120 +0,0 @@
-// ignore_for_file: must_be_immutable
-
-import 'dart:async';
-
-import 'package:fis_ui/index.dart';
-import 'package:fis_ui/interface/interactive_container.dart';
-import 'package:flutter/material.dart';
-
-/// 延迟触发按钮
-class FDelayedTiriggerButton extends FStatefulWidget {
-  FDelayedTiriggerButton({
-    Key? key,
-    required this.child,
-    required this.onPressed,
-    required this.businessParent,
-    required this.name,
-    this.style,
-    this.countdownSeconds,
-    VoidCallback? onLongPress,
-    ValueChanged<bool>? onHover,
-    ValueChanged<bool>? onFocusChange,
-    FocusNode? focusNode,
-    bool autofocus = false,
-    Clip clipBehavior = Clip.none,
-  });
-
-  FInteractiveContainer businessParent;
-  String? name;
-  double? countdownSeconds = 5;
-  VoidCallback? onPressed;
-  FWidget child;
-  ButtonStyle? style;
-
-  @override
-  FState<FDelayedTiriggerButton> createState() => _FDelayElevatedButtonState();
-}
-
-class _FDelayElevatedButtonState extends FState<FDelayedTiriggerButton> {
-  late double _countdownSeconds = widget.countdownSeconds ?? 5;
-  Timer? _timer;
-
-  @override
-  void initState() {
-    super.initState();
-    startCountdown();
-  }
-
-  void startCountdown() {
-    _timer = Timer.periodic(Duration(milliseconds: 100), (timer) {
-      setState(() {
-        if (_countdownSeconds > 0) {
-          _countdownSeconds -= 0.1;
-        } else {
-          _timer?.cancel();
-        }
-      });
-    });
-  }
-
-  @override
-  void dispose() {
-    _timer?.cancel();
-    super.dispose();
-  }
-
-  @override
-  FWidget build(BuildContext context) {
-    return FContainer(
-      child: FStack(
-        children: [
-          FElevatedButton(
-            businessParent: widget.businessParent,
-            name: 'FDelayedTiriggerButton',
-            onPressed: _countdownSeconds > 0 ? null : widget.onPressed,
-            child: widget.child,
-            style: widget.style?.copyWith(
-              textStyle: MaterialStateProperty.all(
-                TextStyle(
-                  color: _countdownSeconds > 0 ? Colors.black : Colors.white,
-                  fontSize: 16,
-                ),
-              ),
-            ),
-          ),
-          FPositioned(
-            right: 4,
-            top: 4,
-            child: FContainer(
-              width: 20,
-              height: 20,
-              child: FStack(
-                children: [
-                  FCircularProgressIndicator(
-                    ///当前指示的进度 0.0 -1.0
-                    value: _countdownSeconds / (widget.countdownSeconds ?? 5),
-                    strokeWidth: 2.0,
-                  ),
-                  if (_countdownSeconds >= 0)
-                    FContainer(
-                      alignment: Alignment.topCenter,
-                      child: FRichText(
-                        text: TextSpan(
-                          text: (_countdownSeconds.toInt() + 1).toString(),
-                          style: TextStyle(
-                            color: Colors.black,
-                            fontSize: 14,
-                            height: 1.4,
-                          ),
-                        ),
-                      ),
-                    ),
-                ],
-              ),
-            ),
-          ),
-        ],
-      ),
-    );
-  }
-}