Skip to content

Commit afb5476

Browse files
committed
Saad Style Sheets #16
1 parent db29c7d commit afb5476

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

lib/src/api/models/start_end_prop.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,24 @@ class TextProp extends Equatable with SerializableMixin {
202202
isJsonPath: isJsonPath ?? this.isJsonPath,
203203
);
204204

205+
/// Returns true if this instance is equivalent to the [other].
206+
/// The reason this comparison is not done in [Equatable] is because
207+
/// [fills] is a list of [PaintModel]s which each has their own
208+
/// id, differentiating them from each other. So, we need to compare
209+
/// each [PaintModel] in the list.
210+
bool isEquivalentTo(TextProp? other) {
211+
return other != null &&
212+
fills.length == other.fills.length &&
213+
fills.every((e) => other.fills.contains(e)) &&
214+
textDecoration == other.textDecoration &&
215+
fontSize == other.fontSize &&
216+
letterSpacing == other.letterSpacing &&
217+
fontName == other.fontName &&
218+
lineHeight == other.lineHeight &&
219+
link == other.link &&
220+
isJsonPath == other.isJsonPath;
221+
}
222+
205223
@override
206224
List<Object> get props => [
207225
fills,

0 commit comments

Comments
 (0)