diff --git a/lib/ui/screens/surah_screen.dart b/lib/ui/screens/surah_screen.dart index af16d40..c0f4a3d 100644 --- a/lib/ui/screens/surah_screen.dart +++ b/lib/ui/screens/surah_screen.dart @@ -118,7 +118,7 @@ class _SurahScreenState extends State { if (_selectedFromAya != index) { _selectedFromAya = index; _selectedToAya = index; - filterData(); + getAyaByRange(); } }), ), @@ -127,7 +127,7 @@ class _SurahScreenState extends State { child: CommonDropDownButton(_selectedToAya, list: _toAyaList.map((e) => "الى الاية" + " $e").toList(), onSelect: (index) { if (_selectedToAya != index) { _selectedToAya = index; - filterData(); + getAyaByRange(); } }), ), @@ -147,8 +147,24 @@ class _SurahScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - nextOptionButton("assets/icons/prev.svg", "سورة الفاتحة", () {}), - previousOptionButton("assets/icons/next.svg", "سورة آل عمران", () {}), + nextOptionButton( + "assets/icons/prev.svg", + _selectedSurah == 0 ? "" : _surahList[_selectedSurah - 1], + _selectedSurah == 0 + ? null + : () { + _selectedSurah = _selectedSurah - 1; + filterData(); + }), + previousOptionButton( + "assets/icons/next.svg", + _selectedSurah == (_surahList.length) ? "" : _surahList[_selectedSurah + 1], + _selectedSurah == (_surahList.length) + ? null + : () { + _selectedSurah = _selectedSurah + 1; + filterData(); + }), ], ), Expanded( @@ -204,36 +220,40 @@ class _SurahScreenState extends State { Widget nextOptionButton(String icon, String text, VoidCallback onPressed) { return InkWell( onTap: onPressed, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - SvgPicture.asset(icon, height: 12, width: 12), - SizedBox(width: 4), - Text( - text, - style: TextStyle(color: ColorConsts.textGrey), - ), - ], - ), + child: onPressed == null + ? SizedBox() + : Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SvgPicture.asset(icon, height: 12, width: 12), + SizedBox(width: 4), + Text( + text, + style: TextStyle(color: ColorConsts.textGrey), + ), + ], + ), ); } Widget previousOptionButton(String icon, String text, VoidCallback onPressed) { return InkWell( onTap: onPressed, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - text, - style: TextStyle(color: ColorConsts.textGrey), - ), - SizedBox(width: 4), - SvgPicture.asset(icon, height: 12, width: 12), - ], - ), + child: onPressed == null + ? SizedBox() + : Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + text, + style: TextStyle(color: ColorConsts.textGrey), + ), + SizedBox(width: 4), + SvgPicture.asset(icon, height: 12, width: 12), + ], + ), ); } }