Reputation: 4007
I have 4 buttons showing a different list each time a button is clicked . How to identify which button is clicked using flutter ?
Upvotes: 2
Views: 3335
Reputation: 657338
You can assign a callback that calls a different method for each button
new FlatButton(
child: new Text(confirmText),
onPressed: () => onOkPressed(),
),
or you can pass a parameter
new FlatButton(
child: new Text(confirmText),
onPressed: () => onButtonPressed('okButton'),
),
Upvotes: 5