paint static method
Returns a Paint from the specified map.
If the map is absent, returns null.
Otherwise (even if it has no keys), a new Paint is created and its properties are set according to the identically-named properties of the map, as follows:
blendMode
: enumValue of BlendMode.color
: color.colorFilter
: colorFilter.filterQuality
: enumValue of FilterQuality.isAntiAlias
: boolean.maskFilter
: maskFilter.shader
: shader.
(Some values are not supported, because there is no way for them to be used currently in RFW contexts.)
Implementation
// * `imageFilter`: [imageFilter].
// * `invertColors`: boolean.
/// * `isAntiAlias`: boolean.
/// * `maskFilter`: [maskFilter].
/// * `shader`: [shader].
// * `strokeCap`: [enumValue] of [StrokeCap].
// * `strokeJoin`: [enumValue] of [StrokeJoin].
// * `strokeMiterLimit`: double.
// * `strokeWidth`: double.
// * `style`: [enumValue] of [PaintingStyle].
///
/// (Some values are not supported, because there is no way for them to be
/// used currently in RFW contexts.)
static Paint? paint(DataSource source, List<Object> key) {
if (!source.isMap(key)) {
return null;
}
final Paint result = Paint();
final BlendMode? paintBlendMode = enumValue<BlendMode>(BlendMode.values, source, [...key, 'blendMode']);
if (paintBlendMode != null) {
result.blendMode = paintBlendMode;
}
final Color? paintColor = color(source, [...key, 'color']);
if (paintColor != null) {
result.color = paintColor;
}
final ColorFilter? paintColorFilter = colorFilter(source, [...key, 'colorFilter']);
if (paintColorFilter != null) {
result.colorFilter = paintColorFilter;
}
final FilterQuality? paintFilterQuality = enumValue<FilterQuality>(FilterQuality.values, source, [...key, 'filterQuality']);
if (paintFilterQuality != null) {
result.filterQuality = paintFilterQuality;
}
// final ImageFilter? paintImageFilter = imageFilter(source, [...key, 'imageFilter']);
// if (paintImageFilter != null) {
// result.imageFilter = paintImageFilter;
// }
// final bool? paintInvertColors = source.v<bool>([...key, 'invertColors']);
// if (paintInvertColors != null) {
// result.invertColors = paintInvertColors;
// }
final bool? paintIsAntiAlias = source.v<bool>([...key, 'isAntiAlias']);
if (paintIsAntiAlias != null) {
result.isAntiAlias = paintIsAntiAlias;
}
final MaskFilter? paintMaskFilter = maskFilter(source, [...key, 'maskFilter']);
if (paintMaskFilter != null) {
result.maskFilter = paintMaskFilter;
}
final Shader? paintShader = shader(source, [...key, 'shader']);
if (paintShader != null) {
result.shader = paintShader;
}
// final StrokeCap? paintStrokeCap = enumValue<StrokeCap>(StrokeCap.values, source, [...key, 'strokeCap']),
// if (paintStrokeCap != null) {
// result.strokeCap = paintStrokeCap;
// }
// final StrokeJoin? paintStrokeJoin = enumValue<StrokeJoin>(StrokeJoin.values, source, [...key, 'strokeJoin']),
// if (paintStrokeJoin != null) {
// result.strokeJoin = paintStrokeJoin;
// }
// final double paintStrokeMiterLimit? = source.v<double>([...key, 'strokeMiterLimit']),
// if (paintStrokeMiterLimit != null) {
// result.strokeMiterLimit = paintStrokeMiterLimit;
// }
// final double paintStrokeWidth? = source.v<double>([...key, 'strokeWidth']),
// if (paintStrokeWidth != null) {
// result.strokeWidth = paintStrokeWidth;
// }
// final PaintingStyle? paintStyle = enumValue<PaintingStyle>(PaintingStyle.values, source, [...key, 'style']),
// if (paintStyle != null) {
// result.style = paintStyle;
// }
return result;
}