Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created February 8, 2021 20:00
Show Gist options
  • Save azamsharp/7cf0ba9859bfae290d822cf320711c17 to your computer and use it in GitHub Desktop.
Save azamsharp/7cf0ba9859bfae290d822cf320711c17 to your computer and use it in GitHub Desktop.
class CustomerList extends StatelessWidget {
final List<String> customers;
final Function(String) onSelected;
CustomerList({@required this.customers, this.onSelected});
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: customers.length,
itemBuilder: (context, index) {
final customer = customers[index];
return ListTile(
title: Text(customer),
onTap: () {
onSelected(customer);
},
);
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment