diff --git a/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart b/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart index b30a531..7f5d0d2 100644 --- a/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart +++ b/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart @@ -75,7 +75,6 @@ class _CountrySelectionBottomSheetState extends State { }), ), Container( - // width: 35, height: 40, margin: EdgeInsets.only(right: 17, left: 10), - // color: Const.primaryBlack, child: VerticalDivider(color: ColorConsts.primaryBlack, thickness: .7, width: 1), ), ], @@ -281,7 +279,6 @@ class _CommonAppbarState extends State { ), SizedBox(width: 8), Image.network(_copyRight.exposeFilePath, width: 30, height: 30) - //SvgPicture.asset("assets/logos/cloud_logo.svg", width: 30, height: 30) ], ), ) diff --git a/lib/ui/dialogs/otp_dialog.dart b/lib/ui/dialogs/otp_dialog.dart index 50c3629..96ea6a4 100644 --- a/lib/ui/dialogs/otp_dialog.dart +++ b/lib/ui/dialogs/otp_dialog.dart @@ -58,11 +58,9 @@ class _OTPDialogState extends State { style: TextStyle(color: Colors.white), ), Container( - // width: double.infinity, margin: EdgeInsets.only(top: 8, bottom: 8), padding: EdgeInsets.all(6), decoration: BoxDecoration( - // color: Colors.white, border: Border.all(width: 1, color: Colors.white), ), child: OTPWidget( diff --git a/lib/ui/screens/bookmark_screen.dart b/lib/ui/screens/bookmark_screen.dart index 00ae99d..2d2a5ee 100644 --- a/lib/ui/screens/bookmark_screen.dart +++ b/lib/ui/screens/bookmark_screen.dart @@ -37,15 +37,9 @@ class _BookmarkScreenState extends State { } void handleSlideAnimationChanged(Animation slideAnimation) { - // setState(() { - // _rotationAnimation = slideAnimation; - // }); } void handleSlideIsOpenChanged(bool isOpen) { - // setState(() { - // _fabColor = isOpen! ? Colors.green : Colors.blue; - // }); } void getBookMark() async { diff --git a/lib/ui/screens/forgot_password_screen.dart b/lib/ui/screens/forgot_password_screen.dart index d359d07..d2239bd 100644 --- a/lib/ui/screens/forgot_password_screen.dart +++ b/lib/ui/screens/forgot_password_screen.dart @@ -4,7 +4,6 @@ import 'package:tangheem/api/user_api_client.dart'; import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; import 'package:tangheem/extensions/string_extensions.dart'; -import 'package:tangheem/models/general_response_model.dart'; import 'package:tangheem/ui/dialogs/change_password_dialog.dart'; import 'package:tangheem/ui/dialogs/otp_dialog.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; @@ -22,7 +21,6 @@ class ForgotPasswordScreen extends StatefulWidget { class _ForgotPasswordScreenState extends State { TextEditingController _emailController = TextEditingController(); - GeneralResponseModel _generalResponse; @override void initState() { @@ -37,7 +35,7 @@ class _ForgotPasswordScreenState extends State { void forgotPassword(String email) async { Utils.showLoading(context); try { - _generalResponse = await UserApiClient().forgotPassword(email); + await UserApiClient().forgotPassword(email); Utils.showToast("تم إرسال OTP"); } catch (ex, tr) { Utils.handleException(ex, null); @@ -52,7 +50,7 @@ class _ForgotPasswordScreenState extends State { void verifyOTP(String email, int otp) async { Utils.showLoading(context); try { - _generalResponse = await UserApiClient().verifyOTP(email, otp); + await UserApiClient().verifyOTP(email, otp); } catch (ex, tr) { Utils.handleException(ex, null); Utils.hideLoading(context); @@ -67,7 +65,7 @@ class _ForgotPasswordScreenState extends State { void updatePassword(String email, int otp, String password) async { Utils.showLoading(context); try { - _generalResponse = await UserApiClient().updatePassword(email, otp, password); + await UserApiClient().updatePassword(email, otp, password); } catch (ex, tr) { Utils.handleException(ex, null); Utils.hideLoading(context); diff --git a/lib/ui/screens/home_screen.dart b/lib/ui/screens/home_screen.dart index e90a8f5..97cd9b9 100644 --- a/lib/ui/screens/home_screen.dart +++ b/lib/ui/screens/home_screen.dart @@ -27,9 +27,9 @@ class _HomeScreenState extends State { TextEditingController _searchController = TextEditingController(); FocusNode _searchFocusNode = FocusNode(); - List _surahList = []; - List _tangheemList = []; + ValueNotifier> _tangheemListNotifier = ValueNotifier([]); + List _surahList = []; int _selectedSurah = -1; int _selectedTangheemType = -1; @@ -51,6 +51,7 @@ class _HomeScreenState extends State { _surahList = _surahModel.data.map((element) => element.nameAR).toList(); await getTangheemTypes(); TangheemUserApiClient().addStatistics(1); + setState(() {}); Utils.hideLoading(context); } catch (ex, tr) { print(ex); @@ -62,8 +63,7 @@ class _HomeScreenState extends State { Future getTangheemTypes() async { try { _tangheemType = await TangheemUserApiClient().getTangheemType(); - _tangheemList = _tangheemType?.data?.where((element) => element.isActive)?.toList()?.map((element) => element.tangheemTypeName)?.toList() ?? []; - setState(() {}); + _tangheemListNotifier.value = _tangheemType?.data?.where((element) => element.isActive)?.toList()?.map((element) => element.tangheemTypeName)?.toList() ?? []; } catch (ex, tr) {} } @@ -101,13 +101,18 @@ class _HomeScreenState extends State { Row( children: [ Expanded( - child: CommonDropDownButton(_selectedTangheemType, hintText: "اختر الأسلوب اللغوي", list: _tangheemList, onSelect: (index) { - if (_selectedTangheemType != index) { - setState(() { - _selectedTangheemType = index; + child: ValueListenableBuilder( + valueListenable: _tangheemListNotifier, + builder: (context, value, child) { + return CommonDropDownButton(_selectedTangheemType, hintText: "اختر الأسلوب اللغوي", list: value, onSelect: (index) { + if (_selectedTangheemType != index) { + setState(() { + _selectedTangheemType = index; + }); + } }); - } - }), + }, + ), ), SizedBox(width: 8), Expanded( @@ -136,7 +141,7 @@ class _HomeScreenState extends State { } _searchFocusNode.unfocus(); _searchFocusNode.canRequestFocus = false; - var data = {"tangheemTypeName": _tangheemList[_selectedTangheemType], "surahData": _surahModel.data[_selectedSurah]}; + var data = {"tangheemTypeName": _tangheemListNotifier.value[_selectedTangheemType], "surahData": _surahModel.data[_selectedSurah]}; await Navigator.pushNamed(context, TangheemScreen.routeName, arguments: data); _searchFocusNode.canRequestFocus = true; getTangheemTypes(); diff --git a/lib/ui/screens/quran_screen.dart b/lib/ui/screens/quran_screen.dart index 68effee..34de748 100644 --- a/lib/ui/screens/quran_screen.dart +++ b/lib/ui/screens/quran_screen.dart @@ -31,7 +31,6 @@ class QuranScreen extends StatefulWidget { } class _QuranScreenState extends State { - GlobalKey _globalKey = GlobalKey(); int _selectedSurah = -1; int _selectedFromAya = -1; int _selectedToAya = -1; @@ -81,9 +80,7 @@ class _QuranScreenState extends State { } _surahList = _surahModel.data.map((element) => element.nameAR).toList(); _currentPage = widget.bookmark?.page ?? 1; - Utils.hideLoading(context); - //filterData(); } catch (ex, tr) { Utils.hideLoading(context); Utils.handleException(ex, null); @@ -113,33 +110,23 @@ class _QuranScreenState extends State { filteredAyahList = List.generate(getNextMultiple(numberOfAyah), (index) => index + 1).toList().where((element) => element == 1 || (element % 5) == 0).toList() ?? []; _fromAyaList = filteredAyahList.getRange(0, filteredAyahList.length - 1)?.toList() ?? []; - // _toAyaList = filteredAyahList.getRange(1, filteredAyahList.length)?.toList() ?? []; - // _currentPage = 0; - // _selectedFromAya = 0; - // _selectedToAya = 0; setState(() {}); - // getTangheemBySurahId(); } void getTangheemBySurahId() async { - //Utils.showLoading(context); try { _ayatTangheemTypeMapped = await TangheemUserApiClient().getTangheemBySurah(_selectedSurah + 1); _tangheemWords = _ayatTangheemTypeMapped?.data?.map((e) => e.highlightText)?.toList() ?? []; } catch (ex, tr) { Utils.handleException(ex, null); - } finally { - //Utils.hideLoading(context); - } + } finally {} setState(() {}); - //getAyaByRange(); } void getAyaByRange() async { Utils.showLoading(context); try { _ayaModel = await TangheemUserApiClient().getAyaByFilter(_selectedSurah + 1, _fromAyaList[_selectedFromAya], _toAyaList[_selectedToAya]); - //setState(() {}); } catch (ex, tr) { Utils.handleException(ex, null); } finally { @@ -291,15 +278,6 @@ class _QuranScreenState extends State { } } }), - // SizedBox(width: 8), - // commonIconButton( - // "مسح البحث", - // "assets/icons/cancel.svg", - // (_selectedSurah == -1 || _selectedFromAya == -1 || _selectedToAya == -1) - // ? null - // : () { - // _clearFilterAndRefreshData(); - // }), ], ), SizedBox(height: 16), @@ -340,56 +318,9 @@ class _QuranScreenState extends State { Expanded( child: SingleChildScrollView( physics: BouncingScrollPhysics(), - child: RepaintBoundary( - key: _globalKey, - child: Material( - color: Colors.white, - child: ListView( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.only(top: 16, bottom: 8), - children: [ - // Text( - // "بسم الله الرحمن الرحيم", - // textAlign: TextAlign.center, - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1), - // ), - // SizedBox(height: 8), - Container(padding: EdgeInsets.only(left: 4, right: 4), child: quranText() - // 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, - // highLightColor: 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, - // ), - // ), - ), - ], - ), - ), + child: Padding( + padding: EdgeInsets.only(left: 4, right: 4), + child: quranText(), ), ), ), @@ -421,7 +352,6 @@ class _QuranScreenState extends State { ), ), ), - // AyaPlayerWidget(surahName: _surahList.isNotEmpty ? _surahList[_selectedSurah] : "", globalKey: _globalKey) ], ), ); @@ -635,7 +565,6 @@ class _QuranScreenState extends State { Navigator.pop(context); var temp = _bookMark.firstWhere((element) => element.ayahID == _selectedAyaForBookmark.ayahID, orElse: () => null); if (temp != null) { - // Utils.showToast("هذه الأية مضافة سابقا"); return; } diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart index de1d662..10cae48 100644 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ b/lib/ui/screens/tangheem_detail_screen.dart @@ -21,8 +21,6 @@ import 'login_screen.dart'; class TangheemDetailScreen extends StatefulWidget { static const String routeName = "/tangheem_detail"; final List ayatTangheemTypeMappedDataList; - - // final AyatTangheemTypeMappedData ayatTangheemTypeMappedData; TangheemDetailScreen({Key key, this.ayatTangheemTypeMappedDataList}) : super(key: key); @override @@ -169,7 +167,6 @@ class _TangheemDetailScreenState extends State { _ayatTangheemTypeMappedData?.property?.where((element) => (element.isInsideTable) && (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; _tangheemInsideTableValueList = _ayatTangheemTypeMappedData?.property?.where((element) => (!element.isInsideTable) && (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; - // _tangheemInsideTableEmptyList = _ayatTangheemTypeMappedData?.property?.where((element) => (!element.isInsideTable) && (element.propertyValue ?? "").isEmpty)?.toList() ?? []; return ListView( physics: NeverScrollableScrollPhysics(), @@ -461,7 +458,6 @@ class _TangheemDetailScreenState extends State { }, ); - // set up the AlertDialog AlertDialog alert = AlertDialog( content: Text("هذه الخاصية متاحه فقط للأعضاء المسجلين"), actions: [ @@ -470,7 +466,6 @@ class _TangheemDetailScreenState extends State { ], ); - // show the dialog showDialog( context: context, builder: (BuildContext context) { diff --git a/lib/widgets/aya_player_widget.dart b/lib/widgets/aya_player_widget.dart index 4ae46e1..ed8a7bf 100644 --- a/lib/widgets/aya_player_widget.dart +++ b/lib/widgets/aya_player_widget.dart @@ -37,8 +37,6 @@ class _AyaPlayerWidgetState extends State { AudioPlayer _player; bool _isAudioHaveError = false; - int _currentVoiceNote = -1; - @override void initState() { super.initState(); @@ -48,18 +46,12 @@ class _AyaPlayerWidgetState extends State { setAudioSource() { try { - // final _playlist = ConcatenatingAudioSource(children: [ - // AudioSource.uri( - // Uri.parse("https://server6.mp3quran.net/thubti/109.mp3"), - // ), - // ]); List voiceList = []; if ((widget.voiceNoteList?.length ?? 0) > 0) { voiceList = widget.voiceNoteList.map((e) => AudioSource.uri(Uri.parse(e.exposeFilePath))).toList(); - // _currentVoiceNote = 0; } - // voiceList = [AudioSource.uri(Uri.parse(widget.voiceNoteList.first.exposeFilePath))]; + final _playlist = ConcatenatingAudioSource(children: voiceList); _player.setAudioSource(_playlist, initialIndex: 0, initialPosition: Duration.zero).then((value) => () {}); } catch (e) { diff --git a/lib/widgets/common_textfield_widget.dart b/lib/widgets/common_textfield_widget.dart index 3f73cea..c886ab3 100644 --- a/lib/widgets/common_textfield_widget.dart +++ b/lib/widgets/common_textfield_widget.dart @@ -18,7 +18,6 @@ class CommonTextFieldWidget extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - // height: 50, child: TextField( textAlignVertical: TextAlignVertical.center, controller: controller, diff --git a/lib/widgets/otp_widget.dart b/lib/widgets/otp_widget.dart index 5e8ca11..918107c 100644 --- a/lib/widgets/otp_widget.dart +++ b/lib/widgets/otp_widget.dart @@ -81,7 +81,6 @@ class OTPWidget extends StatefulWidget { class OTPWidgetState extends State with SingleTickerProviderStateMixin { AnimationController _highlightAnimationController; - Animation _highlightAnimationColorTween; FocusNode focusNode; String text = ""; int currentIndex = 0;