import 'package:flutter/material.dart'; class ProfileSelector extends StatelessWidget { final List> profiles; final Function(Map) 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 ? "assets/images/male.png" : "assets/images/female.png") 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(), ); } }