autoWidget method

Widget autoWidget(
  1. dynamic item
)

Implementation

Widget autoWidget(final dynamic item) {
  Widget w;
  if (item is Icon) {
    w = Icon(
      item.icon,
      size: _radius.times(2) ?? item.size,
      color: _color ?? item.color,
    );
  } else if (item is IconData) {
    w = Icon(
      item,
      size: _radius.times(2),
      color: _color,
    );
  } else if (item is Uri) {
    w = PlatformNetworkImage("$item", height: _radius.times(2));
  } else if (item is Text) {
    w = Text(
      item.data!,
      key: item.key,
      style: (item.style ?? TextStyle()).copyWith(color: _color ?? item.style?.color),
      textAlign: item.textAlign,
      locale: item.locale,
      softWrap: item.softWrap,
      overflow: item.overflow,
      textScaleFactor: item.textScaleFactor,
      maxLines: item.maxLines,
      semanticsLabel: item.semanticsLabel,
      textWidthBasis: item.textWidthBasis,
      textHeightBehavior: item.textHeightBehavior,
    );
  } else if (item is Widget) {
    w = item;
  } else {
    w = Text(item?.toString() ?? '',
        softWrap: _softWrap, textAlign: _textAlign, style: (_style ?? TextStyle()).copyWith(color: _color));
  }

  return _centerEach ? Center(child: w) : w;
}