From a3bf02d44742e0ca6e0fbb7bf77cd824813b38d2 Mon Sep 17 00:00:00 2001 From: Grok_Narok Date: Mon, 19 Jul 2021 15:18:01 +1000 Subject: [PATCH] fix default text alignment with rtl direction --- lib/substring_highlight.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/substring_highlight.dart b/lib/substring_highlight.dart index c7d50ab..edcc30f 100644 --- a/lib/substring_highlight.dart +++ b/lib/substring_highlight.dart @@ -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, ), @@ -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; @@ -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); } }