Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/substring_highlight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SubstringHighlight extends StatelessWidget {
this.term,
this.terms,
required this.text,
this.textAlign = TextAlign.left,
this.textAlign,
this.textStyle = const TextStyle(
color: Colors.black,
),
Expand Down Expand Up @@ -51,7 +51,7 @@ class SubstringHighlight extends StatelessWidget {
final String text;

/// How the text should be aligned horizontally.
final TextAlign textAlign;
final TextAlign? textAlign;

/// The {TextStyle} of the {SubstringHighlight.text} that isn't highlighted.
final TextStyle textStyle;
Expand Down Expand Up @@ -162,7 +162,7 @@ class SubstringHighlight extends StatelessWidget {
maxLines: maxLines,
overflow: overflow,
text: TextSpan(children: children, style: textStyle),
textAlign: textAlign,
textAlign: textAlign ?? DefaultTextStyle.of(context).textAlign ?? TextAlign.start,
textScaleFactor: MediaQuery.of(context).textScaleFactor);
}
}