diff --git a/lib/models/aya_model.dart b/lib/models/aya_model.dart index a7d2d99..006b41d 100644 --- a/lib/models/aya_model.dart +++ b/lib/models/aya_model.dart @@ -50,21 +50,21 @@ class AyaModelData { AyaModelData( {this.surahID, - this.surahNameAR, - this.surahNameEN, - this.numberOfAyahs, - this.englishNameTranslation, - this.revelationID, - this.revelationType, - this.ayahID, - this.numberInSurah, - this.page, - this.quarterID, - this.juzID, - this.manzil, - this.sajda, - this.ayahText, - this.eighthsID}); + this.surahNameAR, + this.surahNameEN, + this.numberOfAyahs, + this.englishNameTranslation, + this.revelationID, + this.revelationType, + this.ayahID, + this.numberInSurah, + this.page, + this.quarterID, + this.juzID, + this.manzil, + this.sajda, + this.ayahText, + this.eighthsID}); AyaModelData.fromJson(Map json) { surahID = json['surahID']; @@ -105,4 +105,11 @@ class AyaModelData { data['eighths_ID'] = this.eighthsID; 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"; + } } diff --git a/lib/ui/screens/quran_screen.dart b/lib/ui/screens/quran_screen.dart index 0723f21..2bba575 100644 --- a/lib/ui/screens/quran_screen.dart +++ b/lib/ui/screens/quran_screen.dart @@ -86,7 +86,7 @@ class _QuranScreenState extends State { // _selectedFromAya = 0; // _selectedToAya = 0; setState(() {}); - //getTangheemBySurahId(); + // getTangheemBySurahId(); } void getTangheemBySurahId() async { @@ -107,19 +107,19 @@ class _QuranScreenState extends State { Utils.showLoading(context); try { _ayaModel = await TangheemUserApiClient().getAyaByFilter(_selectedSurah + 1, _fromAyaList[_selectedFromAya], _toAyaList[_selectedToAya]); - setState(() {}); + //setState(() {}); } catch (ex, tr) { Utils.handleException(ex, null); } finally { Utils.hideLoading(context); } + getTangheemBySurahId(); scrollToId.animateTo("$_currentPage", duration: Duration(milliseconds: 300), curve: Curves.ease); } void getQuranByPageNo() async { Utils.showLoading(context); try { - // _currentPage = 603; _ayaModel = await TangheemUserApiClient().getQuranByPageNo(_currentPage); Utils.hideLoading(context); setState(() {}); @@ -181,7 +181,7 @@ class _QuranScreenState extends State { String _surahAya = ""; _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; }); @@ -312,35 +312,37 @@ class _QuranScreenState extends State { // SizedBox(height: 8), Container( padding: EdgeInsets.only(left: 4, right: 4), - child: Text( - _surahAya, - textAlign: TextAlign.center, + child: + + // 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 _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, - color: ColorConsts.primaryBlue, fontWeight: FontWeight.bold, ), ), - // todo "sikander" : lines commented for future - // TextHighLightWidget( - // text: _surahAya, - // valueColor: ColorConsts.primaryBlue, - // highlights: _tangheemWords, - // onTap: (value) { - // List _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, - // ), - // ), ), ], ), diff --git a/lib/widgets/aya_player_widget.dart b/lib/widgets/aya_player_widget.dart index 9474d8a..5455f6e 100644 --- a/lib/widgets/aya_player_widget.dart +++ b/lib/widgets/aya_player_widget.dart @@ -47,10 +47,10 @@ class _AyaPlayerWidgetState extends State { try { final _playlist = ConcatenatingAudioSource(children: [ 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) { // voiceList = widget.voiceNoteList.map((e) => AudioSource.uri(Uri.parse(e.exposeFilePath))).toList();