getWidget method
dynamic
getWidget(- dynamic child,
- dynamic context
)
Implementation
getWidget(Widget child, BuildContext context) {
if (child is NomoText && child.style == null) {
child = NomoText(
child.text,
style: context.typography.b2.copyWith(
color: context.colors.onPrimary,
),
);
}
if (child is Icon && child.color == null) {
child = Icon(
child.icon,
color: context.colors.onPrimary,
);
}
return Container(
width: width,
height: height,
decoration: BoxDecoration(
borderRadius: borderRadius,
),
child: Padding(
padding: padding!,
child: Center(
child: isLoading
? SizedBox(
width: height! - padding!.horizontal,
height: height! - padding!.horizontal,
child: loadingWidget ??
CircularProgressIndicator(
color: context.colors.onPrimary,
),
)
: leading != null || trailing != null
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (leading != null)
Expanded(
flex: 1,
child: leading!,
),
Expanded(
flex: 2,
child: child,
),
if (trailing != null)
Expanded(flex: 1, child: trailing!),
],
)
: FittedBox(
fit: BoxFit.fitWidth,
child: child,
),
),
),
);
}