mapCard static method
Implementation
static CardWidget mapCard(
Map<String, dynamic> cardMessage,
Function(String text, String payload) callTock,
) {
List<Widget> buttons = [];
var height = 130;
var buttonHeight = 0;
if (cardMessage['buttons'] != null) {
for (var element in cardMessage['buttons']) {
buttons.add(
ButtonsWidgetMapper.mapButton(
Button(ButtonsUtil.fromString(element), element),
callTock,
),
);
buttonHeight += 50;
height += 50;
}
}
if (cardMessage['file'] != null) {
height += 150;
}
return CardWidget(
title: cardMessage['title'],
subtitle: cardMessage['subTitle'],
buttons: buttons,
image: (cardMessage['file'] != null) ? cardMessage['file']['url'] : null,
height: height.toDouble(),
buttonsHeight: buttonHeight.toDouble(),
key: const Key('value'),
);
}