From 9c1b4ce616ec3ae819c71d7683958c22a1724698 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 25 May 2023 11:23:21 +0300 Subject: [PATCH] ui improvements. --- assets/icons/regsiter_user.svg | 42 ++++ assets/icons/reset.svg | 20 ++ lib/api/api_client.dart | 2 +- lib/extensions/string_extensions.dart | 4 +- lib/ui/dialogs/discussion_input_dialog.dart | 65 +++---- lib/ui/screens/bookmark_screen.dart | 4 +- lib/ui/screens/contact_us_screen.dart | 2 +- lib/ui/screens/forgot_password_screen.dart | 201 +++++++++++-------- lib/ui/screens/member_screen.dart | 4 +- lib/ui/screens/quran_screen.dart | 205 +++++++++++++++----- lib/ui/screens/registration_screen.dart | 3 +- lib/ui/screens/tangheem_detail_screen.dart | 61 ++++-- 12 files changed, 416 insertions(+), 197 deletions(-) create mode 100644 assets/icons/regsiter_user.svg create mode 100644 assets/icons/reset.svg diff --git a/assets/icons/regsiter_user.svg b/assets/icons/regsiter_user.svg new file mode 100644 index 0000000..11408ee --- /dev/null +++ b/assets/icons/regsiter_user.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/reset.svg b/assets/icons/reset.svg new file mode 100644 index 0000000..36cadee --- /dev/null +++ b/assets/icons/reset.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index 6a8a1c6..c90706b 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -47,7 +47,7 @@ APIException _throwAPIException(Response response) { APIError apiError; if (response.body != null && response.body.isNotEmpty) { var jsonError = jsonDecode(response.body); - apiError = APIError(409, jsonError['statusMessage']); + apiError = APIError(409, jsonError['statusMessage'] ?? jsonError['message']); } return APIException(APIException.BAD_REQUEST, error: apiError); case 500: diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index f363b79..ad9e9b9 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -42,7 +42,7 @@ extension StringExtension on String { } } - Widget toText(double fontSize, {Color color, bool isBold = false, int maxLines, FontStyle fontStyle, TextAlign textAlign, double height}) { + Widget toText(double fontSize, {Color color, bool isBold = false, int maxLines, FontStyle fontStyle, TextAlign textAlign, double height, bool fontFamily = true}) { double heightVal = height ?? ((fontSize == 13) ? 16 : ((fontSize == 18 || fontSize == 30) ? 22 : 14)); return Text( this, @@ -53,7 +53,7 @@ extension StringExtension on String { fontStyle: fontStyle ?? FontStyle.normal, fontWeight: isBold ? FontWeight.bold : FontWeight.w400, color: color ?? Colors.white, - fontFamily: "Montserrat", + fontFamily: fontFamily ? "Montserrat" : null, height: heightVal / fontSize, ), ); diff --git a/lib/ui/dialogs/discussion_input_dialog.dart b/lib/ui/dialogs/discussion_input_dialog.dart index 8a5d5ab..fd3d899 100644 --- a/lib/ui/dialogs/discussion_input_dialog.dart +++ b/lib/ui/dialogs/discussion_input_dialog.dart @@ -3,6 +3,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; +import 'package:tangheem/extensions/string_extensions.dart'; +import 'package:tangheem/extensions/widget_extensions.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; class DiscussionInputDialog extends StatefulWidget { @@ -37,10 +39,12 @@ class _DiscussionInputDialogState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + return Dialog( - insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0), + insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 0.0), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), + borderRadius: BorderRadius.circular(24), ), elevation: 0, backgroundColor: Colors.transparent, @@ -49,45 +53,34 @@ class _DiscussionInputDialogState extends State { child: Container( width: double.infinity, decoration: BoxDecoration( - color: ColorConsts.brownB1CColor, - borderRadius: BorderRadius.circular(16), + color: Colors.white, + borderRadius: BorderRadius.circular(24), ), - padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + padding: EdgeInsets.symmetric(vertical: 24, horizontal: 24), child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text( - "اضاف تعليق", - textAlign: TextAlign.center, - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 16), - ), - SizedBox(height: 12), - CommonTextFieldWidget(hint: "فحوى التعليق", controller: _commentController, maxLines: 5, focusNode: _focusNode, fillColor: ColorConsts.brownLightECColor, isBorder: true), + "اضاف تعليق".toText(18, isBold: true, color: ColorConsts.dark2Text, fontFamily: false), SizedBox(height: 12), - SizedBox( - width: double.infinity, - height: 40, - child: TextButton( - onPressed: () { - if (_commentController.text.length < 1) { - Utils.showToast("يجب أن تكتب كلمات قليلة"); - return; - } - _focusNode.unfocus(); - widget.onCommentPress(_commentController.text); - }, - style: TextButton.styleFrom( - foregroundColor: Colors.white, - padding: EdgeInsets.all(2), - backgroundColor: ColorConsts.brownColor, - textStyle: TextStyle(fontSize: 14, fontFamily: "DroidKufi"), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20.0), - ), - ), - child: Text("أضف تعليقك"), - ), - ), + CommonTextFieldWidget(hint: "فحوى التعليق", controller: _commentController, maxLines: isPortrait ? 5 : 3, focusNode: _focusNode, fillColor: Colors.transparent, isBorder: true), + SizedBox(height: 16), + Container( + height: 40, + padding: EdgeInsets.only(left: 16, right: 16), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: ColorConsts.darkText, + ), + child: "أضف تعليقك".toText(14, fontFamily: false)) + .onPress(() { + if (_commentController.text.length < 1) { + Utils.showToast("يجب أن تكتب كلمات قليلة"); + return; + } + _focusNode.unfocus(); + widget.onCommentPress(_commentController.text); + }) ], ), ), diff --git a/lib/ui/screens/bookmark_screen.dart b/lib/ui/screens/bookmark_screen.dart index 45c4c2d..ae34d09 100644 --- a/lib/ui/screens/bookmark_screen.dart +++ b/lib/ui/screens/bookmark_screen.dart @@ -84,9 +84,9 @@ class _BookmarkScreenState extends State { Widget _dataListView = (_bookMarkList?.isEmpty ?? true) ? NoDataUI().paddingOnly(top: isPortrait ? 215 : 0) : ListView.separated( - physics: isPortrait ? NeverScrollableScrollPhysics() : null, + physics: isPortrait ? NeverScrollableScrollPhysics() : BouncingScrollPhysics(), shrinkWrap: isPortrait, - padding: EdgeInsets.all(24), + padding: EdgeInsets.symmetric(horizontal: 24, vertical: isPortrait ? 24 : 48), itemCount: _bookMarkList.length, separatorBuilder: (context, index) => 12.height, itemBuilder: (context, index) { diff --git a/lib/ui/screens/contact_us_screen.dart b/lib/ui/screens/contact_us_screen.dart index 152070b..1aae6d0 100644 --- a/lib/ui/screens/contact_us_screen.dart +++ b/lib/ui/screens/contact_us_screen.dart @@ -143,7 +143,7 @@ class _ContactUsScreenState extends State { Expanded( child: SingleChildScrollView( physics: BouncingScrollPhysics(), - padding: EdgeInsets.all(36), + padding: EdgeInsets.all(48), child: _inputDataList, ), flex: 6) diff --git a/lib/ui/screens/forgot_password_screen.dart b/lib/ui/screens/forgot_password_screen.dart index b596589..3b5e147 100644 --- a/lib/ui/screens/forgot_password_screen.dart +++ b/lib/ui/screens/forgot_password_screen.dart @@ -81,92 +81,135 @@ class _ForgotPasswordScreenState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + + Widget _button = SizedBox( + width: double.infinity, + height: 50, + child: TextButton( + onPressed: () { + if (_emailController.text.length < 1) { + Utils.showToast("يرجى إدخال البريد الإلكتروني"); + return; + } else if (!_emailController.text.isValidEmail()) { + Utils.showToast("صيغة البريد الإلكتروني خاطئة"); + return; + } + forgotPassword(_emailController.text); + }, + style: TextButton.styleFrom( + backgroundColor: ColorConsts.darkText, + foregroundColor: Colors.white, + textStyle: TextStyle(fontSize: 18), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(25.0), + ), + ), + child: Text("إعادة تعيين كلمة المرور"), + ), + ).paddingOnly(left: isPortrait ? 11 : 0, right: isPortrait ? 11 : 0, bottom: 28); + + Widget _contactUs = Column( + mainAxisSize: MainAxisSize.min, + children: [ + SvgPicture.asset("assets/icons/new/contact_us.svg", width: 26, height: 24, color: ColorConsts.greyC4Color), + 8.height, + "اتصل بنا".toText(14, color: ColorConsts.greyC4Color), + ], + ).onPress(() { + Navigator.pushNamed(context, ContactUsScreen.routeName); + }); + return Scaffold( backgroundColor: ColorConsts.greyF8Color, - body: SingleChildScrollView( - padding: EdgeInsets.only(top: 100, bottom: 24, left: 24, right: 24), - physics: BouncingScrollPhysics(), - child: Column( - children: [ - Image.asset("assets/icons/new/Tangeem-logo.png", width: 116, height: 62), - 30.height, - Container( - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.0), color: Colors.white), - margin: EdgeInsets.only(top: 6, bottom: 20), - padding: EdgeInsets.only(top: 50, bottom: 20, left: 11, right: 11), + body: isPortrait + ? SingleChildScrollView( + padding: EdgeInsets.only(top: 100, bottom: 24, left: 24, right: 24), + physics: BouncingScrollPhysics(), child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, children: [ - SvgPicture.asset("assets/icons/key.svg", width: 100, height: 72), - 25.height, - "استعادة كلمة المرور".toText(18, color: ColorConsts.darkText), - 18.height, - "يمكنك إعادة تعيين كلمة المرور عبر حساب بريدك الإلكتروني".toText(13, color: ColorConsts.grey9FColor, textAlign: TextAlign.center).paddingOnly(left: 77, right: 77), - 25.height, - CommonTextFieldWidget(hint: "البريد الإلكتروني المسجل", controller: _emailController, isEmail: true), + Image.asset("assets/icons/new/Tangeem-logo.png", width: 116, height: 62), + 30.height, + Container( + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.0), color: Colors.white), + margin: EdgeInsets.only(top: 6, bottom: 20), + padding: EdgeInsets.only(top: 50, bottom: 20, left: 11, right: 11), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SvgPicture.asset("assets/icons/reset.svg", width: 100, height: 72), + 25.height, + "استعادة كلمة المرور".toText(18, color: ColorConsts.darkText), + 18.height, + "يمكنك إعادة تعيين كلمة المرور عبر حساب بريدك الإلكتروني".toText(13, color: ColorConsts.grey9FColor, textAlign: TextAlign.center).paddingOnly(left: 77, right: 77), + 25.height, + CommonTextFieldWidget(hint: "البريد الإلكتروني المسجل", controller: _emailController, isEmail: true), + ], + ), + ), + _button, + _contactUs, ], ), - ), - SizedBox( - width: double.infinity, - height: 50, - child: TextButton( - onPressed: () { - if (_emailController.text.length < 1) { - Utils.showToast("يرجى إدخال البريد الإلكتروني"); - return; - } else if (!_emailController.text.isValidEmail()) { - Utils.showToast("صيغة البريد الإلكتروني خاطئة"); - return; - } - forgotPassword(_emailController.text); - }, - style: TextButton.styleFrom( - backgroundColor: ColorConsts.darkText, - foregroundColor: Colors.white, - textStyle: TextStyle(fontSize: 18), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(25.0), - ), - ), - child: Text("إعادة تعيين كلمة المرور"), + ) + : SizedBox( + height: MediaQuery.of(context).size.height, + child: Row( + children: [ + Expanded(flex: 1, child: Image.asset("assets/icons/new/Tangeem-logo.png", width: 136, height: 82).paddingOnly(right: 40)), + Expanded( + flex: 2, + child: Container( + width: MediaQuery.of(context).size.width, + // height: MediaQuery.of(context).size.height, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.0), color: Colors.white), + margin: EdgeInsets.all(24), + padding: EdgeInsets.only(left: 24, right: 0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SvgPicture.asset("assets/icons/reset.svg", width: 120, height: 92), + 25.height, + "استعادة كلمة المرور".toText(18, color: ColorConsts.darkText, fontFamily: false), + ], + ), + ), + Expanded( + flex: 3, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only( + top: 50, + bottom: 50, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + "يمكنك إعادة تعيين كلمة المرور عبر حساب بريدك الإلكتروني".toText(18, color: ColorConsts.grey9FColor, textAlign: TextAlign.center), + 24.height, + CommonTextFieldWidget(hint: "البريد الإلكتروني المسجل", controller: _emailController, isEmail: true), + 12.height, + _button, + _contactUs + ], + ), + ), + ), + ], + ), + ), + ) + ], ), - ).paddingOnly(left: 11, right: 11, bottom: 28), - Column( - mainAxisSize: MainAxisSize.min, - children: [ - SvgPicture.asset("assets/icons/new/contact_us.svg", width: 26, height: 24, color: ColorConsts.greyC4Color), - 8.height, - "اتصل بنا".toText(14, color: ColorConsts.greyC4Color), - ], - ).onPress(() { - Navigator.pushNamed(context, ContactUsScreen.routeName); - }) - ], - ), - ), + ), ); } - -// void getOTP(String email) { -// showDialog( -// context: context, -// barrierColor: ColorConsts.secondaryWhite.withOpacity(0.8), -// builder: (BuildContext context) => OTPDialog( -// onOTP: (otp) => verifyOTP(email, otp), -// ), -// ); -// } -// -// void changePassword(String email, int otp) { -// showDialog( -// context: context, -// barrierColor: ColorConsts.secondaryWhite.withOpacity(0.8), -// builder: (BuildContext context) => ChangePasswordDialog( -// onPassword: (password) => updatePassword(email, otp, password), -// ), -// ); -// } } diff --git a/lib/ui/screens/member_screen.dart b/lib/ui/screens/member_screen.dart index 845cd04..9dd7d8f 100644 --- a/lib/ui/screens/member_screen.dart +++ b/lib/ui/screens/member_screen.dart @@ -61,7 +61,7 @@ class _MemberScreenState extends State { physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: membersList.length, - padding: EdgeInsets.only(left: 25, right: 25, top: 25, bottom: isPortrait ? 125 : 25), + padding: EdgeInsets.only(left: 25, right: 25, top: isPortrait ? 25 : 50, bottom: isPortrait ? 125 : 25), separatorBuilder: (context, index) { return Divider(color: Color(0xffC7C7C7), height: 1, thickness: 1); }, @@ -128,7 +128,7 @@ class _MemberScreenState extends State { ) : Row( children: [ - Expanded(child: SingleChildScrollView(physics: const AlwaysScrollableScrollPhysics(), child: _dataListView), flex: 6), + Expanded(child: SingleChildScrollView(physics: const BouncingScrollPhysics(), child: _dataListView), flex: 6), Expanded(child: _header, flex: 4), ], ), diff --git a/lib/ui/screens/quran_screen.dart b/lib/ui/screens/quran_screen.dart index c0d1aff..5f5c2f1 100644 --- a/lib/ui/screens/quran_screen.dart +++ b/lib/ui/screens/quran_screen.dart @@ -207,7 +207,7 @@ class _QuranScreenState extends State { _surahAya = _surahAya + "\n" + "$_currentPage"; // _surahAya = _surahAya + "\n" + "$_currentPage"; - List widList = [ + List filterList = [ "اقرأ القرآن الكريم".toText(30), 8.height, "اختر السورة والآيات التي تريد قراءتها".toText(14), @@ -224,7 +224,7 @@ class _QuranScreenState extends State { _toAyaList = []; filterData(); } - }).paddingOnly(left: 41, right: 41), + }).paddingOnly(left: isPortrait ? 41 : 21, right: 41), 10.height, Row( children: [ @@ -257,7 +257,7 @@ class _QuranScreenState extends State { }), ), ], - ).paddingOnly(left: 41, right: 41), + ).paddingOnly(left: isPortrait ? 41 : 21, right: 41), 10.height, commonIconButton(() { if (_selectedSurah < 0) { @@ -274,7 +274,7 @@ class _QuranScreenState extends State { return; } } - }).paddingOnly(left: 41, right: 41), + }).paddingOnly(left: isPortrait ? 41 : 21, right: 41), ]; Widget quranTextView = SingleChildScrollView( @@ -289,7 +289,7 @@ class _QuranScreenState extends State { // } Widget quranView = Container( - margin: EdgeInsets.only(top: 28, bottom: 14), + margin: EdgeInsets.only(top: isPortrait ? 28 : 14, bottom: 14), padding: EdgeInsets.only(top: 16, bottom: 12, right: 16, left: 16), decoration: BoxDecoration( color: ColorConsts.brownLightECColor, @@ -310,7 +310,8 @@ class _QuranScreenState extends State { : (value) { _currentPage = _surahModel?.data?.singleWhere((element) => element.nameAR == value)?.startPageNo ?? _currentPage; _clearFilterAndRefreshData(); - }), + }, + isPortrait), nextOptionButton( Icons.arrow_forward_ios_rounded, _currentSurahIndex <= 0 ? "" : Utils.getNotNullValue(_surahList, _currentSurahIndex - 1) ?? "", @@ -319,17 +320,18 @@ class _QuranScreenState extends State { : (value) { _currentPage = _surahModel?.data?.elementAt(_surahList.indexOf(value))?.startPageNo ?? _currentPage; _clearFilterAndRefreshData(); - }), + }, + isPortrait), ], ), - quranText(), + isPortrait ? quranText() : SingleChildScrollView(child: quranText()).expanded, Row( children: [ Column( mainAxisSize: MainAxisSize.min, children: [ - SvgPicture.asset("assets/icons/new/dimension.svg", width: 12, color: ColorConsts.brownLightColor), - "ت".toText(12, color: ColorConsts.brownLightColor), + SvgPicture.asset("assets/icons/new/dimension.svg", width: isPortrait ? 12 : 16, color: ColorConsts.brownLightColor), + "ت".toText(isPortrait ? 12 : 16, color: ColorConsts.brownLightColor), ], ).onPress(() { if (fontSize <= 12) { @@ -344,8 +346,8 @@ class _QuranScreenState extends State { Column( mainAxisSize: MainAxisSize.min, children: [ - SvgPicture.asset("assets/icons/new/dimension.svg", width: 16, color: ColorConsts.brownLightColor), - "ت".toText(16, color: ColorConsts.brownLightColor), + SvgPicture.asset("assets/icons/new/dimension.svg", width: isPortrait ? 16 : 18, color: ColorConsts.brownLightColor), + "ت".toText(isPortrait ? 16 : 18, color: ColorConsts.brownLightColor), ], ).onPress(() { if (fontSize >= 36) { @@ -366,37 +368,38 @@ class _QuranScreenState extends State { // if (MediaQuery.of(context).orientation == Orientation.portrait) { // quranView = Expanded(child: quranView); // } - List finalViewList = [] + - widList + - [ - if (_surahAya.isNotEmpty && _surahAya.length > 2) ...[ - quranView, - if (_selectedFromAya == -1 && _selectedToAya == -1) - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - previousOptionButton( - Icons.arrow_back_ios_rounded, - "الصفحة التالية", - _currentPage == 604 - ? null - : (value) { - _currentPage = _currentPage + 1; - _clearFilterAndRefreshData(); - }), - nextOptionButton( - Icons.arrow_forward_ios_rounded, - "الصفحة السابقة", - _currentPage <= 1 - ? null - : (value) { - _currentPage = _currentPage - 1; - _clearFilterAndRefreshData(); - }), - ], - ), - ] - ]; + List resultListView = [ + if (_surahAya.isNotEmpty && _surahAya.length > 2) ...[ + isPortrait ? quranView : quranView.expanded, + if (_selectedFromAya == -1 && _selectedToAya == -1) + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + previousOptionButton( + Icons.arrow_back_ios_rounded, + "الصفحة التالية", + _currentPage == 604 + ? null + : (value) { + _currentPage = _currentPage + 1; + _clearFilterAndRefreshData(); + }, + isPortrait), + nextOptionButton( + Icons.arrow_forward_ios_rounded, + "الصفحة السابقة", + _currentPage <= 1 + ? null + : (value) { + _currentPage = _currentPage - 1; + _clearFilterAndRefreshData(); + }, + isPortrait), + ], + ).paddingOnly(right: isPortrait ? 0 : 32), + ] + ]; + List finalViewList = [] + filterList + resultListView; var multiModeView; // if (MediaQuery.of(context).orientation != Orientation.portrait) { // multiModeView = Padding( @@ -423,19 +426,31 @@ class _QuranScreenState extends State { return SizedBox( width: double.infinity, child: Stack( + alignment: isPortrait ? AlignmentDirectional.topStart : Alignment.centerRight, children: [ SizedBox( - width: double.infinity, + height: isPortrait ? null : double.infinity, child: AspectRatio( aspectRatio: 375 / 345, child: Image.asset( "assets/icons/new/quran_bg.jpg", fit: BoxFit.cover, - alignment: Alignment(-0.7, 0.5), + alignment: Alignment(isPortrait ? -0.3 : -0.75, 0.5), ), ), ), - multiModeView + isPortrait + ? multiModeView + : Row( + children: [ + Expanded( + child: Column(children: resultListView), + flex: 7, + ), + Expanded(child: Column(mainAxisAlignment: MainAxisAlignment.center, children: filterList), flex: 5), + 55.width, + ], + ).paddingAll(24), ], ), ); @@ -467,7 +482,7 @@ class _QuranScreenState extends State { ); } - Widget nextOptionButton(IconData icon, String text, Function(String) onPressed) { + Widget nextOptionButton(IconData icon, String text, Function(String) onPressed, bool isPortrait) { return InkWell( onTap: () => onPressed(text), child: onPressed == null @@ -476,8 +491,8 @@ class _QuranScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - text.toText(10, color: ColorConsts.greyA7Color), - Icon(icon, color: ColorConsts.greyA7Color, size: 10), + text.toText(isPortrait ? 10 : 14, color: ColorConsts.greyA7Color), + Icon(icon, color: ColorConsts.greyA7Color, size: isPortrait ? 10 : 14), ], ), ); @@ -517,7 +532,7 @@ class _QuranScreenState extends State { ); } - Widget previousOptionButton(IconData icon, String text, Function(String) onPressed) { + Widget previousOptionButton(IconData icon, String text, Function(String) onPressed, bool isPortrait) { return InkWell( onTap: () => onPressed(text), child: onPressed == null @@ -526,8 +541,8 @@ class _QuranScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - Icon(icon, color: ColorConsts.greyA7Color, size: 10), - text.toText(10, color: ColorConsts.greyA7Color), + Icon(icon, color: ColorConsts.greyA7Color, size: isPortrait ? 10 : 14), + text.toText(isPortrait ? 10 : 14, color: ColorConsts.greyA7Color), ], ), ); @@ -591,6 +606,92 @@ class _QuranScreenState extends State { } void showAyaOptions(AyaModelData ayaModelData) { + showDialog( + context: context, + barrierColor: ColorConsts.primaryBlack.withOpacity(0.5), + builder: (cxt) { + return Dialog( + insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + elevation: 0, + backgroundColor: Colors.transparent, + child: Container( + margin: EdgeInsets.all(16), + width: MediaQuery.of(context).size.width * .3, + padding: EdgeInsets.symmetric(vertical: 24, horizontal: 24), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + "اختر".toText(18, isBold: true, color: ColorConsts.darkText, fontFamily: false), + 18.height, + InkWell( + onTap: () async { + Navigator.pop(context); + List list = []; + list = await getTangheemBySurahId(ayaModelData.surahID, ayaModelData.numberInSurah); + if (list.isEmpty) { + Utils.showToast("لا توجد أساليب تنغيم في هذه الآية"); + return; + } + + List tempList = list.map((element) => element.tangheemTypeName).toList().toSet().toList(); + + if (tempList.length > 1) { + _selectTangheemType(tempList, list); + return; + } + + var name = list.firstWhere((element) => element.tangheemTypeName == tempList.first, orElse: null); + TangheemDetailParams tangheem = TangheemDetailParams(selectedTangheemTypeId: name?.ayaTangheemTypeId ?? "", ayatTangheemTypeMappedDataList: list); + Navigator.pushNamed(this.context, TangheemDetailScreen.routeName, arguments: tangheem); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + border: Border.all(color: ColorConsts.brownLightColor, width: 1), + ), + child: "تفاصيل الأساليب".toText(16, color: ColorConsts.darkText, fontFamily: false), + ), + ), + SizedBox(height: 8), + InkWell( + onTap: () { + Navigator.pop(context); + var temp = _bookMark.firstWhere((element) => element.ayahID == _selectedAyaForBookmark.ayahID, orElse: () => null); + if (temp != null) { + Utils.showToast("هذه الآية مضافة سابقا"); + return; + } + _bookMark.add(_selectedAyaForBookmark); + BookMarkModel.saveToPrefs(_bookMark); + Utils.showToast("تم إضافة الآية كمرجع"); + }, + child: Container( + //width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + border: Border.all(color: ColorConsts.brownLightColor, width: 1), + ), + child: "إضافة الآية كمرجع".toText(16, color: ColorConsts.darkText, fontFamily: false), + ), + ), + ], + ), + ), + ); + }); + return; showModalBottomSheet( context: context, backgroundColor: Colors.transparent, diff --git a/lib/ui/screens/registration_screen.dart b/lib/ui/screens/registration_screen.dart index 4a112e9..b5554ce 100644 --- a/lib/ui/screens/registration_screen.dart +++ b/lib/ui/screens/registration_screen.dart @@ -95,7 +95,7 @@ class _RegistrationScreenState extends State { children: [ Padding( padding: EdgeInsets.only(top: 35, bottom: 24), - child: SvgPicture.asset("assets/logos/tangheem_logo.svg", width: 72, height: 72), + child: SvgPicture.asset("assets/icons/regsiter_user.svg", width: 72, height: 72), ), "انشاء حساب جديد".toText(18, color: ColorConsts.darkText), ], @@ -268,6 +268,7 @@ class _RegistrationScreenState extends State { Expanded( child: SingleChildScrollView( padding: EdgeInsets.all(24), + physics: const BouncingScrollPhysics(), child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart index 78948a5..408ad6f 100644 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ b/lib/ui/screens/tangheem_detail_screen.dart @@ -476,6 +476,7 @@ class _TangheemDetailScreenState extends State { Expanded(child: _header, flex: 4), Expanded( child: ListView( + physics: BouncingScrollPhysics(), children: [ _dataListView, _ayaPlayer, @@ -708,31 +709,49 @@ class _TangheemDetailScreenState extends State { borderRadius: BorderRadius.circular(30), onTap: () async { if (!AppState().isUserLogin) { - Widget cancelButton = TextButton( - style: TextButton.styleFrom(backgroundColor: ColorConsts.sliderBackground, foregroundColor: ColorConsts.primaryBlack), - child: Text("أرغب بالتسجيل"), - onPressed: () async { - Navigator.pop(context); - await Navigator.pushNamed(context, LoginScreen.routeName); - if (!AppState().isUserLogin) { - return; - } - }, - ); - Widget continueButton = TextButton( - style: TextButton.styleFrom(backgroundColor: ColorConsts.sliderBackground, foregroundColor: ColorConsts.primaryBlack), - child: Text("استمرار كضيف"), - onPressed: () { - Navigator.pop(context); + Widget cancelButton = Container( + height: 40, + padding: EdgeInsets.only(left: 16, right: 16), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: ColorConsts.darkText, + ), + child: "أرغب بالتسجيل".toText(14, fontFamily: false)) + .onPress(() async { + Navigator.pop(context); + await Navigator.pushNamed(context, LoginScreen.routeName); + if (!AppState().isUserLogin) { return; - }, - ); + } + }); + + Widget continueButton = Container( + height: 40, + padding: EdgeInsets.only(left: 16, right: 16), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: ColorConsts.darkText, + ), + child: "استمرار كضيف".toText(14, fontFamily: false)) + .onPress(() { + Navigator.pop(context); + return; + }); + AlertDialog alert = AlertDialog( - content: Text("هذه الخاصية متاحه فقط للأعضاء المسجلين"), + content: "هذه الخاصية متاحه فقط للأعضاء المسجلين".toText(18, color: ColorConsts.darkText, isBold: true, fontFamily: false), actionsAlignment: MainAxisAlignment.spaceEvenly, + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(24.0))), actions: [ - cancelButton, - continueButton, + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + cancelButton, + continueButton, + ], + ), ], ); showDialog(