updateStyle<T extends StyleMethodPropConsumer> static method

void updateStyle<T extends StyleMethodPropConsumer>(
  1. T? t,
  2. VoltronMap? paramsMap
)

Implementation

static void updateStyle<T extends StyleMethodPropConsumer>(
    T? t, VoltronMap? paramsMap) {
  if (paramsMap == null || t == null) {
    return;
  }

  final provider = t.provider;
  final Map<String, StyleMethodProp>? methodMap = provider.styleMethodMap;

  if (methodMap != null) {
    paramsMap.data.forEach((key, value) {
      var styleMethodHolder = methodMap[key];
      if (styleMethodHolder != null) {
        var realValue = checkValueType(value, styleMethodHolder.defaultValue);
        if (realValue != null) {
          styleMethodHolder.method(t, realValue);
        } else {
          styleMethodHolder.method(t, styleMethodHolder.defaultValue);
        }
      } else {
        if (value is VoltronMap && key == NodeProps.kStyle) {
          updateStyle(t, value);
        }
      }
    });
  }
}