Skip to content

Commit db29c7d

Browse files
committed
Saad Style Sheets #6
1 parent 839611d commit db29c7d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/src/api/typed_value.dart

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,17 @@ extension ConversionExt on Object? {
187187
if (value == null) return null;
188188
if (value is ColorRGBA) return value;
189189
if (value is String) return ColorRGBA.fromHex(value);
190-
if (value is ColorRGB)
190+
if (value is ColorRGB) {
191191
return ColorRGBA(r: value.r, g: value.g, b: value.b, a: alpha);
192+
}
193+
if (value is PaintModel) {
194+
return ColorRGBA(
195+
r: value.color?.r ?? 0,
196+
g: value.color?.g ?? 0,
197+
b: value.color?.b ?? 0,
198+
a: value.opacity,
199+
);
200+
}
192201

193202
return null;
194203
}
@@ -200,6 +209,13 @@ extension ConversionExt on Object? {
200209
if (value is ColorRGB) return value;
201210
if (value is String) return ColorRGB.fromHex(value);
202211
if (value is ColorRGBA) return ColorRGB(r: value.r, g: value.g, b: value.b);
212+
if (value is PaintModel) {
213+
return ColorRGB(
214+
r: value.color?.r ?? 0,
215+
g: value.color?.g ?? 0,
216+
b: value.color?.b ?? 0,
217+
);
218+
}
203219

204220
return null;
205221
}

0 commit comments

Comments
 (0)