import 'package:flutter/material.dart'; import '../../core/theme/app_colors.dart'; class PredPrimaryButton extends StatelessWidget { const PredPrimaryButton({ super.key, required this.label, required this.onPressed, this.loading = false, this.icon, this.expand = true, }); final String label; final VoidCallback? onPressed; final bool loading; final IconData? icon; final bool expand; @override Widget build(BuildContext context) { final child = loading ? const SizedBox( height: 22, width: 22, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white), ) : FittedBox( fit: BoxFit.scaleDown, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ if (icon != null) ...[ Icon(icon, size: 20), const SizedBox(width: 8), ], Text(label, maxLines: 1, softWrap: false), ], ), ); final button = FilledButton(onPressed: loading ? null : onPressed, child: child); return expand ? SizedBox(width: double.infinity, child: button) : button; } } class PredDirectionButton extends StatelessWidget { const PredDirectionButton({ super.key, required this.label, required this.selected, required this.color, required this.onTap, this.icon, }); final String label; final bool selected; final Color color; final VoidCallback? onTap; final IconData? icon; @override Widget build(BuildContext context) { return AnimatedContainer( duration: const Duration(milliseconds: 200), curve: Curves.easeOutCubic, decoration: BoxDecoration( color: selected ? color.withValues(alpha: 0.28) : Colors.transparent, borderRadius: BorderRadius.circular(16), border: Border.all( color: selected ? color : AppColors.border, width: selected ? 2.5 : 1, ), boxShadow: selected ? [ BoxShadow( color: color.withValues(alpha: 0.25), blurRadius: 10, offset: const Offset(0, 3), ), ] : null, ), child: Material( color: Colors.transparent, child: InkWell( onTap: onTap, borderRadius: BorderRadius.circular(16), child: Padding( padding: const EdgeInsets.symmetric(vertical: 18), child: Column( children: [ Icon( icon ?? Icons.trending_up, size: selected ? 30 : 24, color: selected ? color : AppColors.textSecondary, ), const SizedBox(height: 8), Text( label, style: TextStyle( fontWeight: FontWeight.w800, fontSize: selected ? 16 : 14, color: selected ? color : AppColors.textSecondary, ), ), if (selected) ...[ const SizedBox(height: 6), Icon(Icons.check_circle_rounded, size: 16, color: color), ], ], ), ), ), ), ); } }