diff --git a/lib/ui/common_appbar.dart b/lib/ui/common_appbar.dart index 6641b09..5db6a9f 100644 --- a/lib/ui/common_appbar.dart +++ b/lib/ui/common_appbar.dart @@ -158,141 +158,148 @@ class _CommonAppbarState extends State { right: false, left: false, maintainBottomViewPadding: true, - child: Column( - children: [ - Container( - height: 100 + height, - padding: EdgeInsets.only(left: 0, top: height), - alignment: Alignment.centerLeft, - child: IconButton( - icon: Icon(Icons.clear, color: ColorConsts.textGrey), - onPressed: () { - if (_scaffoldKey.currentState.isDrawerOpen) { - Navigator.pop(context); - } - }, - ), - ), - Container( - margin: EdgeInsets.only(top: 8, bottom: 16), - padding: EdgeInsets.only(left: 16, right: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - commonIconButton("assets/icons/bookmark.svg", () { - Navigator.pushNamed(context, BookmarkScreen.routeName); - }), - commonIconButton("assets/icons/increase_size.svg", () { - if (fontSize >= 36) { - Utils.showToast("وصل حجم الخط إلى الحد الأقصى للحجم"); - return; - } - fontSize += 2; - prefs.setInt(GlobalConsts.fontZoomSize, fontSize); - Utils.showToast("زيادة حجم الخط"); - }), - commonIconButton("assets/icons/reduce_size.svg", () { - if (fontSize <= 12) { - Utils.showToast("وصل حجم الخط إلى الحد الأدنى للحجم"); - return; + child: Builder( + builder: (context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + Widget listContents = ListView.builder( + shrinkWrap: true, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(left: 24, right: 24), + itemCount: navigationList.length, + itemBuilder: (context, index) { + String icon = "assets/icons/${navigationList[index].mobileFontIcon}.svg"; + var subList = navigationList.where((element) => element.parentId == navigationList[index].navigationId).toList(); + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (navigationList[index].parentId == 1) + myListItem(icon, navigationList[index].navigationText, navigationList[index].orderNo == 1 ? true : false, onTap: () { + String url = navigationList[index]?.mobileNavigationUrl ?? ""; + if (url.isEmpty || url.length < 2) { + return; + } + Navigator.pushNamed(context, url, arguments: null); + }), + for (var subItem in subList) + Container( + width: double.infinity, + child: Row( + children: [ + Expanded( + child: myListItem("assets/icons/${subItem.mobileFontIcon}.svg", subItem.navigationText, false, onTap: () { + String url = subItem.mobileNavigationUrl ?? ""; + if (url.isEmpty) { + return; + } + var contentId; + if (subItem.mobileNavigationUrl == "/introduction") { + url = ContentInfoScreen.routeName; + contentId = 2; + } else if (subItem.mobileNavigationUrl == "/encyclopedia") { + url = ContentInfoScreen.routeName; + contentId = 1; + } + Navigator.pushNamed(context, url, arguments: contentId); + }), + ), + Container( + height: 40, + margin: EdgeInsets.only(right: 17, left: 10), + child: VerticalDivider(color: ColorConsts.primaryBlack, thickness: .7, width: 1), + ), + ], + ), + ) + ], + ); + }); + if (isPortrait) { + listContents = Expanded(child: listContents); + } + List list = [ + Container( + height: 100 + height, + padding: EdgeInsets.only(left: 0, top: height), + alignment: Alignment.centerLeft, + child: IconButton( + icon: Icon(Icons.clear, color: ColorConsts.textGrey), + onPressed: () { + if (_scaffoldKey.currentState.isDrawerOpen) { + Navigator.pop(context); } - fontSize -= 2; - prefs.setInt(GlobalConsts.fontZoomSize, fontSize); - Utils.showToast("تم تقليل حجم الخط"); - }), - commonIconButton("assets/icons/user_logged.svg", () { - if (AppState().isUserLogin) { - Utils.showToast("أنت بالفعل تسجيل الدخول"); - return; - } - Navigator.pushNamed(context, LoginScreen.routeName); - }), - ], + }, + ), ), - ), - Expanded( - child: ListView.builder( - physics: BouncingScrollPhysics(), - padding: EdgeInsets.only(left: 24, right: 24), - itemCount: navigationList.length, - itemBuilder: (context, index) { - String icon = "assets/icons/${navigationList[index].mobileFontIcon}.svg"; - var subList = navigationList.where((element) => element.parentId == navigationList[index].navigationId).toList(); - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - if (navigationList[index].parentId == 1) - myListItem(icon, navigationList[index].navigationText, navigationList[index].orderNo == 1 ? true : false, onTap: () { - String url = navigationList[index]?.mobileNavigationUrl ?? ""; - if (url.isEmpty || url.length < 2) { - return; - } - Navigator.pushNamed(context, url, arguments: null); - }), - for (var subItem in subList) - Container( - width: double.infinity, - child: Row( - children: [ - Expanded( - child: myListItem("assets/icons/${subItem.mobileFontIcon}.svg", subItem.navigationText, false, onTap: () { - String url = subItem.mobileNavigationUrl ?? ""; - if (url.isEmpty) { - return; - } - var contentId; - if (subItem.mobileNavigationUrl == "/introduction") { - url = ContentInfoScreen.routeName; - contentId = 2; - } else if (subItem.mobileNavigationUrl == "/encyclopedia") { - url = ContentInfoScreen.routeName; - contentId = 1; - } - Navigator.pushNamed(context, url, arguments: contentId); - }), - ), - Container( - height: 40, - margin: EdgeInsets.only(right: 17, left: 10), - child: VerticalDivider(color: ColorConsts.primaryBlack, thickness: .7, width: 1), - ), - ], - ), - ) - ], - ); - }), - ), - Container( - margin: EdgeInsets.only(top: 16, bottom: 12), - padding: EdgeInsets.only(left: 32, right: 32), - child: Row( - children: [ - for (QuickLinksData _quickLink in quickLinks) - commonIconButton(_quickLink.exposeFilePath, () { - _launchURL(_quickLink.imageUrl); - }, size: 35, isAsset: false), - ], + Container( + margin: EdgeInsets.only(top: 8, bottom: 16), + padding: EdgeInsets.only(left: 16, right: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + commonIconButton("assets/icons/bookmark.svg", () { + Navigator.pushNamed(context, BookmarkScreen.routeName); + }), + commonIconButton("assets/icons/increase_size.svg", () { + if (fontSize >= 36) { + Utils.showToast("وصل حجم الخط إلى الحد الأقصى للحجم"); + return; + } + fontSize += 2; + prefs.setInt(GlobalConsts.fontZoomSize, fontSize); + Utils.showToast("زيادة حجم الخط"); + }), + commonIconButton("assets/icons/reduce_size.svg", () { + if (fontSize <= 12) { + Utils.showToast("وصل حجم الخط إلى الحد الأدنى للحجم"); + return; + } + fontSize -= 2; + prefs.setInt(GlobalConsts.fontZoomSize, fontSize); + Utils.showToast("تم تقليل حجم الخط"); + }), + commonIconButton("assets/icons/user_logged.svg", () { + if (AppState().isUserLogin) { + Utils.showToast("أنت بالفعل تسجيل الدخول"); + return; + } + Navigator.pushNamed(context, LoginScreen.routeName); + }), + ], + ), ), - ), - Padding( - padding: EdgeInsets.only(left: 32, right: 32, bottom: 8), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Powered by Cloud Solutions", - maxLines: 1, - textAlign: TextAlign.right, - style: TextStyle(fontSize: 14, color: Colors.black87), - ), - SizedBox(width: 8), - SvgPicture.asset("assets/logos/cloud_logo.svg", width: 30, height: 30) - ], + listContents, + Container( + margin: EdgeInsets.only(top: 16, bottom: 12), + padding: EdgeInsets.only(left: 32, right: 32), + child: Row( + children: [ + for (QuickLinksData _quickLink in quickLinks) + commonIconButton(_quickLink.exposeFilePath, () { + _launchURL(_quickLink.imageUrl); + }, size: 35, isAsset: false), + ], + ), ), - ) - ], + Padding( + padding: EdgeInsets.only(left: 32, right: 32, bottom: 8), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Powered by Cloud Solutions", + maxLines: 1, + textAlign: TextAlign.right, + style: TextStyle(fontSize: 14, color: Colors.black87), + ), + SizedBox(width: 8), + SvgPicture.asset("assets/logos/cloud_logo.svg", width: 30, height: 30) + ], + ), + ) + ]; + return isPortrait ? Column(children: list) : ListView(children: list); + }, ), ), ), diff --git a/lib/ui/dialogs/change_password_dialog.dart b/lib/ui/dialogs/change_password_dialog.dart index f30135b..6ded035 100644 --- a/lib/ui/dialogs/change_password_dialog.dart +++ b/lib/ui/dialogs/change_password_dialog.dart @@ -57,9 +57,9 @@ class _ChangePasswordDialogState extends State { style: TextStyle(color: Colors.white, fontSize: 22), ), SizedBox(height: 16), - CommonTextFieldWidget(hint: "الايميل المسجل", controller: _passwordController, prefixIcon: "assets/icons/password.svg"), + CommonTextFieldWidget(hint: "كلمة المرور الجديدة", controller: _passwordController, prefixIcon: "assets/icons/password.svg"), SizedBox(height: 8), - CommonTextFieldWidget(hint: "تأكيد كلمة المرور", controller: _confirmPasswordController, prefixIcon: "assets/icons/password.svg"), + CommonTextFieldWidget(hint: "تأكيد كلمة المرور الجديدة", controller: _confirmPasswordController, prefixIcon: "assets/icons/password.svg"), SizedBox(height: 16), SizedBox( width: double.infinity, @@ -67,15 +67,15 @@ class _ChangePasswordDialogState extends State { child: TextButton( onPressed: () { if (_passwordController.text.length < 1) { - Utils.showToast("كلمة المرور فارغة"); + Utils.showToast("يرجى إاخال كلمة المرور"); return; } if (_confirmPasswordController.text.length < 1) { - Utils.showToast("تأكيد كلمة المرور فارغ"); + Utils.showToast("يرجى تأكيد كلمة المرور"); return; } if (_passwordController.text != _confirmPasswordController.text) { - Utils.showToast("كلمة المرور خاطئة"); + Utils.showToast("خطأ في تطابق كلمات المرور"); return; } widget.onPassword(_passwordController.text); @@ -89,7 +89,7 @@ class _ChangePasswordDialogState extends State { borderRadius: BorderRadius.circular(6.0), ), ), - child: Text("تحديث"), + child: Text("إعادة تعيين كلمة المرور"), ), ), ], diff --git a/lib/ui/dialogs/otp_dialog.dart b/lib/ui/dialogs/otp_dialog.dart index 6836383..097a6f4 100644 --- a/lib/ui/dialogs/otp_dialog.dart +++ b/lib/ui/dialogs/otp_dialog.dart @@ -53,7 +53,7 @@ class _OTPDialogState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - "الرجاء ادخال الرقم المرسل إلى جوالك", + "الرجاء إدخال الرقم المرسل إلى جوالك", textAlign: TextAlign.center, style: TextStyle(color: Colors.white), ), @@ -91,7 +91,7 @@ class _OTPDialogState extends State { child: TextButton( onPressed: () { if (otpMessage.length < 4) { - Utils.showToast("OTP غير صحيح"); + Utils.showToast("الرقم الذي قمت بإدخاله غير صحيح"); return; } widget.onOTP(int.parse(otpMessage)); diff --git a/lib/ui/screens/bookmark_screen.dart b/lib/ui/screens/bookmark_screen.dart index fa9af26..3d5379c 100644 --- a/lib/ui/screens/bookmark_screen.dart +++ b/lib/ui/screens/bookmark_screen.dart @@ -76,7 +76,7 @@ class _BookmarkScreenState extends State { onTap: () { _bookMarkList.removeAt(index); BookMarkModel.saveToPrefs(_bookMarkList); - Utils.showToast("تمت إزالة الإشارة المرجعية"); + Utils.showToast("تم حذف المرجع"); setState(() {}); }, ), diff --git a/lib/ui/screens/contact_us_screen.dart b/lib/ui/screens/contact_us_screen.dart index 0a5b7ba..f883cc9 100644 --- a/lib/ui/screens/contact_us_screen.dart +++ b/lib/ui/screens/contact_us_screen.dart @@ -33,7 +33,7 @@ class _ContactUsScreenState extends State { Utils.showLoading(context); try { await TangheemUserApiClient().contactUs(_firstName, _lastName, _email, _phone, _description); - Utils.showToast("شكرا لك على مراسلتنا ، نحن نقدر كلماتك."); + Utils.showToast("تم إرسال الطلب بنجاح"); Utils.hideLoading(context); Navigator.pop(context); } catch (ex) { @@ -91,15 +91,15 @@ class _ContactUsScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - CommonTextFieldWidget(hint: "الاسم الاول", controller: _firstNameController), + CommonTextFieldWidget(hint: "الاسم الأول", controller: _firstNameController), SizedBox(height: 8), - CommonTextFieldWidget(hint: "اسم النهاية", controller: _lastNameController), + CommonTextFieldWidget(hint: "الاسم الأخير", controller: _lastNameController), SizedBox(height: 8), - CommonTextFieldWidget(hint: "الايميل", controller: _emailController), + CommonTextFieldWidget(hint: "البريد الإلكتروني", controller: _emailController), SizedBox(height: 8), - CommonTextFieldWidget(hint: " رقم الجوال${" (" + ("9xx") + " xxxxxxxxx)"}", controller: _mobileNumberController), + CommonTextFieldWidget(hint: " رقم الاتصال${" (" + ("9xx") + " xxxxxxxxx)"}", controller: _mobileNumberController), SizedBox(height: 8), - CommonTextFieldWidget(hint: "اكتب لنا", controller: _descriptionController, maxLines: 4), + CommonTextFieldWidget(hint: "التفاصيل", controller: _descriptionController, maxLines: 4), SizedBox(height: 12), SizedBox( width: double.infinity, @@ -107,27 +107,35 @@ class _ContactUsScreenState extends State { child: TextButton( onPressed: () { if (_firstNameController.text.length < 1) { - Utils.showToast("الاسم الأول فارغ"); + Utils.showToast("يرجى إدخال الاسم الأول"); return; } if (_lastNameController.text.length < 1) { - Utils.showToast("الاسم الأخير فارغ"); + Utils.showToast("يرجى إدخال الاسم الأخير"); return; } if (_emailController.text.length < 1) { - Utils.showToast("البريد الإلكتروني فارغ"); + Utils.showToast("يرجى إدخال البريد الإلكتروني"); return; } if (_mobileNumberController.text.length < 1) { - Utils.showToast("رقم الهاتف فارغ"); + Utils.showToast("يرجى إدخال رقم الهاتف"); + return; + } + if (_mobileNumberController.text.length != 12) { + Utils.showToast("صيغة الرقم غير صحيحة"); return; } if (_descriptionController.text.length < 1) { - Utils.showToast("يجب أن تكتب لنا كلمات قليلة"); + Utils.showToast("يرجى إدخال التفاصيل"); + return; + } + if (_descriptionController.text.trim().length < 1) { + Utils.showToast("يرجى إدخال التفاصيل"); return; } if (!_emailController.text.isValidEmail()) { - Utils.showToast("بريد إلكتروني خاطئ"); + Utils.showToast("صيغة البريد الإلكتروني غير صحيحة"); return; } sendFeedback(_firstNameController.text, _lastNameController.text, _emailController.text, _mobileNumberController.text, _descriptionController.text); @@ -140,7 +148,7 @@ class _ContactUsScreenState extends State { borderRadius: BorderRadius.circular(6.0), ), ), - child: Text("ارسل رأيك"), + child: Text("إرسال"), ), ), ], diff --git a/lib/ui/screens/forgot_password_screen.dart b/lib/ui/screens/forgot_password_screen.dart index 0d33bef..9d97226 100644 --- a/lib/ui/screens/forgot_password_screen.dart +++ b/lib/ui/screens/forgot_password_screen.dart @@ -74,7 +74,7 @@ class _ForgotPasswordScreenState extends State { Utils.hideLoading(context); } Navigator.pop(context); - Utils.showToast("تم تغيير الرقم السري بنجاح"); + Utils.showToast("تم تغيير كلمة المرور بنجاح"); Navigator.pop(context); } @@ -115,7 +115,7 @@ class _ForgotPasswordScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ SizedBox(height: 8), - CommonTextFieldWidget(hint: "الايميل المسجل", controller: _emailController, prefixIcon: "assets/icons/email.svg"), + CommonTextFieldWidget(hint: "البريد الإلكتروني المسجل", controller: _emailController, prefixIcon: "assets/icons/email.svg"), SizedBox(height: 12), SizedBox( width: double.infinity, @@ -123,10 +123,10 @@ class _ForgotPasswordScreenState extends State { child: TextButton( onPressed: () { if (_emailController.text.length < 1) { - Utils.showToast("البريد الإلكتروني فارغ"); + Utils.showToast("يرجى إدخال البريد الإلكتروني"); return; } else if (!_emailController.text.isValidEmail()) { - Utils.showToast("بريد إلكتروني خاطئ"); + Utils.showToast("صيغة البريد الإلكتروني خاطئة"); return; } forgotPassword(_emailController.text); @@ -139,7 +139,7 @@ class _ForgotPasswordScreenState extends State { borderRadius: BorderRadius.circular(6.0), ), ), - child: Text("اعادة تعيين كلمة المرور"), + child: Text("إعادة تعيين كلمة المرور"), ), ), ], diff --git a/lib/ui/screens/home_screen.dart b/lib/ui/screens/home_screen.dart index 15df2bf..6620866 100644 --- a/lib/ui/screens/home_screen.dart +++ b/lib/ui/screens/home_screen.dart @@ -86,7 +86,7 @@ class _HomeScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - "موسوعةالأداء القرآني", + "موسوعة الأداء القرآني", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1), ), SizedBox(height: 4), diff --git a/lib/ui/screens/login_screen.dart b/lib/ui/screens/login_screen.dart index de8ea96..ba90526 100644 --- a/lib/ui/screens/login_screen.dart +++ b/lib/ui/screens/login_screen.dart @@ -108,7 +108,7 @@ class _LoginScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - CommonTextFieldWidget(hint: "الايميل المسجل", controller: _emailController, prefixIcon: "assets/icons/email.svg"), + CommonTextFieldWidget(hint: "البريد الإلكتروني", controller: _emailController, prefixIcon: "assets/icons/email.svg"), SizedBox(height: 16), CommonTextFieldWidget(hint: "كلمة المرور", controller: _passwordController, isPassword: true, prefixIcon: "assets/icons/password.svg"), SizedBox(height: 16), @@ -118,14 +118,14 @@ class _LoginScreenState extends State { child: TextButton( onPressed: () { if (_emailController.text.length < 1) { - Utils.showToast("البريد الإلكتروني فارغ"); + Utils.showToast("يرجى إدخال البريد الإلكتروني"); return; } else if (!_emailController.text.isValidEmail()) { - Utils.showToast("بريد إلكتروني خاطئ"); + Utils.showToast("صيغة البريد الإلكتروني خاطئة"); return; } if (_passwordController.text.length < 1) { - Utils.showToast("كلمة المرور فارغة"); + Utils.showToast("يرجى إدخال كلمة المرور"); return; } performLogin(_emailController.text, _passwordController.text); @@ -195,7 +195,7 @@ class _LoginScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - "انشاء حساب جديد", + " حساب جديد", style: TextStyle(fontSize: 14, color: Colors.white), ), Icon(Icons.arrow_forward_ios, color: Colors.white, size: 12), diff --git a/lib/ui/screens/quran_screen.dart b/lib/ui/screens/quran_screen.dart index b2f5739..9be2085 100644 --- a/lib/ui/screens/quran_screen.dart +++ b/lib/ui/screens/quran_screen.dart @@ -197,148 +197,179 @@ class _QuranScreenState extends State { _surahAya = _surahAya + "\n" + "$_currentPage"; - return Container( - padding: EdgeInsets.fromLTRB(16, 24, 16, 0), - width: double.infinity, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + List widList = [ + Text( + "اقرأ القرآن الكريم", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1), + ), + SizedBox(height: 4), + Text( + "قراءة وسماع آيات القرآن الكريم", + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16, color: ColorConsts.primaryBlue), + ), + SizedBox(height: 4), + Text( + "اضغط الآية المرغوبة لمزيد من التفاصيل", + style: TextStyle( + fontSize: 12, + color: ColorConsts.primaryBlue, + ), + ), + SizedBox(height: 16), + Row( children: [ - Text( - "اقرأ القرآن الكريم", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1), + Expanded( + child: CommonDropDownButton(_selectedSurah, hintText: "اختر السورة", list: _surahList, onSelect: (index) { + if (_selectedSurah != index) { + _selectedSurah = index; + _selectedToAya = -1; + _selectedFromAya = -1; + _toAyaList = []; + filterData(); + } + }), + ), + SizedBox(width: 4), + Expanded( + child: CommonDropDownButton(_selectedFromAya, hintText: "من الآية", list: _fromAyaList.map((e) => "من الآية" + " $e").toList(), onSelect: (index) { + if (_selectedFromAya != index) { + _selectedFromAya = index; + filteredAyahList.indexOf(_selectedFromAya); + _toAyaList = filteredAyahList.getRange(_selectedFromAya + 1, filteredAyahList.length)?.toList() ?? []; + setState(() {}); + } + }), + ), + SizedBox(width: 4), + Expanded( + child: CommonDropDownButton(_selectedToAya, hintText: "إلى الآية", list: _toAyaList.map((e) => "إلى الآية" + " $e").toList(), onSelect: (index) { + if (_selectedToAya != index) { + _selectedToAya = index; + setState(() {}); + } + }), ), - SizedBox(height: 16), + ], + ), + SizedBox(height: 8), + Row( + children: [ + commonIconButton("عرض", "assets/icons/go_forward.svg", () { + if (_selectedSurah < 0) { + Utils.showToast("يرجى اختيار السورة"); + return; + } else { + if (_selectedFromAya < 0 && _selectedToAya < 0) { + _currentPage = _surahModel?.data[_selectedSurah]?.startPageNo; + getQuranByPageNo(); + return; + } + if (_selectedFromAya >= 0 && _selectedToAya >= 0) { + getAyaByRange(); + return; + } + } + }), + ], + ), + SizedBox(height: 16), + ]; + + Widget quranTextView = SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Padding( + padding: EdgeInsets.only(left: 4, right: 4), + child: quranText(), + ), + ); + if (MediaQuery.of(context).orientation == Orientation.portrait) { + quranTextView = Expanded(child: quranTextView); + } + + Widget quranView = Container( + margin: EdgeInsets.only(top: 4, bottom: 4), + padding: EdgeInsets.only(top: 16, bottom: 4, right: 16, left: 16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: CommonDropDownButton(_selectedSurah, hintText: "اختر السورة", list: _surahList, onSelect: (index) { - if (_selectedSurah != index) { - _selectedSurah = index; - _selectedToAya = -1; - _selectedFromAya = -1; - _toAyaList = []; - filterData(); - } - }), - ), - SizedBox(width: 4), - Expanded( - child: CommonDropDownButton(_selectedFromAya, hintText: "من الآية", list: _fromAyaList.map((e) => "من الآية" + " $e").toList(), onSelect: (index) { - if (_selectedFromAya != index) { - _selectedFromAya = index; - filteredAyahList.indexOf(_selectedFromAya); - _toAyaList = filteredAyahList.getRange(_selectedFromAya + 1, filteredAyahList.length)?.toList() ?? []; - setState(() {}); - } - }), - ), - SizedBox(width: 4), - Expanded( - child: CommonDropDownButton(_selectedToAya, hintText: "إلى الآية", list: _toAyaList.map((e) => "إلى الآية" + " $e").toList(), onSelect: (index) { - if (_selectedToAya != index) { - _selectedToAya = index; - setState(() {}); - } - }), - ), + nextOptionButton( + "assets/icons/prev.svg", + _currentSurahIndex <= 0 ? "" : Utils.getNotNullValue(_surahList, _currentSurahIndex - 1) ?? "", + _currentSurahIndex <= 0 + ? null + : (value) { + _currentPage = _surahModel?.data?.elementAt(_surahList.indexOf(value))?.startPageNo ?? _currentPage; + _clearFilterAndRefreshData(); + }), + previousOptionButton( + "assets/icons/next.svg", + _currentSurahIndex >= (_surahList.isNotEmpty ? (_surahList.length - 1) : 0) ? "" : Utils.getNotNullValue(_surahList, _currentSurahIndex + 1) ?? "", + _currentSurahIndex >= (_surahList.isNotEmpty ? (_surahList.length - 1) : 0) + ? null + : (value) { + _currentPage = _surahModel?.data?.singleWhere((element) => element.nameAR == value)?.startPageNo ?? _currentPage; + _clearFilterAndRefreshData(); + }), ], ), - SizedBox(height: 8), + quranTextView, + SizedBox(height: 4), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - commonIconButton("عرض", "assets/icons/go_forward.svg", () { - if (_selectedSurah < 0) { - Utils.showToast("يرجى اختيار السورة"); - return; - } else { - if (_selectedFromAya < 0 && _selectedToAya < 0) { - _currentPage = _surahModel?.data[_selectedSurah]?.startPageNo; - getQuranByPageNo(); - return; - } - if (_selectedFromAya >= 0 && _selectedToAya >= 0) { - getAyaByRange(); - return; - } - } - }), + nextOptionButton( + "assets/icons/prev_single.svg", + "الصفحة السابقة", + _currentPage <= 1 + ? null + : (value) { + _currentPage = _currentPage - 1; + _clearFilterAndRefreshData(); + }), + previousOptionButton( + "assets/icons/next_single.svg", + "الصفحة التالية", + _currentPage == 604 + ? null + : (value) { + _currentPage = _currentPage + 1; + _clearFilterAndRefreshData(); + }), ], ), - SizedBox(height: 16), - if (_surahAya.isNotEmpty) - Expanded( - child: Container( - margin: EdgeInsets.only(top: 4, bottom: 4), - padding: EdgeInsets.only(top: 16, bottom: 4, right: 16, left: 16), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - nextOptionButton( - "assets/icons/prev.svg", - _currentSurahIndex <= 0 ? "" : Utils.getNotNullValue(_surahList, _currentSurahIndex - 1) ?? "", - _currentSurahIndex <= 0 - ? null - : (value) { - _currentPage = _surahModel?.data?.elementAt(_surahList.indexOf(value))?.startPageNo ?? _currentPage; - _clearFilterAndRefreshData(); - }), - previousOptionButton( - "assets/icons/next.svg", - _currentSurahIndex >= (_surahList.isNotEmpty ? (_surahList.length - 1) : 0) ? "" : Utils.getNotNullValue(_surahList, _currentSurahIndex + 1) ?? "", - _currentSurahIndex >= (_surahList.isNotEmpty ? (_surahList.length - 1) : 0) - ? null - : (value) { - _currentPage = _surahModel?.data?.singleWhere((element) => element.nameAR == value)?.startPageNo ?? _currentPage; - _clearFilterAndRefreshData(); - }), - ], - ), - Expanded( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Padding( - padding: EdgeInsets.only(left: 4, right: 4), - child: quranText(), - ), - ), - ), - SizedBox(height: 4), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - nextOptionButton( - "assets/icons/prev_single.svg", - "الصفحة السابقة", - _currentPage <= 1 - ? null - : (value) { - _currentPage = _currentPage - 1; - _clearFilterAndRefreshData(); - }), - previousOptionButton( - "assets/icons/next_single.svg", - "الصفحة التالية", - _currentPage == 604 - ? null - : (value) { - _currentPage = _currentPage + 1; - _clearFilterAndRefreshData(); - }), - ], - ), - ], - ), - ), - ), ], ), ); + + if (MediaQuery.of(context).orientation == Orientation.portrait) { + quranView = Expanded(child: quranView); + } + + List finalViewList = [] + widList + [if (_surahAya.isNotEmpty) quranView]; + var multiModeView; + if (MediaQuery.of(context).orientation == Orientation.portrait) { + multiModeView = Padding( + padding: EdgeInsets.fromLTRB(16, 24, 16, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: finalViewList, + ), + ); + } else { + multiModeView = ListView( + padding: EdgeInsets.fromLTRB(16, 24, 16, 0), + physics: BouncingScrollPhysics(), + children: finalViewList, + ); + } + return SizedBox(width: double.infinity, child: multiModeView); } Widget commonIconButton(String title, String iconString, VoidCallback callback) { diff --git a/lib/ui/screens/registration_screen.dart b/lib/ui/screens/registration_screen.dart index a9f68c4..5d0b8a3 100644 --- a/lib/ui/screens/registration_screen.dart +++ b/lib/ui/screens/registration_screen.dart @@ -6,6 +6,7 @@ import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; import 'package:tangheem/extensions/string_extensions.dart'; import 'package:tangheem/models/country_model.dart'; +import 'package:tangheem/models/general_response_model.dart'; import 'package:tangheem/ui/bottom_sheets/country_selection_bottom_sheet.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; @@ -57,8 +58,13 @@ class _RegistrationScreenState extends State { void registerUser(String _firstName, String _lastName, String _email, String _password, String _countryCode, String _phone) async { Utils.showLoading(context); try { - await UserApiClient().registerUser(_firstName, _lastName, _email, _password, _countryCode, _phone); - Utils.showToast("تسجيل بنجاح"); + GeneralResponseModel model = await UserApiClient().registerUser(_firstName, _lastName, _email, _password, _countryCode, _phone); + if(model.message == "UserRegistration Already Exists") { + Utils.showToast("البريد الإلكتروني مستخدم سابقا"); + Utils.hideLoading(context); + return; + } + Utils.showToast("تم إنشاء الحساب بنجاح"); Utils.hideLoading(context); Navigator.pop(context); } catch (ex) { @@ -116,14 +122,14 @@ class _RegistrationScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - CommonTextFieldWidget(hint: "الاسم الاول", controller: _firstNameController), + CommonTextFieldWidget(hint: "البريد الإلكتروني", controller: _emailController), SizedBox(height: 8), - CommonTextFieldWidget(hint: "اسم النهاية", controller: _lastNameController), + CommonTextFieldWidget(hint: "الاسم الأول", controller: _firstNameController), SizedBox(height: 8), - CommonTextFieldWidget(hint: "الايميل", controller: _emailController), + CommonTextFieldWidget(hint: "الاسم الأخير", controller: _lastNameController), SizedBox(height: 8), CommonTextFieldWidget( - hint: _selectedCountry?.countryNameAr ?? "البلد", + hint: _selectedCountry?.countryNameAr ?? "الدولة", controller: null, suffixWidget: Icon(Icons.keyboard_arrow_down, size: 18, color: ColorConsts.secondaryOrange), onTap: () { @@ -169,46 +175,46 @@ class _RegistrationScreenState extends State { child: TextButton( onPressed: () { if (_firstNameController.text.length < 1) { - Utils.showToast("اسم المستخدم فارغ"); + Utils.showToast("يرجى إدخال الاسم الأول"); return; } if (_lastNameController.text.length < 1) { - Utils.showToast("الاسم فارغ"); + Utils.showToast("يرجى إدخال الاسم الأخير"); return; } if (_emailController.text.length < 1) { - Utils.showToast("البريد الإلكتروني فارغ"); + Utils.showToast("يرجى إدخال البريد الإلكتروني"); return; } if (_selectedCountry?.countryCode == null) { - Utils.showToast("يجب عليك اختيار الدولة"); + Utils.showToast("يرجى اختيار الدولة"); return; } if (_mobileNumberController.text.length < 1) { - Utils.showToast("رقم الهاتف فارغ"); + Utils.showToast("يرجى إدخال رقم الجوال"); return; } if (_passwordController.text.length < 1) { - Utils.showToast("كلمة المرور فارغة"); + Utils.showToast("يرجى إدخال كلمة المرور"); return; } if (_confirmPasswordController.text.length < 1) { - Utils.showToast("أدخل كلمة المرور نفسها للتأكيد"); + Utils.showToast("يرجى تأكيد كلمة المرور"); return; } if (!_emailController.text.isValidEmail()) { - Utils.showToast("بريد إلكتروني خاطئ"); + Utils.showToast("صيغة البريد الإلكتروني خاطئة"); return; } if (_passwordController.text != _confirmPasswordController.text) { - Utils.showToast("كلمات السر الخاصة بك غير صحيحة"); + Utils.showToast("كلمة المرور غير متطابقة"); return; } if (!_isAccept) { - Utils.showToast("يجب عليك قبول البيان للمتابعة"); + Utils.showToast("الرجاء الموافقة على سياسة الخصوصية"); return; } registerUser( diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart index 360e784..13c57c8 100644 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ b/lib/ui/screens/tangheem_detail_screen.dart @@ -47,6 +47,8 @@ class _TangheemDetailScreenState extends State { AyatTangheemTypeMappedData _ayatTangheemTypeMappedFirstData; DiscussionModel _discussionModel; + bool showAyaPlayer = false; + @override void initState() { super.initState(); @@ -122,28 +124,28 @@ class _TangheemDetailScreenState extends State { @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.fromLTRB(16, 24, 16, 0), + padding: EdgeInsets.fromLTRB(16, 0, 16, 0), width: double.infinity, child: _ayatTangheemTypeMappedFirstData == null ? SizedBox() : Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - _ayatTangheemTypeMappedFirstData.tangheemTypeName ?? "", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1.5), - ), - SizedBox(height: 8), - Text( - _ayatTangheemTypeMappedFirstData.tangheemTypeDescription ?? "", - style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1), - ), - SizedBox(height: 8), Expanded( child: ListView( physics: BouncingScrollPhysics(), - padding: EdgeInsets.only(bottom: 16), + padding: EdgeInsets.only(bottom: 16, top: 16), children: [ + Text( + _ayatTangheemTypeMappedFirstData.tangheemTypeName ?? "", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1.5), + ), + SizedBox(height: 8), + Text( + _ayatTangheemTypeMappedFirstData.tangheemTypeDescription ?? "", + style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1), + ), + SizedBox(height: 8), Container( margin: EdgeInsets.only(top: 4, bottom: 4), padding: EdgeInsets.only(top: 8, bottom: 8, right: 4, left: 4), @@ -211,7 +213,7 @@ class _TangheemDetailScreenState extends State { Row( children: [ Text( - " جمله ${_ayatTangheemTypeMappedData.tangheemTypeName} $_tempTangheemIndexWord", + " جملة ${_ayatTangheemTypeMappedData.tangheemTypeName} $_tempTangheemIndexWord", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, backgroundColor: ColorConsts.primaryBlue), ), Expanded( @@ -311,7 +313,38 @@ class _TangheemDetailScreenState extends State { ], ), ), - AyaPlayerWidget(surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", globalKey: _globalKey, voiceNoteList: voiceNoteList) + if (MediaQuery.of(context).orientation == Orientation.portrait) + AyaPlayerWidget(surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", globalKey: _globalKey, voiceNoteList: voiceNoteList), + if (MediaQuery.of(context).orientation == Orientation.landscape) + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 24, + margin: EdgeInsets.only(bottom: 8,top: 8), + // color: Colors.transparent, + child: TextButton( + onPressed: () { + setState(() { + showAyaPlayer = !showAyaPlayer; + }); + }, + child: Text( + showAyaPlayer ? "إخفاء التسجيلات" : "إظهار التسجيلات", + style: TextStyle(color: Colors.black87, fontSize: 12), + ), + style: TextButton.styleFrom( + backgroundColor: ColorConsts.gradientOrange, + primary: ColorConsts.primaryBlue, + padding: EdgeInsets.only(top: 4, bottom: 4, right: 8, left: 8), + textStyle: TextStyle(color: Colors.white, fontSize: 12), + ), + ), + ), + if (showAyaPlayer) AyaPlayerWidget(surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", globalKey: _globalKey, voiceNoteList: voiceNoteList), + ], + ) ], ), ); @@ -651,7 +684,7 @@ class _TangheemDetailScreenState extends State { ), ), child: Text( - "أضافة تعليق", + "إضافة تعليق", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Colors.white, height: 1.5), ), ), diff --git a/lib/widgets/aya_player_widget.dart b/lib/widgets/aya_player_widget.dart index e34589c..5d55d46 100644 --- a/lib/widgets/aya_player_widget.dart +++ b/lib/widgets/aya_player_widget.dart @@ -103,9 +103,11 @@ class _AyaPlayerWidgetState extends State { ), padding: EdgeInsets.all(8), child: Column( + mainAxisSize: MainAxisSize.min, children: [ Row( children: [ + if(widget.voiceNoteList.length>1) PopupMenuButton( padding: EdgeInsets.fromLTRB(4, 4, 0, 4), onSelected: (int index) {