import 'package:sysfarma_mobile/src/core/theme/app_tokens.dart'; import 'package:flutter/material.dart'; class AppHeroCard extends StatelessWidget { const AppHeroCard({ required this.title, required this.subtitle, required this.child, super.key, this.badges = const [], this.trailing, }); final String title; final String subtitle; final List badges; final Widget child; final Widget? trailing; @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(AppTokens.radiusLarge), gradient: const LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ AppTokens.primary, AppTokens.primaryDark, ], ), border: Border.all(color: Colors.white.withValues(alpha: 0.08)), ), child: Stack( children: [ Positioned( top: -26, right: -26, child: IgnorePointer( child: Container( width: 112, height: 112, decoration: BoxDecoration( color: Colors.white.withValues(alpha:0.08), shape: BoxShape.circle, ), ), ), ), Positioned( bottom: -44, left: -10, child: IgnorePointer( child: Container( width: 140, height: 140, decoration: BoxDecoration( color: Colors.white.withValues(alpha:0.05), shape: BoxShape.circle, ), ), ), ), LayoutBuilder( builder: (context, constraints) { final isCompact = constraints.maxWidth < 420; final padding = EdgeInsets.all(isCompact ? 18 : 22); return Padding( padding: padding, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ if (isCompact) ...[ _HeroCopy(title: title, subtitle: subtitle), ] else Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: _HeroCopy(title: title, subtitle: subtitle), ), if (trailing != null) ...[ const SizedBox(width: 12), trailing!, ], ], ), if (badges.isNotEmpty) ...[ const SizedBox(height: 18), if (isCompact) SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ for (final badge in badges) ...[ _HeroBadge(label: badge), if (badge != badges.last) const SizedBox(width: 8), ], ], ), ) else Wrap( spacing: 8, runSpacing: 8, children: [ for (final badge in badges) _HeroBadge(label: badge), ], ), ], if (isCompact && trailing != null) ...[ const SizedBox(height: 14), trailing!, ], const SizedBox(height: 20), child, ], ), ); }, ), ], ), ); } } class _HeroBadge extends StatelessWidget { const _HeroBadge({ required this.label, }); final String label; @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), decoration: BoxDecoration( color: Colors.white.withValues(alpha:0.12), borderRadius: BorderRadius.circular(999), border: Border.all(color: Colors.white.withValues(alpha:0.08)), ), child: Text( label, style: Theme.of(context).textTheme.labelMedium?.copyWith( color: Colors.white, fontWeight: FontWeight.w600, ), ), ); } } class _HeroCopy extends StatelessWidget { const _HeroCopy({ required this.title, required this.subtitle, }); final String title; final String subtitle; @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, maxLines: 2, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.headlineSmall?.copyWith( color: Colors.white, ), ), const SizedBox(height: 8), Text( subtitle, maxLines: 3, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: Colors.white.withValues(alpha:0.84), ), ), ], ); } }