Showing
1 changed file
with
17 additions
and
0 deletions
@@ -74,6 +74,23 @@ class TextStyle { | @@ -74,6 +74,23 @@ class TextStyle { | ||
74 | ); | 74 | ); |
75 | } | 75 | } |
76 | 76 | ||
77 | + TextStyle merge(TextStyle other) { | ||
78 | + if (other == null) { | ||
79 | + return this; | ||
80 | + } | ||
81 | + | ||
82 | + return copyWith( | ||
83 | + color: other.color, | ||
84 | + font: other.font, | ||
85 | + fontSize: other.fontSize, | ||
86 | + letterSpacing: other.letterSpacing, | ||
87 | + wordSpacing: other.wordSpacing, | ||
88 | + lineSpacing: other.lineSpacing, | ||
89 | + height: other.height, | ||
90 | + background: other.background, | ||
91 | + ); | ||
92 | + } | ||
93 | + | ||
77 | @override | 94 | @override |
78 | String toString() => | 95 | String toString() => |
79 | 'TextStyle(color:$color font:$font letterSpacing:$letterSpacing wordSpacing:$wordSpacing lineSpacing:$lineSpacing height:$height background:$background)'; | 96 | 'TextStyle(color:$color font:$font letterSpacing:$letterSpacing wordSpacing:$wordSpacing lineSpacing:$lineSpacing height:$height background:$background)'; |
-
Please register or login to post a comment