import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import '../../../config/app_constant.dart'; import '../../../config/style.dart'; import '../../../utils/text_style.dart'; import '../../../utils/text_widget.dart'; class AddressCard extends StatelessWidget { final String addressText; final VoidCallback? onTap; final bool isPlaceholder; final Widget? trailing; const AddressCard({ Key? key, required this.addressText, this.onTap, this.isPlaceholder = false, this.trailing, }) : super(key: key); @override Widget build(BuildContext context) { final wm = MediaQuery.of(context).size.width / 100; final hm = MediaQuery.of(context).size.height / 100; final bool isDark = Theme.of(context).brightness == Brightness.dark; return GestureDetector( onTap: onTap, child: Container( margin: EdgeInsets.symmetric(horizontal: wm * 5, vertical: hm * 0.6), decoration: BoxDecoration( color: Theme.of(context).cardColor, borderRadius: BorderRadius.circular(12), border: Border.all( color: isPlaceholder ? AppNewStyle.primaryButton.withOpacity(0.3) : Theme.of(context).dividerColor.withOpacity(0.2), width: isPlaceholder ? 2 : 1, ), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(isDark ? 0.4 : 0.06), blurRadius: 6, offset: const Offset(0, 2), ), ], ), child: Padding( padding: EdgeInsets.symmetric( horizontal: wm * 4, vertical: hm * 2, ), child: Row( children: [ Container( width: hm * 2.5, height: hm * 2.5, decoration: BoxDecoration( color: isPlaceholder ? AppNewStyle.primaryButton.withOpacity(0.1) : AppNewStyle.mediumPriorityColor.withOpacity(0.1), borderRadius: BorderRadius.circular(6), ), child: Center( child: SvgPicture.asset( Consts.positionGreenIcon, height: hm * 1.8, color: isPlaceholder ? AppNewStyle.primaryButton : AppNewStyle.mediumPriorityColor, ), ), ), SizedBox(width: wm * 3), Expanded( child: Txt( text: addressText, overflow: TextOverflow.ellipsis, maxLines: 2, style: tS( "Inter", 14, FontWeight.w500, isPlaceholder ? (isDark ? AppNewStyle.darkTextGrayColor : AppNewStyle.textGrayColor) : (isDark ? AppNewStyle.darkTextBlackColor : AppNewStyle.textBlackColor), ), ), ), if (trailing != null) ...[ SizedBox(width: wm * 2), trailing!, ] ], ), ), ), ); } }