import 'package:flutter/widgets.dart'; /// Slow, continuous progress motion confined to the Stop glyph. The native /// button, hit target and semantics never rotate. TickerMode pauses hidden UI. class ChatStopIcon extends StatefulWidget { const ChatStopIcon({super.key, required this.child}); final Widget child; static const period = Duration(seconds: 8); @override State createState() => _ChatStopIconState(); } class _ChatStopIconState extends State with SingleTickerProviderStateMixin { late final _rotation = AnimationController( vsync: this, duration: ChatStopIcon.period, ); @override void didChangeDependencies() { super.didChangeDependencies(); if (MediaQuery.maybeDisableAnimationsOf(context) ?? false) { _rotation.stop(); _rotation.value = 0; } else if (!_rotation.isAnimating) { _rotation.repeat(); } } @override void dispose() { _rotation.dispose(); super.dispose(); } @override Widget build(BuildContext context) => RepaintBoundary( key: const Key('chat-stop-paint-boundary'), child: RotationTransition( key: const Key('chat-stop-rotation'), turns: _rotation, child: widget.child, ), ); }