getPercentage function
dynamic
getPercentage(
{ - Widget? childView,
- Styles? styles,
})
Implementation
getPercentage({Widget? childView, Styles? styles}) {
double? mWidth;
double? mHeight;
if (getTypeOf(styles?.width) == '%') {
mWidth = double.parse((styles?.width as String).replaceAll('%', '')) / 100;
}
if (getTypeOf(styles?.height) == '%') {
mHeight =
double.parse((styles?.height as String).replaceAll('%', '')) / 100;
}
return FractionallySizedBox(
widthFactor: mWidth ?? 0.0,
heightFactor: mHeight ?? null,
child: childView,
);
}