buildChildWithIC function
A utility function to build a widget containing text and an icon with a specified gap.
Parameters:
text
: The text to display.icon
: The icon widget to display.gap
: The padding between the text and the icon.textStyle
: The style for the text.
Returns: A widget containing the provided text and icon wrapped with appropriate padding.
Implementation
Widget buildChildWithIC(
String? text, Widget? icon, double gap, TextStyle textStyle) {
var children = <Widget>[];
children.add(icon ?? Container());
if (text != null) {
children.add(Padding(padding: EdgeInsets.all(gap)));
children.add(buildText(text, textStyle));
}
return Wrap(
direction: Axis.horizontal,
crossAxisAlignment: WrapCrossAlignment.center,
children: children,
);
}