import 'package:flutter/material.dart'; class TransactionRefButton extends StatelessWidget { final VoidCallback onTap; final bool isActive; final String label; final IconData icon; const TransactionRefButton({ super.key, required this.onTap, required this.isActive, required this.label, required this.icon, }); static const double _horizontalPadding = 10.0; static const double _verticalPadding = 5.0; static const double _iconSize = 24.0; static const double _spacing = 10.0; static const double _borderRadius = 12.0; static const FontWeight _fontWeight = FontWeight.w400; @override Widget build(BuildContext context) { final theme = Theme.of(context).colorScheme; final backgroundColor = isActive ? theme.primary : theme.onSecondary; final foregroundColor = isActive ? theme.onPrimary : theme.onPrimaryContainer; final hoverColor = isActive ? theme.primary : theme.secondaryContainer; return Material( color: backgroundColor, elevation: 4, borderRadius: BorderRadius.circular(_borderRadius), child: InkWell( onTap: onTap, borderRadius: BorderRadius.circular(_borderRadius), hoverColor: hoverColor, child: Padding( padding: const EdgeInsets.symmetric( horizontal: _horizontalPadding, vertical: _verticalPadding, ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Text( label, style: Theme.of(context).textTheme.titleSmall?.copyWith( fontWeight: _fontWeight, color: foregroundColor, ), ), const SizedBox(width: _spacing), Icon( icon, color: foregroundColor, size: _iconSize, ), ], ), ), ), ); } }