ayat num reverse method added.

development
Sikander Saleem 5 years ago
parent 5790adf6d2
commit 7100682eda

@ -50,21 +50,21 @@ class AyaModelData {
AyaModelData( AyaModelData(
{this.surahID, {this.surahID,
this.surahNameAR, this.surahNameAR,
this.surahNameEN, this.surahNameEN,
this.numberOfAyahs, this.numberOfAyahs,
this.englishNameTranslation, this.englishNameTranslation,
this.revelationID, this.revelationID,
this.revelationType, this.revelationType,
this.ayahID, this.ayahID,
this.numberInSurah, this.numberInSurah,
this.page, this.page,
this.quarterID, this.quarterID,
this.juzID, this.juzID,
this.manzil, this.manzil,
this.sajda, this.sajda,
this.ayahText, this.ayahText,
this.eighthsID}); this.eighthsID});
AyaModelData.fromJson(Map<String, dynamic> json) { AyaModelData.fromJson(Map<String, dynamic> json) {
surahID = json['surahID']; surahID = json['surahID'];
@ -105,4 +105,11 @@ class AyaModelData {
data['eighths_ID'] = this.eighthsID; data['eighths_ID'] = this.eighthsID;
return data; return data;
} }
String reverseAyatNumber() {
String _ayaTemp = ayahText.substring(0, ayahText.length - numberInSurah.toString().length);
String _ayaNum = ayahText.substring(ayahText.length - numberInSurah.toString().length, ayahText.length);
_ayaNum = _ayaNum.split('').reversed.join('');
return "$_ayaTemp$_ayaNum";
}
} }

@ -86,7 +86,7 @@ class _QuranScreenState extends State<QuranScreen> {
// _selectedFromAya = 0; // _selectedFromAya = 0;
// _selectedToAya = 0; // _selectedToAya = 0;
setState(() {}); setState(() {});
//getTangheemBySurahId(); // getTangheemBySurahId();
} }
void getTangheemBySurahId() async { void getTangheemBySurahId() async {
@ -107,19 +107,19 @@ class _QuranScreenState extends State<QuranScreen> {
Utils.showLoading(context); Utils.showLoading(context);
try { try {
_ayaModel = await TangheemUserApiClient().getAyaByFilter(_selectedSurah + 1, _fromAyaList[_selectedFromAya], _toAyaList[_selectedToAya]); _ayaModel = await TangheemUserApiClient().getAyaByFilter(_selectedSurah + 1, _fromAyaList[_selectedFromAya], _toAyaList[_selectedToAya]);
setState(() {}); //setState(() {});
} catch (ex, tr) { } catch (ex, tr) {
Utils.handleException(ex, null); Utils.handleException(ex, null);
} finally { } finally {
Utils.hideLoading(context); Utils.hideLoading(context);
} }
getTangheemBySurahId();
scrollToId.animateTo("$_currentPage", duration: Duration(milliseconds: 300), curve: Curves.ease); scrollToId.animateTo("$_currentPage", duration: Duration(milliseconds: 300), curve: Curves.ease);
} }
void getQuranByPageNo() async { void getQuranByPageNo() async {
Utils.showLoading(context); Utils.showLoading(context);
try { try {
// _currentPage = 603;
_ayaModel = await TangheemUserApiClient().getQuranByPageNo(_currentPage); _ayaModel = await TangheemUserApiClient().getQuranByPageNo(_currentPage);
Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
@ -181,7 +181,7 @@ class _QuranScreenState extends State<QuranScreen> {
String _surahAya = ""; String _surahAya = "";
_ayaModel?.data?.forEach((element) { _ayaModel?.data?.forEach((element) {
var temp = element.numberInSurah == 1 ? getBismillahWithSurahName(element.surahNameAR, element.surahID != 1, _surahAya.length <= 1) + element.ayahText : element.ayahText; var temp = element.numberInSurah == 1 ? getBismillahWithSurahName(element.surahNameAR, element.surahID != 1, _surahAya.length <= 1) + element.reverseAyatNumber() : element.reverseAyatNumber();
_surahAya = _surahAya + temp; _surahAya = _surahAya + temp;
}); });
@ -312,35 +312,37 @@ class _QuranScreenState extends State<QuranScreen> {
// SizedBox(height: 8), // SizedBox(height: 8),
Container( Container(
padding: EdgeInsets.only(left: 4, right: 4), padding: EdgeInsets.only(left: 4, right: 4),
child: Text( child:
_surahAya,
textAlign: TextAlign.center, // Text(
// _surahAya,
// textAlign: TextAlign.center,
// style: TextStyle(
// fontFamily: "UthmanicHafs",
// fontSize: 18,
// color: ColorConsts.primaryBlue,
// fontWeight: FontWeight.bold,
// ),
// ),
// todo "sikander" : lines commented for future
TextHighLightWidget(
text: _surahAya,
valueColor: ColorConsts.primaryBlue,
highlights: _tangheemWords,
onTap: (value) {
List<AyatTangheemTypeMappedData> _ayatList = _ayatTangheemTypeMapped.data?.where((element) => element.highlightText == value)?.toList() ?? [];
if (_ayatList.length > 1) {
_selectTangheemType(_ayatList);
} else {
Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: _ayatList.first);
}
},
style: TextStyle( style: TextStyle(
fontFamily: "UthmanicHafs", fontFamily: "UthmanicHafs",
fontSize: 18, fontSize: 18,
color: ColorConsts.primaryBlue,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
// todo "sikander" : lines commented for future
// TextHighLightWidget(
// text: _surahAya,
// valueColor: ColorConsts.primaryBlue,
// highlights: _tangheemWords,
// onTap: (value) {
// List<AyatTangheemTypeMappedData> _ayatList = _ayatTangheemTypeMapped.data?.where((element) => element.highlightText == value)?.toList() ?? [];
// if (_ayatList.length > 1) {
// _selectTangheemType(_ayatList);
// } else {
// Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: _ayatList.first);
// }
// },
// style: TextStyle(
// fontFamily: "UthmanicHafs",
// fontSize: 18,
// fontWeight: FontWeight.bold,
// ),
// ),
), ),
], ],
), ),

@ -47,10 +47,10 @@ class _AyaPlayerWidgetState extends State<AyaPlayerWidget> {
try { try {
final _playlist = ConcatenatingAudioSource(children: [ final _playlist = ConcatenatingAudioSource(children: [
AudioSource.uri( AudioSource.uri(
Uri.parse("https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_1MG.mp3"), Uri.parse("https://server6.mp3quran.net/thubti/109.mp3"),
), ),
]); ]);
var voiceList = [AudioSource.uri(Uri.parse("https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3"))]; var voiceList = [AudioSource.uri(Uri.parse("https://server6.mp3quran.net/thubti/109.mp3"))];
// if ((widget.voiceNoteList?.length ?? 0) > 0) { // if ((widget.voiceNoteList?.length ?? 0) > 0) {
// voiceList = widget.voiceNoteList.map((e) => AudioSource.uri(Uri.parse(e.exposeFilePath))).toList(); // voiceList = widget.voiceNoteList.map((e) => AudioSource.uri(Uri.parse(e.exposeFilePath))).toList();

Loading…
Cancel
Save