elementSettingsSame static method

bool elementSettingsSame(
  1. TextElement a,
  2. TextElement b
)

Return true if settings are all the same.

Purposely excludes measurement because the measurement will request the native TextElement to layout, which is expensive. We want to avoid the layout by comparing with another TextElement to see if they have the same settings.

Implementation

static bool elementSettingsSame(TextElement a, TextElement b) {
  return a.textStyle == b.textStyle &&
      a.maxWidth == b.maxWidth &&
      a.maxWidthStrategy == b.maxWidthStrategy &&
      a.text == b.text &&
      a.textDirection == b.textDirection;
}