In flutter, Is there any way to set textAlign for each line separately?
I want something like telegram app text input:
In telegram, if the line starts with a rtl language, text align is right otherwise it is left.
I try these ways so far:
2- Checking text with intl.Bidi.detectRtlDirectionality
and set textAlign dynamically.
But all of these ways sets the textAlign for all lines, I want to set it separately for each line.
2
Answers
Wrap each line with align widget separately and give alignment property as per your requirement
Detect language and change
textDirection
andtextAlign
properly.You can detect languages with
RegExp
class.Use
onChanged
call back property ofTextField
to detect language.