Created
July 25, 2020 15:35
-
-
Save gabrielstellini/3b0c07d2953be5d5d46f576fc63b1f4d 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
// Flutter | |
class CustomCard extends StatelessWidget { | |
CustomCard({@required this.index, @required | |
this.onPress}); | |
final index; | |
final Function onPress; | |
@override | |
Widget build(BuildContext context) { | |
return Card( | |
child: Column( | |
children: <Widget>[ | |
Text('Card $index'), | |
FlatButton( | |
child: const Text('Press'), | |
onPressed: this.onPress, | |
), | |
], | |
) | |
); | |
} | |
} | |
... | |
// Usage | |
CustomCard( | |
index: index, | |
onPress: () { | |
print('Card $index'); | |
}, | |
) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment