import 'package:flutter/material.dart'; import 'package:flutter_application_1/core/theme/app_colors.dart'; class PrimaryButton extends StatelessWidget { final String text; final VoidCallback onPressed; final bool isLoading; final bool enabled; const PrimaryButton({ super.key, required this.text, required this.onPressed, this.isLoading = false, this.enabled = true, }); @override Widget build(BuildContext context) { final isInteractive = enabled && !isLoading; return SizedBox( height: 56, width: double.infinity, child: DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), gradient: LinearGradient( colors: isInteractive ? const [ AppColors.primaryBlue, AppColors.primaryBlueDark, ] : const [ Color(0xFF8DAEF7), Color(0xFF8DAEF7), ], begin: Alignment.centerLeft, end: Alignment.centerRight, ), boxShadow: const [ BoxShadow( color: AppColors.shadow, blurRadius: 12, offset: Offset(0, 6), ), ], ), child: ElevatedButton( onPressed: isInteractive ? onPressed : null, style: ElevatedButton.styleFrom( backgroundColor: Colors.transparent, disabledBackgroundColor: Colors.transparent, shadowColor: Colors.transparent, surfaceTintColor: Colors.transparent, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), ), child: isLoading ? const SizedBox( width: 20, height: 20, child: CircularProgressIndicator( strokeWidth: 2.2, valueColor: AlwaysStoppedAnimation( AppColors.white, ), ), ) : Text( text, style: const TextStyle( color: AppColors.white, fontSize: 14, fontWeight: FontWeight.w800, letterSpacing: 0.5, ), ), ), ), ); } }