Last active
March 16, 2022 16:17
-
-
Save daiki1003/2fb4061f1906d82143dcdee7dd52678c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyGreatestWidget extends StatelessWidget { | |
const MyGreatestWidget({ | |
Key? key, | |
required this.onPressed, | |
}) : super(key: key); | |
final ValueCallback<String> onPressed; | |
@override | |
Widget build(BuildContext context) { | |
final fruits = ['apple', 'banana', 'orange']; | |
return ListView( | |
children: fruits.map((fruit) { | |
return ListTile( | |
onTap: () => onPressed(fruit), | |
leading: const Icon(Icons.favorite_border), | |
title: Text(fruit), | |
); | |
}).toList(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment