part of '../async_action_button.dart'; class AsyncIconButton extends StatelessWidget { final AsyncActionCallback? onPressed; final IconData icon; final Color? color; final String? tooltip; final AsyncActionController? controller; final AsyncErrorBuilder? errorBuilder; final void Function(String message)? onError; final VoidCallback? onSuccess; const AsyncIconButton({ required this.onPressed, required this.icon, this.color, this.tooltip, this.controller, this.errorBuilder, this.onError, this.onSuccess, super.key, }); @override Widget build(BuildContext context) => _AsyncMixin( onPressed: onPressed, controller: controller, errorBuilder: errorBuilder, onError: onError, onSuccess: onSuccess, builder: (context, busy, handler) { if (busy) { return Padding( padding: const EdgeInsets.all(12), child: AppProgressIndicator.small(color: color), ); } return IconButton( icon: Icon(icon, color: color), tooltip: tooltip, onPressed: handler, ); }, ); }