MatchHighlightStyle class

Styles used to highlight occurrences found by the controller.findWord() API.

Provides separate TextStyle values for the currently selected match and for all other matches, so the active match can be visually emphasized while keeping other matches visible.

Fields:

  • currentMatchStyle: TextStyle applied to the currently selected/active match. Use this to draw attention to the match the user is navigating to.
  • otherMatchStyle: TextStyle applied to all non-active matches. Typically a subtler style than the currentMatchStyle (for example a translucent background color).

Usage example:

matchHighlightStyle: const MatchHighlightStyle(
  currentMatchStyle: TextStyle(
    backgroundColor: Color(0xFFFFA726),
  ),
  otherMatchStyle: TextStyle(
    backgroundColor: Color(0x55FFFF00),
  ),
),

Notes:

  • Prefer using const constructors and const TextStyle values where possible to improve performance.
  • The exact visual result depends on how the editor widget composes the TextStyle with surrounding styles; typically only the differing properties (for example backgroundColor) will have a visible effect.

Constructors

MatchHighlightStyle({required TextStyle currentMatchStyle, required TextStyle otherMatchStyle})
const

Properties

currentMatchStyle TextStyle
Style for the currently selected match.
final
hashCode int
The hash code for this object.
no setterinherited
otherMatchStyle TextStyle
Style for all other matches.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited