getChild method
Implementation
Widget getChild() {
String iconPath = icon ?? "";
if (iconPath.isNotEmpty) {
List<Widget> children = [];
switch (iconAlignment) {
case GTFButtonIconAlignment.left:
children.add(getIcon());
if (text.isNotEmpty) {
children.add(getBox());
children.add(Flexible(child: getText()));
}
break;
case GTFButtonIconAlignment.right:
if (text.isNotEmpty) {
children.add(Flexible(child: getText()));
children.add(getBox());
}
children.add(getIcon());
break;
case GTFButtonIconAlignment.top:
children.add(getIcon());
if (text.isNotEmpty) {
children.add(getBox());
children.add(getText());
}
break;
case GTFButtonIconAlignment.bottom:
if (text.isNotEmpty) {
children.add(getText());
children.add(getBox());
}
children.add(getIcon());
break;
}
if (iconAlignment == GTFButtonIconAlignment.left ||
iconAlignment == GTFButtonIconAlignment.right) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: children,
);
} else {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: children,
);
}
} else {
return getText();
}
}