import 'package:flutter/material.dart'; class BalanceHeader extends StatelessWidget { final String title; final String? subtitle; final String? badge; const BalanceHeader({ super.key, required this.title, this.subtitle, this.badge, }); @override Widget build(BuildContext context) { final textTheme = Theme.of(context).textTheme; final colorScheme = Theme.of(context).colorScheme; final subtitleText = subtitle?.trim(); final badgeText = badge?.trim(); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisSize: MainAxisSize.min, children: [ Flexible( child: Text( title, maxLines: 2, overflow: TextOverflow.ellipsis, style: textTheme.titleLarge?.copyWith( color: colorScheme.primary, fontWeight: FontWeight.w700, ), ), ), if (badgeText != null && badgeText.isNotEmpty) ...[ const SizedBox(width: 8), Container( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2), decoration: BoxDecoration( color: colorScheme.primaryFixed, borderRadius: BorderRadius.circular(999), ), child: Text( badgeText, style: textTheme.labelSmall?.copyWith( color: colorScheme.onSecondary, fontWeight: FontWeight.w700, ), ), ), ], ], ), if (subtitleText != null && subtitleText.isNotEmpty) Text( subtitleText, style: textTheme.titleSmall?.copyWith( color: colorScheme.primaryFixed, fontWeight: FontWeight.w500, ), maxLines: 1, ), ], ); } }