import 'package:wanisclient/config/custom_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import '../utils/colors.dart'; class LocationCard extends StatelessWidget { final String svgIconPath; final String text; final bool fetchinglocationload; final VoidCallback? onTap; const LocationCard({ super.key, required this.svgIconPath, required this.fetchinglocationload, required this.text, this.onTap, }); @override Widget build(BuildContext context) { return ListTile( // --- START OF CHANGES --- // 1. Conditionally display either the loader or the icon leading: fetchinglocationload ? Container( width: 24, height: 24, padding: const EdgeInsets.all(2.0), child: const CircularProgressIndicator( strokeWidth: 2.5, color: AppNewColors.black, ), ) : SvgPicture.asset( svgIconPath, width: 24, height: 24, colorFilter: const ColorFilter.mode( AppNewColors.black, BlendMode.srcIn, ), ), // 2. Disable the onTap callback while loading onTap: fetchinglocationload ? null : onTap, // --- END OF CHANGES --- title: Txt( text: text, style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w500, color: AppNewColors.black, ), ), contentPadding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 4.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ); } }