child property
Widget?
get
child
Returns the child widget of the button, including icons and loading indicators.
Implementation
Widget? get child {
var loadingWidget = ColoredBox(
color: _getBackgroundColorLoadingByBorder,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: size.iconHeight,
width: size.iconWidth,
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(loadingIconColor ?? _getColorByType),
strokeCap: StrokeCap.round,
strokeWidth: loadingIconStrokeWidth ?? 3,
),
),
],
),
);
return Stack(
alignment: Alignment.center,
children: [
Row(
mainAxisSize: layout.mainAxisSize,
mainAxisAlignment: MainAxisAlignment.center,
children: [
_preffixIcon,
if (label != null)
Flexible(
child: Text(
label ?? '',
style: textStyle ?? style,
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
_suffixIcon,
],
),
if (state.isLoading)
if (iconPreffix == null && iconSuffix == null && label == null)
loadingWidget
else
Positioned.fill(
child: loadingWidget,
),
],
);
}