setRenderStyleProperty method
void
setRenderStyleProperty(
- String name,
- dynamic value
)
Implementation
void setRenderStyleProperty(String name, value) {
if (renderStyle.target.disposed) return;
dynamic oldValue;
switch (name) {
case DISPLAY:
case OVERFLOW_X:
case OVERFLOW_Y:
case POSITION:
oldValue = renderStyle.getProperty(name);
break;
}
if (DebugFlags.shouldLogTransitionForProp(name)) {
cssLogger.info('[style][apply-prop] ${tagName}.$name value=${value is CSSColor ? (value as CSSColor).cssText() : value}');
}
if (DebugFlags.enableBackgroundLogs && (name == BACKGROUND_POSITION_X || name == BACKGROUND_POSITION_Y)) {
try {
final CSSBackgroundPosition p = value as CSSBackgroundPosition;
renderingLogger.finer('[Background] apply $name cssText=${p.cssText()} '
'(len=${p.length != null} pct=${p.percentage != null} calc=${p.calcValue != null})');
} catch (_) {}
}
renderStyle.setProperty(name, value);
switch (name) {
case DISPLAY:
assert(oldValue != null);
if (value != oldValue) {
_updateHostingWidgetWithDisplay(oldValue);
}
break;
case OVERFLOW_X:
if (this is WidgetElement) return;
_updateHostingWidgetWithOverflow(oldValue);
break;
case OVERFLOW_Y:
if (this is WidgetElement) return;
_updateHostingWidgetWithOverflow(oldValue);
break;
case POSITION:
assert(oldValue != null);
whenConnected().then((_) {
_updateHostingWidgetWithPosition(oldValue);
});
break;
case COLOR:
_updateColorRelativePropertyWithColor(this);
break;
case FONT_SIZE:
_updateFontRelativeLengthWithFontSize();
break;
case TRANSFORM:
_updateHostingWidgetWithTransform();
break;
}
}