Skip to content

Commit 87c1c99

Browse files
committed
[STYLE] Handles the new format for fills and borders
1 parent 2fd00f3 commit 87c1c99

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

package/pheno_ui/lib/models/figma_style_model.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,24 @@ class FigmaStyleModel {
6666
final FigmaStyleBlendMode blendMode;
6767

6868
FigmaStyleModel._fromJson(Map<String, dynamic> json) :
69-
color = json['color'] == null || json['color']['r'] == null ? null : Color.fromRGBO(
70-
(json['color']['r'] * 255.0).round(),
71-
(json['color']['g'] * 255.0).round(),
72-
(json['color']['b'] * 255.0).round(),
73-
(json['color']['o'] ?? 1.0).toDouble(),
69+
color = json['fill']['color'] == null ? null : Color.fromRGBO(
70+
(json['fill']['color']['r'] * 255.0).round(),
71+
(json['fill']['color']['g'] * 255.0).round(),
72+
(json['fill']['color']['b'] * 255.0).round(),
73+
(json['fill']['opacity'] ?? 1.0).toDouble(),
7474
),
7575
borderRadius = json['border']['radius']['tl'] == null ? null : BorderRadius.only(
7676
topLeft: Radius.circular(json['border']['radius']['tl'].toDouble()),
7777
topRight: Radius.circular(json['border']['radius']['tr'].toDouble()),
7878
bottomLeft: Radius.circular(json['border']['radius']['bl'].toDouble()),
7979
bottomRight: Radius.circular(json['border']['radius']['br'].toDouble())
8080
),
81-
border = json['border']['color'] == null || json['border']['color']['r'] == null ? null : FigmaStyleBorder.all(
81+
border = json['border']['color'] == null ? null : FigmaStyleBorder.all(
8282
color: Color.fromRGBO(
8383
(json['border']['color']['r'] * 255.0).round(),
8484
(json['border']['color']['g'] * 255.0).round(),
8585
(json['border']['color']['b'] * 255.0).round(),
86-
(json['color']['o'] ?? 1.0).toDouble(),
86+
(json['border']['opacity'] ?? 1.0).toDouble(),
8787
),
8888
width: json['border']['width'].toDouble()
8989
),

0 commit comments

Comments
 (0)