classifyElement static method

int classifyElement(
  1. Element element
)

Implementation

static int classifyElement(Element element) {
  final widget = element.widget;
  final runtimeType = widget.runtimeType;

  int type = classify(runtimeType);
  if (type != UX_UNKNOWN) return type;

  if (widget is DecoratedBox) {
    final decoration = widget.decoration;
    if (decoration is BoxDecoration) {
      if (decoration.image != null) {
        return UX_IMAGE;
      }
      if (decoration.shape == BoxShape.circle || decoration.color != null) {
        return UX_DECOR;
      }
    }
    if (decoration is ShapeDecoration) {
      if (decoration.image != null) {
        return UX_IMAGE;
      }
      if (decoration.shape == BoxShape.circle || decoration.color != null) {
        return UX_DECOR;
      }
    }
  }

  final typeName = runtimeType.toString();
  if (typeName.startsWith('Radio<')) return UX_COMPOUND;

  return UX_UNKNOWN;
}