import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; class ProfileSelector extends StatelessWidget { final List profiles; final Function(FamilyFileResponseModelLists ) onSelect; const ProfileSelector({ Key? key, required this.profiles, required this.onSelect, }) : super(key: key); @override Widget build(BuildContext context) { return Column( mainAxisSize: MainAxisSize.min, children: profiles.map((profile) { return ListTile( leading: CircleAvatar( radius: 22, backgroundImage: profile.genderImage != null && profile.genderImage.toString().isNotEmpty ? NetworkImage(profile.genderImage!) : AssetImage( profile.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg) as ImageProvider, ), title: Text( profile.patientName ?? "Unknown", style: const TextStyle(fontWeight: FontWeight.w600), ), subtitle: Text( profile.relationship ?? "Self", style: const TextStyle(color: Colors.grey), ), trailing: const Icon(Icons.arrow_forward_ios, size: 16), onTap: () => onSelect(profile), ); }).toList(), ); } }