From df4426ddf8812b7207da23e528ec219083f8c1e3 Mon Sep 17 00:00:00 2001 From: Sagar Raj <78961406+sagarrajgit@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:36:24 +0530 Subject: [PATCH] Feature/ info screen explaining how to get weather api key (#383) * done for all lang * fix pixel overflow --------- Co-authored-by: Sagar Raj --- .../settings/views/google_sign_in.dart | 4 +- .../modules/settings/views/weather_api.dart | 208 +++++++++++++++++- lib/app/utils/language.dart | 19 ++ .../utils/languages/french_translations.dart | 18 ++ .../utils/languages/german_translations.dart | 24 +- .../utils/languages/russian_translations.dart | 21 +- .../utils/languages/spanish_translations.dart | 20 +- 7 files changed, 300 insertions(+), 14 deletions(-) diff --git a/lib/app/modules/settings/views/google_sign_in.dart b/lib/app/modules/settings/views/google_sign_in.dart index 32a34741..15b2edeb 100644 --- a/lib/app/modules/settings/views/google_sign_in.dart +++ b/lib/app/modules/settings/views/google_sign_in.dart @@ -149,7 +149,6 @@ class GoogleSignIn extends StatelessWidget { child: Padding( padding: EdgeInsets.only(left: 30, right: 30), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Obx( () => Column( @@ -202,7 +201,7 @@ class GoogleSignIn extends StatelessWidget { height: 5, ), Text( - 'Shared Alarms'.tr, + 'Shared Alarm'.tr, style: Theme.of(context).textTheme.displaySmall, ), @@ -294,6 +293,7 @@ class GoogleSignIn extends StatelessWidget { : kprimaryTextColor.withOpacity(0.3), ), ), + Spacer(), Obx( () => Icon( (controller.isUserLoggedIn.value) diff --git a/lib/app/modules/settings/views/weather_api.dart b/lib/app/modules/settings/views/weather_api.dart index 9bcc392a..ae2e3046 100644 --- a/lib/app/modules/settings/views/weather_api.dart +++ b/lib/app/modules/settings/views/weather_api.dart @@ -303,14 +303,212 @@ class WeatherApi extends StatelessWidget { child: Padding( padding: EdgeInsets.only(left: 30, right: 30), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: Text( - 'Open Weather Map API', - style: Theme.of(context).textTheme.bodyLarge, + Text( + 'Open Weather Map API', + style: Theme.of(context).textTheme.bodyLarge, + ), + IconButton( + icon: Icon( + Icons.info_sharp, + size: 21, + color: themeController.isLightMode.value + ? kLightPrimaryTextColor.withOpacity(0.3) + : kprimaryTextColor.withOpacity(0.3), ), + onPressed: () => { + Utils.hapticFeedback(), + showBottomSheet( + context: context, + backgroundColor: themeController.isLightMode.value + ? kLightSecondaryBackgroundColor + : ksecondaryBackgroundColor, + builder: (context) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: width * 0.05, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + children: [ + Text( + 'onenweathermap_title1.1'.tr, + style: + Theme.of(context).textTheme.displayMedium, + textAlign: TextAlign.center, + ), + Text( + 'onenweathermap_title1.2'.tr, + style: + Theme.of(context).textTheme.displayMedium, + textAlign: TextAlign.center, + ), + ], + ), + SizedBox( + height: height * 0.6, + child: ListView( + children: [ + RichText( + textAlign: TextAlign.justify, + text: TextSpan( + style: TextStyle( + fontSize: 16, + ), + children: [ + TextSpan( + text: 'step1.1'.tr, + ), + TextSpan( + text: 'step1.2'.tr, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: 'step1.3'.tr, + ), + TextSpan( + text: 'step1.4'.tr, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: 'step1.5'.tr, + ), + ], + ), + ), + SizedBox( + height: 15, + ), + RichText( + textAlign: TextAlign.justify, + text: TextSpan( + style: TextStyle( + fontSize: 16, + ), + children: [ + TextSpan( + text: 'step2.1'.tr, + ), + TextSpan( + text: 'step2.2'.tr, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: 'step2.3'.tr, + ), + ], + ), + ), + SizedBox( + height: 15, + ), + RichText( + textAlign: TextAlign.justify, + text: TextSpan( + style: TextStyle( + fontSize: 16, + ), + children: [ + TextSpan( + text: 'step3'.tr, + ), + ], + ), + ), + SizedBox( + height: 15, + ), + RichText( + textAlign: TextAlign.justify, + text: TextSpan( + style: TextStyle( + fontSize: 16, + ), + children: [ + TextSpan( + text: 'step4.1'.tr, + ), + TextSpan( + text: 'step4.2'.tr, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: 'step4.3'.tr, + ), + TextSpan( + text: 'step4.4'.tr, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: 'step4.5'.tr, + ), + ], + ), + ), + SizedBox( + height: 15, + ), + RichText( + textAlign: TextAlign.justify, + text: TextSpan( + style: TextStyle( + fontSize: 16, + ), + children: [ + TextSpan( + text: 'step5'.tr, + ), + ], + ), + ), + ], + ), + ), + SizedBox( + width: width, + child: TextButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + kprimaryColor, + ), + ), + onPressed: () { + Utils.hapticFeedback(); + Get.back(); + }, + child: Text( + 'Understood'.tr, + style: Theme.of(context) + .textTheme + .displaySmall! + .copyWith( + color: themeController.isLightMode.value + ? kLightPrimaryTextColor + : ksecondaryTextColor, + ), + ), + ), + ), + ], + ), + ); + }, + ), + }, ), + Spacer(), Icon( Icons.arrow_forward_ios_sharp, color: themeController.isLightMode.value diff --git a/lib/app/utils/language.dart b/lib/app/utils/language.dart index 6f1063e7..f124dbd4 100644 --- a/lib/app/utils/language.dart +++ b/lib/app/utils/language.dart @@ -1,3 +1,4 @@ +import 'package:get/get.dart'; import 'package:get/get_navigation/src/root/internacionalization.dart'; import 'package:ultimate_alarm_clock/app/utils/languages/french_translations.dart'; import 'package:ultimate_alarm_clock/app/utils/languages/german_translations.dart'; @@ -184,6 +185,24 @@ class AppTranslations extends Translations{ 'Weekends' : 'Weekends', 'Mon' : 'Mon' , 'Tue' : 'Tue', 'Wed' : 'Wed', 'Thur' : 'Thur', 'Fri' : 'Fri', 'Sat' : 'Sat', 'Sun' : 'Sun', + //OpenWeatherMap + 'onenweathermap_title1.1': 'Steps to get ', + 'onenweathermap_title1.2': 'OpenWeatherMap API', + 'step1.1':'Go to ', + 'step1.2':'openweathermap.org', + 'step1.3':', click on the ', + 'step1.4':'SignIn', + 'step1.5':' button(top right corner) then it ask for login credentials.', + 'step2.1':'If you already have an account then enter your credentials. Otherwise, click on ', + 'step2.2':'Create an Account', + 'step2.3':' option. It asks you to Enter your username, email, and password. Make sure entered details are correct.', + 'step3':'Once your account is created, you are automatically directed to the OpenWeather page. It asks you about your company and the purpose of using the platform, fill this details accordingly.', + 'step4.1':'Click on your ', + 'step4.2':'Username', + 'step4.3':'(top right corner). A dropdown menu appears. Click on ', + 'step4.4':'My API', + 'step4.5':' option.', + 'step5':'Now you have the API key. Select the key and copy it.', }, 'de_DE' : GermanTranslations().keys['de_DE']!, diff --git a/lib/app/utils/languages/french_translations.dart b/lib/app/utils/languages/french_translations.dart index 0756eb4f..ff894214 100644 --- a/lib/app/utils/languages/french_translations.dart +++ b/lib/app/utils/languages/french_translations.dart @@ -178,6 +178,24 @@ class FrenchTranslations extends Translations { 'Weekends': 'Week-ends', 'Mon': 'Lun', 'Tue': 'Mar', 'Wed': 'Mer', 'Thur': 'Jeu', 'Fri': 'Ven', 'Sat': 'Sam', 'Sun': 'Dim', + //OpenWeatherMap + 'onenweathermap_title1.1': 'Étapes pour obtenir ', + 'onenweathermap_title1.2': 'OpenWeatherMap API', + 'step1.1':'Aller à ', + 'step1.2':'openweathermap.org', + 'step1.3':', cliquez sur le bouton ', + 'step1.4':'SignIn', + 'step1.5':' (le coin supérieur droit) puis il demande les informations de connexion.', + 'step2.1':"Si vous avez déjà un compte, entrez vos identifiants. Sinon, cliquez sur l'option ", + 'step2.2':'Create an Account', + 'step2.3':". Il vous demande de saisir votre nom d'utilisateur, votre e-mail et votre mot de passe. Assurez-vous que les détails sont corrects.", + 'step3':"Une fois votre compte prêt, vous êtes automatiquement dirigé vers la page OpenWeather. Il vous pose des questions sur votre entreprise et le but de l'utilisation de la plateforme, remplissez ces informations en conséquence.", + 'step4.1':'Cliquez sur votre ', + 'step4.2':'Username', + 'step4.3':"(le coin supérieur droit). Un menu déroulant apparaît. cliquez sur l'option ", + 'step4.4':'My API', + 'step4.5':'.', + 'step5':'Vous disposez désormais de la clé API Météo. Sélectionnez la clé et copiez-la.', }, }; } diff --git a/lib/app/utils/languages/german_translations.dart b/lib/app/utils/languages/german_translations.dart index a7de179e..2c29d6bc 100644 --- a/lib/app/utils/languages/german_translations.dart +++ b/lib/app/utils/languages/german_translations.dart @@ -127,7 +127,6 @@ class GermanTranslations extends Translations { 'time' : 'Mal', //'shared_alarm_tile.dart 'Shared Alarm' : 'Geteilter Alarm', - 'Shared alarms' : 'Geteilte Alarme', 'sharedDescription' : 'Teilen Sie Alarme mit anderen mithilfe der Alarm-ID. Jeder geteilte Benutzer kann wählen, ob sein Alarm vor oder nach der eingestellten Zeit klingelt.', 'Understood' : 'Verstanden', 'To use this feature, you have to link your Google account!' : 'Um diese Funktion zu verwenden, müssen Sie Ihr Google-Konto verknüpfen!', @@ -176,8 +175,25 @@ class GermanTranslations extends Translations { 'Weekdays': 'Wochentage', 'Weekends': 'Wochenenden', 'Mon': 'Mo', 'Tue': 'Di', 'Wed': 'Mi', 'Thur': 'Do', - 'Fri': 'Fr', 'Sat': 'Sa', 'Sun': 'So' - - } + 'Fri': 'Fr', 'Sat': 'Sa', 'Sun': 'So', + //OpenWeatherMap + 'onenweathermap_title1.1': 'Schritte zum Erhalten ', + 'onenweathermap_title1.2': 'OpenWeatherMap API', + 'step1.1':'Gehe zu ', + 'step1.2':'openweathermap.org', + 'step1.3':', Klicken Sie auf die Schaltfläche ', + 'step1.4':'SignIn', + 'step1.5':' (oben rechts) und Sie werden nach Ihren Anmeldeinformationen gefragt.', + 'step2.1':'Wenn Sie bereits ein Konto haben, geben Sie Ihre Zugangsdaten ein. Andernfalls klicken Sie auf die Option ', + 'step2.2':'Create an Account', + 'step2.3':'. Sie werden aufgefordert, Ihren Benutzernamen, Ihre E-Mail-Adresse und Ihr Passwort einzugeben. Stellen Sie sicher, dass die Angaben korrekt sind.', + 'step3':'Sobald Ihr Konto bereit ist, werden Sie automatisch zur OpenWeather-Seite weitergeleitet. Dabei werden Sie nach Ihrem Unternehmen und dem Zweck der Nutzung der Plattform gefragt, Füllen Sie diese Angaben entsprechend aus.', + 'step4.1':'Klicken Sie auf Ihr ', + 'step4.2':'Username', + 'step4.3':'(oben rechts). Es erscheint ein Dropdown-Menü. Klicken Sie auf die Option ', + 'step4.4':'My API', + 'step4.5':'.', + 'step5':'Jetzt haben Sie den Wetter-API-Schlüssel. Wählen Sie den Schlüssel aus und kopieren Sie ihn.', + }, }; } diff --git a/lib/app/utils/languages/russian_translations.dart b/lib/app/utils/languages/russian_translations.dart index b5dad946..458b076a 100644 --- a/lib/app/utils/languages/russian_translations.dart +++ b/lib/app/utils/languages/russian_translations.dart @@ -176,8 +176,25 @@ class RussianTranslations extends Translations { 'Weekdays': 'Будние дни', 'Weekends': 'Выходные', 'Mon': 'Пн', 'Tue': 'Вт', 'Wed': 'Ср', 'Thur': 'Чт', - 'Fri': 'Пт', 'Sat': 'Сб', 'Sun': 'Вс' - + 'Fri': 'Пт', 'Sat': 'Сб', 'Sun': 'Вс', + //OpenWeatherMap + 'onenweathermap_title1.1': 'Шаги, чтобы получить ', + 'onenweathermap_title1.2': 'OpenWeatherMap API', + 'step1.1':'Идти к ', + 'step1.2':'openweathermap.org', + 'step1.3':', нажмите на кнопку ', + 'step1.4':'SignIn', + 'step1.5':' (в правом верхнем углу) затем он запрашивает учетные данные для входа.', + 'step2.1':'Если у вас уже есть учетная запись, введите свои учетные данные. В противном случае нажмите на опцию ', + 'step2.2':'Create an Account', + 'step2.3':' . Он просит вас ввести имя пользователя, адрес электронной почты и пароль. Убедитесь, что введенные данные верны.', + 'step3':'Как только ваша учетная запись будет создана, вы автоматически будете перенаправлены на страницу OpenWeather. Он спрашивает вас о вашей компании и цели использования платформы., заполните эти данные соответствующим образом.', + 'step4.1':'Нажмите на ', + 'step4.2':'Username', + 'step4.3':'(в правом верхнем углу). Появится раскрывающееся меню. Нажмите на опцию ', + 'step4.4':'My API', + 'step4.5':'.', + 'step5':'Теперь у вас есть API. Выберите ключ и скопируйте его.', }, }; } diff --git a/lib/app/utils/languages/spanish_translations.dart b/lib/app/utils/languages/spanish_translations.dart index 714abc89..9c3ecae1 100644 --- a/lib/app/utils/languages/spanish_translations.dart +++ b/lib/app/utils/languages/spanish_translations.dart @@ -176,7 +176,25 @@ class SpanishTranslations extends Translations { 'Weekdays': 'Días laborables', 'Weekends': 'Fines de semana', 'Mon': 'Lun', 'Tue': 'Mar', 'Wed': 'Mié', 'Thur': 'Jue', - 'Fri': 'Vie', 'Sat': 'Sáb', 'Sun': 'Dom' + 'Fri': 'Vie', 'Sat': 'Sáb', 'Sun': 'Dom', + //OpenWeatherMap + 'onenweathermap_title1.1': 'Pasos para conseguir ', + 'onenweathermap_title1.2': 'OpenWeatherMap API', + 'step1.1':'Ir a ', + 'step1.2':'openweathermap.org', + 'step1.3':', haga clic en el botón ', + 'step1.4':'SignIn', + 'step1.5':' (esquina superior derecha) luego solicita las credenciales de inicio de sesión.', + 'step2.1':'Si ya tiene una cuenta, ingrese sus credenciales. De lo contrario, haga clic en la opción ', + 'step2.2':'Create an Account', + 'step2.3':'. Le pide que ingrese su nombre de usuario, correo electrónico y contraseña. Asegúrate de que los detalles sean correctos.', + 'step3':'Una vez que su cuenta esté lista, se le dirigirá automáticamente a la página de OpenWeather. Te pregunta sobre tu empresa y el propósito de uso de la plataforma, complete estos detalles en consecuencia.', + 'step4.1':'Haga clic en su ', + 'step4.2':'Username', + 'step4.3':'(esquina superior derecha). Aparece un menú desplegable. Haga clic en la opción ', + 'step4.4':'My API', + 'step4.5':'.', + 'step5':'Ahora tienes la API. Seleccione la API y cópiela.', }, }; }