'flutter arabic justified alignment not working
I'm developing a quran app with flutter and i've done most of the work. but when it comes to the proper alignment it doesn't work.
I'm doing the alignment with TextAlignment.justify
but it's not working.
the code is as follows
Text.rich(
TextSpan(
text: '',
style: TextStyle(
color: Theme.of(context).primaryColor,
letterSpacing: 0
),
children:<TextSpan> [
for (var j = 0; j < quran.getPageData(storage.read('value') + 1).length; j++) ...{
for (var i = quran.getPageData(storage.read('value') + 1)[j]['start']; i <= quran.getPageData(storage.read('value') + 1)[j]['end']; i++) ...{
i == 1 &&
storage.read('value') + 1 != 1 &&
storage.read('value') + 1 != 9
? const TextSpan(
text: '\t' +
quran.basmala +
'\t' +
'\n',
style: TextStyle(
fontFamily: 'bismillah'),
)
: const TextSpan(),
TextSpan(
text:
//'\u202E' +
quran.getVerse(
quran.getPageData(
storage.read('value') +
1)[j]['surah'],
i,
verseEndSymbol: true
),
//.replaceAll(RegExp(' '), ""),
style: TextStyle(
fontSize: width * 0.048,
fontWeight: FontWeight.w500,
fontFamily: 'm1',
letterSpacing: 0.0,
),
recognizer: TapGestureRecognizer()
..onTap = () {
print(
'${quran.getPageData(604)[j]['surah']}');
}),
TextSpan(text: " ")
},
const TextSpan(text: '\n')
}
],
),
textDirection: TextDirection.rtl,
textAlign: TextAlign.justify,
// textScaleFactor: width * 0.0025,
// overflow: TextOverflow.visible,
maxLines: 15,
)
how can i solve this issue? how can i make justify work for arabic text?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|