From 66da38202935cf803bc25a97cbb3369ec826ee90 Mon Sep 17 00:00:00 2001 From: meylis98 Date: Mon, 13 Mar 2023 18:06:30 +0500 Subject: [PATCH] contacts ui bug solved --- android/app/src/main/res/values/styles.xml | 25 +- lib/features/screens/drawer/contacts.dart | 416 +++++++++--------- .../screens/drawer/sapaly_drawer.dart | 67 ++- lib/l10n/app_en.arb | 2 +- lib/l10n/app_ru.arb | 2 +- lib/l10n/app_tk.arb | 2 +- 6 files changed, 272 insertions(+), 242 deletions(-) diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 82c1a05..3c5a112 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,21 +1,10 @@ - - - + @drawable/launch_background + true + + - This Theme is only used starting with V2 of Flutter's Android embedding. --> - - diff --git a/lib/features/screens/drawer/contacts.dart b/lib/features/screens/drawer/contacts.dart index 81f1d3c..21703e9 100644 --- a/lib/features/screens/drawer/contacts.dart +++ b/lib/features/screens/drawer/contacts.dart @@ -7,6 +7,7 @@ import 'package:provider/provider.dart'; import 'package:sapaly_shop/common/custom_button.dart'; import 'package:sapaly_shop/common/widgets/custom_text_field.dart'; import 'package:sapaly_shop/constants/global_variables.dart'; +import 'package:sapaly_shop/constants/utils.dart'; import 'package:sapaly_shop/features/screens/drawer/sapaly_drawer.dart'; import 'package:sapaly_shop/features/screens/home/home_screen.dart'; import 'package:sapaly_shop/features/services/auth_service.dart'; @@ -75,219 +76,238 @@ class _ContactsScreenState extends State { vertical: GlobalVariables.verticalPadding(context), horizontal: GlobalVariables.horizontalPadding(context), ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CustomTextField( - labelText: 'first_name'.translation, - hintText: 'first_name'.translation, - controller: firstNameController, - obscureText: false, - inputType: TextInputType.text, - isPassword: false, - contentPadding: 0, - ), - CustomTextField( - labelText: 'email'.translation, - hintText: 'email'.translation, - controller: emailController, - obscureText: false, - inputType: TextInputType.emailAddress, - isPassword: false, - contentPadding: 0, - ), - CustomTextField( - labelText: 'subject'.translation, - hintText: 'subject'.translation, - controller: subjectController, - obscureText: false, - inputType: TextInputType.text, - isPassword: false, - contentPadding: 0, - ), - SizedBox( - height: GlobalVariables.deviceHeight(context) / 6, - child: CustomTextField( - labelText: 'message'.translation, - hintText: 'message'.translation, - controller: messageController, + child: ScrollConfiguration( + behavior: CustomScrollBehavior(), + child: ListView( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomTextField( + labelText: 'first_name'.translation, + hintText: 'first_name'.translation, + controller: firstNameController, obscureText: false, inputType: TextInputType.text, isPassword: false, - contentPadding: 100.adaptedPx(), + contentPadding: 0, ), - ), - CustomButton( - name: 'send_message'.translation, - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => me.user.token.isEmpty - ? const UnAuthenticated() - : const HomeScreen(), + Padding( + padding: EdgeInsets.symmetric( + vertical: GlobalVariables.verticalPadding(context), + ), + child: CustomTextField( + labelText: 'email'.translation, + hintText: 'email'.translation, + controller: emailController, + obscureText: false, + inputType: TextInputType.emailAddress, + isPassword: false, + contentPadding: 0, + ), + ), + CustomTextField( + labelText: 'subject'.translation, + hintText: 'subject'.translation, + controller: subjectController, + obscureText: false, + inputType: TextInputType.text, + isPassword: false, + contentPadding: 0, + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: GlobalVariables.verticalPadding(context), + ), + child: SizedBox( + height: GlobalVariables.deviceHeight(context) / 6, + child: CustomTextField( + labelText: 'message'.translation, + hintText: 'message'.translation, + controller: messageController, + obscureText: false, + inputType: TextInputType.text, + isPassword: false, + contentPadding: 100.adaptedPx(), ), - ); - }, - backgroundColor: AppTheme.lightPrimaryColor, - isMain: true, - ), - ListTile( - leading: const Icon( - Icons.location_on_outlined, - color: AppTheme.lightPrimaryColor, + ), ), - title: Text( - 'our_location'.translation, - style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( - fontSize: 15.adaptedPx(), - fontWeight: FontWeight.w600, - color: AppTheme.blackColor, + CustomButton( + name: 'send_message'.translation, + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => me.user.token.isEmpty + ? const UnAuthenticated() + : const HomeScreen(), ), + ); + }, + backgroundColor: AppTheme.lightPrimaryColor, + isMain: true, ), - subtitle: Text( - 'Turkmenistan, Ashgabat city, Galkynysh, street 66(old printing house)', - style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( - fontSize: 13.adaptedPx(), - color: AppTheme.blackColor, - ), + ListTile( + leading: const Icon( + Icons.location_on_outlined, + color: AppTheme.lightPrimaryColor, + ), + title: Text( + 'our_location'.translation, + style: + Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( + fontSize: 15.adaptedPx(), + fontWeight: FontWeight.w600, + color: AppTheme.blackColor, + ), + ), + subtitle: Text( + 'Turkmenistan, Ashgabat city, Galkynysh, street 66(old printing house)', + style: + Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( + fontSize: 13.adaptedPx(), + color: AppTheme.blackColor, + ), + ), ), - ), - ListTile( - leading: const Icon( - Icons.email_outlined, - color: AppTheme.lightPrimaryColor, - ), - title: Text( - 'email'.translation, - style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( - fontSize: 15.adaptedPx(), - fontWeight: FontWeight.w600, - color: AppTheme.blackColor, - ), - ), - subtitle: Text( - 'enquery@gmail.com help@yourdomain.com', - style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( - fontSize: 13.adaptedPx(), - color: AppTheme.blackColor, - ), - ), - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) => Column( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox(height: 10.adaptedPx()), - TextButton( - onPressed: () async { - if (await canLaunchUrlString("mailto:$mail1")) { - await launchUrlString("mailto:$mail1"); - } - Navigator.of(context).pop(); - }, - child: Text( - mail1, - style: Theme.of(context) - .primaryTextTheme - .bodyMedium! - .copyWith( - fontSize: 20.adaptedPx(), - color: AppTheme.blackColor, - ), + ListTile( + leading: const Icon( + Icons.email_outlined, + color: AppTheme.lightPrimaryColor, + ), + title: Text( + 'email'.translation, + style: + Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( + fontSize: 15.adaptedPx(), + fontWeight: FontWeight.w600, + color: AppTheme.blackColor, + ), + ), + subtitle: Text( + 'enquery@gmail.com help@yourdomain.com', + style: + Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( + fontSize: 13.adaptedPx(), + color: AppTheme.blackColor, + ), + ), + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 10.adaptedPx()), + TextButton( + onPressed: () async { + if (await canLaunchUrlString("mailto:$mail1")) { + await launchUrlString("mailto:$mail1"); + } + Navigator.of(context).pop(); + }, + child: Text( + mail1, + style: Theme.of(context) + .primaryTextTheme + .bodyMedium! + .copyWith( + fontSize: 20.adaptedPx(), + color: AppTheme.blackColor, + ), + ), ), - ), - SizedBox(height: 10.adaptedPx()), - TextButton( - onPressed: () async { - if (await canLaunchUrlString("mailto:$mail2")) { - await launchUrlString("mailto:$mail2"); - } - Navigator.of(context).pop(); - }, - child: Text( - mail2, - style: Theme.of(context) - .primaryTextTheme - .bodyMedium! - .copyWith( - fontSize: 20.adaptedPx(), - color: AppTheme.blackColor, - ), + SizedBox(height: 10.adaptedPx()), + TextButton( + onPressed: () async { + if (await canLaunchUrlString("mailto:$mail2")) { + await launchUrlString("mailto:$mail2"); + } + Navigator.of(context).pop(); + }, + child: Text( + mail2, + style: Theme.of(context) + .primaryTextTheme + .bodyMedium! + .copyWith( + fontSize: 20.adaptedPx(), + color: AppTheme.blackColor, + ), + ), ), - ), - SizedBox(height: 10.adaptedPx()), - ], - ), - ); - }, - ), - ListTile( - leading: const Icon( - Icons.phone_outlined, - color: AppTheme.lightPrimaryColor, - ), - title: Text( - 'contacts'.translation, - style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( - fontSize: 15.adaptedPx(), - fontWeight: FontWeight.w600, - color: AppTheme.blackColor, + SizedBox(height: 10.adaptedPx()), + ], ), + ); + }, ), - subtitle: Text( - '$number1 $number2', - style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( - fontSize: 13.adaptedPx(), - color: AppTheme.blackColor, + ListTile( + leading: const Icon( + Icons.phone_outlined, + color: AppTheme.lightPrimaryColor, + ), + title: Text( + 'contacts'.translation, + style: + Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( + fontSize: 15.adaptedPx(), + fontWeight: FontWeight.w600, + color: AppTheme.blackColor, + ), + ), + subtitle: Text( + '$number1 $number2', + style: + Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( + fontSize: 13.adaptedPx(), + color: AppTheme.blackColor, + ), + ), + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextButton( + onPressed: () { + launchUrlString('tel://$number1'); + Navigator.of(context).pop(); + }, + child: Text( + number1, + style: Theme.of(context) + .primaryTextTheme + .bodyMedium! + .copyWith( + fontSize: 20.adaptedPx(), + color: AppTheme.blackColor, + ), + ), + ), + SizedBox(height: 10.adaptedPx()), + TextButton( + onPressed: () { + launchUrlString('tel://$number2'); + Navigator.of(context).pop(); + }, + child: Text( + number2, + style: Theme.of(context) + .primaryTextTheme + .bodyMedium! + .copyWith( + fontSize: 20.adaptedPx(), + color: AppTheme.blackColor, + ), + ), + ), + SizedBox(height: 10.adaptedPx()), + ], ), + ); + }, ), - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) => Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextButton( - onPressed: () { - launchUrlString('tel://$number1'); - Navigator.of(context).pop(); - }, - child: Text( - number1, - style: Theme.of(context) - .primaryTextTheme - .bodyMedium! - .copyWith( - fontSize: 20.adaptedPx(), - color: AppTheme.blackColor, - ), - ), - ), - SizedBox(height: 10.adaptedPx()), - TextButton( - onPressed: () { - launchUrlString('tel://$number2'); - Navigator.of(context).pop(); - }, - child: Text( - number2, - style: Theme.of(context) - .primaryTextTheme - .bodyMedium! - .copyWith( - fontSize: 20.adaptedPx(), - color: AppTheme.blackColor, - ), - ), - ), - SizedBox(height: 10.adaptedPx()), - ], - ), - ); - }, - ), - ], + ], + ), ), ), ); diff --git a/lib/features/screens/drawer/sapaly_drawer.dart b/lib/features/screens/drawer/sapaly_drawer.dart index f629974..7a6445f 100644 --- a/lib/features/screens/drawer/sapaly_drawer.dart +++ b/lib/features/screens/drawer/sapaly_drawer.dart @@ -156,34 +156,55 @@ class _SapalyDrawerState extends State { ], ), ), - Row( - children: [ - SapalyIcon( - onTap: () async { - var lang = - await languagePicker(context, settings.currentLanguage); + Padding( + padding: EdgeInsets.symmetric( + vertical: 15.adaptedPx(), + horizontal: 5.adaptedPx(), + ), + child: GestureDetector( + onTap: () async { + var lang = + await languagePicker(context, settings.currentLanguage); - if (lang != null) { - await settings.setLanguage(lang); - Navigator.of(context, rootNavigator: true) - .pushNamedAndRemoveUntil('/home', (route) => false); - } - }, - width: 25.adaptedPx(), - height: 25.adaptedPx(), - hasBadge: false, - child: SvgPicture.asset('assets/icons/lang.svg'), - ), - SizedBox(width: 10.adaptedPx()), - Text( - 'currentLang'.translation, - style: - Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( + if (lang != null) { + await settings.setLanguage(lang); + Navigator.of(context, rootNavigator: true) + .pushNamedAndRemoveUntil('/home', (route) => false); + } + }, + child: Row( + children: [ + SapalyIcon( + onTap: () async { + var lang = await languagePicker( + context, settings.currentLanguage); + + if (lang != null) { + await settings.setLanguage(lang); + Navigator.of(context, rootNavigator: true) + .pushNamedAndRemoveUntil( + '/home', (route) => false); + } + }, + width: 25.adaptedPx(), + height: 25.adaptedPx(), + hasBadge: false, + child: SvgPicture.asset('assets/icons/lang.svg'), + ), + SizedBox(width: 10.adaptedPx()), + Text( + 'currentLang'.translation, + style: Theme.of(context) + .primaryTextTheme + .bodyMedium + ?.copyWith( color: AppTheme.blackColor, fontSize: 15.adaptedPx(), ), + ), + ], ), - ], + ), ), ListView.builder( shrinkWrap: true, diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index deb06d6..591d656 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -28,7 +28,7 @@ "first_name":"First name", "subject":"Subject of message", "message":"Your message...", - "needToEnter":"Log in to use the service", + "needToEnter":"Log in to use\nthe service", "error_occured":"Error occured", "info_about_user":"Information about user", "edit":"Edit" diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 4c80594..43d84d5 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -28,7 +28,7 @@ "first_name":"Ваше имя", "subject":"Тема сообщения", "message":"Ваше сообщение...", - "needToEnter":"Чтобы воспользоваться услугой авторизуйтесь", + "needToEnter":"Чтобы воспользоваться\nуслугой авторизуйтесь", "error_occured":"Произошла ошибка", "info_about_user":"Информация о пользователе", "edit":"Редактировать" diff --git a/lib/l10n/app_tk.arb b/lib/l10n/app_tk.arb index 4d44987..bfd01fe 100644 --- a/lib/l10n/app_tk.arb +++ b/lib/l10n/app_tk.arb @@ -28,7 +28,7 @@ "first_name":"Ady", "subject":"Hatyň mowzugy", "message":"Siziň hatyňyz...", - "needToEnter":"Hyzmaty ulanmak üçin ulgama giriň", + "needToEnter":"Hyzmaty ulanmak\nüçin ulgama giriň", "error_occured":"Näsazlyk ýüze çykdy", "info_about_user":"Ulanyjy barada maglumat", "edit":"Üýtgetmek"