mapButton static method
Implementation
static Widget mapButton(
Button button, Function(String text, String payload) callTock,
[Function(Button button)? customButton]) {
switch (button.type) {
case ButtonsTypes.QUICK_REPLY:
return QrButton(
text: button.data['title'],
onPressed: () {
callTock(button.data['title'], button.data['payload']);
},
key: const Key('value'),
);
case ButtonsTypes.POSTBACK_BUTTON:
return PostbackButton(
text: button.data[MessagesTypes.TEXT.toText],
onPressed: () {
callTock(button.data['title'], button.data['payload']);
},
key: const Key('value'),
);
case ButtonsTypes.URL_BUTTON:
return UrlButton(
text: button.data[MessagesTypes.TEXT.toText],
url: button.data['url'],
key: const Key('value'),
);
case ButtonsTypes.WIDGET:
return customButton!(button);
default:
return customButton!(button);
}
}