问题
I have 4 buttons showing a different list each time a button is clicked . How to identify which button is clicked using flutter ?
回答1:
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'),
),
来源:https://stackoverflow.com/questions/47588528/how-to-identify-which-button-is-clicked-in-flutter