toWidget method
Converte in widget bottone appropriato in base ai flag.
Implementation
Widget toWidget(BuildContext context) {
final theme = CLTheme.of(context);
final buttonColor = color ?? theme.primary;
final tapHandler = needConfirmation ? _wrapOnTap(() => _showConfirmation(context)) : _wrapOnTap(onTap);
if (isSecondary) {
return CLGhostButton(
text: title,
onTap: tapHandler,
context: context,
iconData: iconData,
color: buttonColor,
iconAlignment: IconAlignment.start,
);
}
if (isMain) {
return CLButton.primary(
text: title,
onTap: tapHandler,
context: context,
icon: iconData,
iconAlignment: IconAlignment.start,
);
}
return CLOutlineButton.secondary(
text: title,
onTap: tapHandler,
context: context,
);
}