import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:trainhub_flutter/core/constants/ui_constants.dart'; import 'package:trainhub_flutter/core/theme/app_colors.dart'; class SettingsActionButton extends StatefulWidget { const SettingsActionButton({ super.key, required this.label, required this.icon, required this.color, required this.textColor, required this.onPressed, this.borderColor, }); final String label; final IconData icon; final Color color; final Color textColor; final Color? borderColor; final VoidCallback onPressed; @override State createState() => _SettingsActionButtonState(); } class _SettingsActionButtonState extends State { bool _hovered = false; @override Widget build(BuildContext context) { final hasBorder = widget.borderColor != null; return MouseRegion( onEnter: (_) => setState(() => _hovered = true), onExit: (_) => setState(() => _hovered = false), child: AnimatedContainer( duration: UIConstants.animationDuration, height: 40, decoration: BoxDecoration( color: hasBorder ? (_hovered ? AppColors.zinc800 : Colors.transparent) : (_hovered ? widget.color.withValues(alpha: 0.85) : widget.color), borderRadius: BorderRadius.circular(UIConstants.smallBorderRadius), border: hasBorder ? Border.all(color: widget.borderColor!) : null, ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(UIConstants.smallBorderRadius), onTap: widget.onPressed, child: Padding( padding: const EdgeInsets.symmetric( horizontal: UIConstants.spacing16, ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon(widget.icon, size: 16, color: widget.textColor), const SizedBox(width: UIConstants.spacing8), Text( widget.label, style: GoogleFonts.inter( fontSize: 13, fontWeight: FontWeight.w600, color: widget.textColor, ), ), ], ), ), ), ), ), ); } }