From 76c9a1abe59fe5e46e2963ec339e580bdb629fb1 Mon Sep 17 00:00:00 2001 From: ice-hector <96414297+ice-hector@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:22:39 +0200 Subject: [PATCH 1/5] refactor: localizations --- lib/app/extensions/build_context.dart | 5 +++++ .../auth/views/pages/auth_page/auth_page.dart | 18 ++++++++-------- lib/app/features/dapps/views/pages/dapps.dart | 21 ++++++++++++++++--- .../dapps/views/pages/widgets/apps.dart | 7 +++++++ .../dapps/views/pages/widgets/favourites.dart | 9 ++++++-- .../widgets/terms_privacy/terms_privacy.dart | 5 +---- lib/l10n/app_en.arb | 12 ++++++++--- lib/l10n/i10n.dart | 1 + 8 files changed, 57 insertions(+), 21 deletions(-) diff --git a/lib/app/extensions/build_context.dart b/lib/app/extensions/build_context.dart index efcea4345..e666c376a 100644 --- a/lib/app/extensions/build_context.dart +++ b/lib/app/extensions/build_context.dart @@ -1,6 +1,11 @@ import 'package:flutter/material.dart'; +import 'package:ice/generated/app_localizations.dart'; extension ThemeGetter on BuildContext { /// Usage example: `context.theme` ThemeData get theme => Theme.of(this); } + +extension I18nGetter on BuildContext { + I18n get i18n => I18n.of(this)!; +} diff --git a/lib/app/features/auth/views/pages/auth_page/auth_page.dart b/lib/app/features/auth/views/pages/auth_page/auth_page.dart index 8c2649ae7..d637d0605 100644 --- a/lib/app/features/auth/views/pages/auth_page/auth_page.dart +++ b/lib/app/features/auth/views/pages/auth_page/auth_page.dart @@ -58,17 +58,16 @@ class AuthPage extends HookConsumerWidget { child: Column( children: [ AuthHeaderWidget( - title: 'Get started', - description: 'Choose your login method', + title: context.i18n.auth_signIn_title, + description: context.i18n.auth_signIn_description, ), - // EmailInput(formKey: emailFormKey), if (isEmailMode) InputField( leadingIcon: Image.asset( Assets.images.fieldEmail.path, color: context.theme.appColors.primaryText, ), - label: 'Email address', + label: context.i18n.auth_signIn_input_email, controller: emailController.controller, validator: (String? value) => emailController.onVerify(), showLeadingSeparator: true, @@ -82,12 +81,11 @@ class AuthPage extends HookConsumerWidget { context, ), ), - label: 'Phone number', + label: context.i18n.auth_signIn_input_phone_number, controller: numberController.controller, validator: (String? value) => numberController.onVerify(), showLeadingSeparator: true, ), - const SizedBox( height: 16, ), @@ -111,14 +109,14 @@ class AuthPage extends HookConsumerWidget { .read(authProvider.notifier) .signIn(email: 'foo@bar.baz', password: '123'), }, - label: const Text('Continue'), + label: Text(context.i18n.button_continue), mainAxisSize: MainAxisSize.max, ), ), Padding( padding: const EdgeInsets.only(top: 14, bottom: 14), child: Text( - 'or', + context.i18n.auth_signIn_or, style: context.theme.appTextThemes.caption .copyWith(color: context.theme.appColors.tertararyText), ), @@ -135,7 +133,9 @@ class AuthPage extends HookConsumerWidget { ref.read(isEmailModeProvider.notifier).state = !isEmailMode; }, label: Text( - isEmailMode ? 'Continue with Email' : 'Continue with Phone', + isEmailMode + ? context.i18n.auth_signIn_button_email + : context.i18n.auth_signIn_button_phone_number, ), mainAxisSize: MainAxisSize.max, ), diff --git a/lib/app/features/dapps/views/pages/dapps.dart b/lib/app/features/dapps/views/pages/dapps.dart index 43079623a..0dc8f55fc 100644 --- a/lib/app/features/dapps/views/pages/dapps.dart +++ b/lib/app/features/dapps/views/pages/dapps.dart @@ -30,17 +30,32 @@ class DAppsPage extends HookConsumerWidget { title: 'Highest ranked', items: featured, onPress: () { - router.go('/dapps/appsList'); + router.go( + '/dapps/appsList', + extra: + AppsRouteData(title: 'Highest ranked', items: featured), + ); }, ), Apps( title: 'Recently added', items: featured, onPress: () { - router.go('/dapps/appsList'); + router.go( + '/dapps/appsList', + extra: + AppsRouteData(title: 'Recently added', items: featured), + ); + }, + ), + Favourites( + onPress: () { + router.go( + '/dapps/appsList', + extra: AppsRouteData(title: 'Favorites', items: featured), + ); }, ), - const Favourites(), ], ), ), diff --git a/lib/app/features/dapps/views/pages/widgets/apps.dart b/lib/app/features/dapps/views/pages/widgets/apps.dart index 60f1bb4eb..3659f0f16 100644 --- a/lib/app/features/dapps/views/pages/widgets/apps.dart +++ b/lib/app/features/dapps/views/pages/widgets/apps.dart @@ -3,6 +3,13 @@ import 'package:ice/app/features/dapps/views/pages/mocks/mocked_apps.dart'; import 'package:ice/app/features/dapps/views/pages/widgets/apps_collection.dart'; import 'package:ice/app/shared/widgets/section_header/section_header.dart'; +class AppsRouteData { + AppsRouteData({required this.title, this.items = const []}); + + final String title; + final List? items; +} + class Apps extends StatelessWidget { const Apps({ this.title = '', diff --git a/lib/app/features/dapps/views/pages/widgets/favourites.dart b/lib/app/features/dapps/views/pages/widgets/favourites.dart index 8e95209e8..c4f8c2896 100644 --- a/lib/app/features/dapps/views/pages/widgets/favourites.dart +++ b/lib/app/features/dapps/views/pages/widgets/favourites.dart @@ -8,7 +8,12 @@ import 'package:ice/generated/assets.gen.dart'; const double containerHeight = 60.0; class Favourites extends StatelessWidget { - const Favourites({super.key}); + const Favourites({ + super.key, + this.onPress, + }); + + final VoidCallback? onPress; @override Widget build(BuildContext context) { @@ -18,7 +23,7 @@ class Favourites extends StatelessWidget { vertical: 24, ), child: GestureDetector( - onTap: () {}, + onTap: onPress, child: Container( height: containerHeight, width: double.infinity, diff --git a/lib/app/shared/widgets/terms_privacy/terms_privacy.dart b/lib/app/shared/widgets/terms_privacy/terms_privacy.dart index 9ac61e05c..cf4735a6d 100644 --- a/lib/app/shared/widgets/terms_privacy/terms_privacy.dart +++ b/lib/app/shared/widgets/terms_privacy/terms_privacy.dart @@ -24,14 +24,11 @@ class TermsPrivacy extends StatelessWidget { ); } - const String text = - 'By continuing, you are agreeing to our [[:link]]Terms of Service[[/:link]] & [[:link]]Privacy Policy[[/:link]]'; - return SizedBox( width: 220, child: Text.rich( replaceString( - text, + context.i18n.auth_privacy, tagRegex('link', isSingular: false), handleMatch, ), diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 47011a332..165c64e8c 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1,6 +1,12 @@ { "hello": "Hello! {userName}", - "@signIn": { - "privacy": "By continuing, you are agreeing to our \\[[:link]]Terms of Service[[/:link]] & [[:link]]Privacy Policy[[/:link]]" - } + "button_continue": "Continue", + "auth_privacy": "By continuing, you are agreeing to our [[:link]]Terms of Service[[/:link]] & [[:link]]Privacy Policy[[/:link]]", + "auth_signIn_title": "Get started", + "auth_signIn_description": "Choose your login method", + "auth_signIn_input_email": "Email address", + "auth_signIn_input_phone_number": "Phone number", + "auth_signIn_button_email": "Continue with Email", + "auth_signIn_button_phone_number": "Continue with Phone", + "auth_signIn_or": "or" } diff --git a/lib/l10n/i10n.dart b/lib/l10n/i10n.dart index 4d03bb360..dddaed5e7 100644 --- a/lib/l10n/i10n.dart +++ b/lib/l10n/i10n.dart @@ -1,3 +1,4 @@ +// ignore: file_names import 'package:flutter/widgets.dart'; RegExp tagRegex(String tag, {bool isSingular = true}) { From 0f6270adb2f3db62a9879b04041adb3b321d75d2 Mon Sep 17 00:00:00 2001 From: ice-hector <96414297+ice-hector@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:54:02 +0200 Subject: [PATCH 2/5] chore: replace texts with localized strings --- .../views/pages/check_email/check_email.dart | 6 +-- .../discover_creators/discover_creators.dart | 11 ++-- .../views/pages/enter_code/enter_code.dart | 10 ++-- .../pages/fill_profile/fill_profile.dart | 12 ++--- .../views/pages/intro_page/intro_page.dart | 6 +-- .../views/pages/nostr_auth/nostr_auth.dart | 9 ++-- .../views/pages/nostr_login/nostr_login.dart | 9 ++-- .../pages/select_country/select_country.dart | 4 +- .../select_languages/select_languages.dart | 7 ++- lib/app/features/dapps/views/pages/dapps.dart | 21 +++++--- .../views/pages/dapps_list/dapps_list.dart | 4 +- .../dapps/views/pages/widgets/categories.dart | 7 +-- .../pages/widgets/categories_collection.dart | 39 ++++++++------- .../dapps/views/pages/widgets/favourites.dart | 4 +- .../dapps/views/pages/widgets/featured.dart | 3 +- lib/app/shared/widgets/email_input.dart | 4 +- lib/app/shared/widgets/search/search.dart | 4 +- .../shared/widgets/secured_by/secured_by.dart | 7 ++- .../widgets/wallet_header/wallet_header.dart | 2 +- lib/l10n/app_en.arb | 50 ++++++++++++++++++- 20 files changed, 143 insertions(+), 76 deletions(-) diff --git a/lib/app/features/auth/views/pages/check_email/check_email.dart b/lib/app/features/auth/views/pages/check_email/check_email.dart index 4836f73e0..e0bdeca47 100644 --- a/lib/app/features/auth/views/pages/check_email/check_email.dart +++ b/lib/app/features/auth/views/pages/check_email/check_email.dart @@ -38,7 +38,7 @@ class CheckEmail extends HookConsumerWidget { height: 12, ), Text( - 'Check email', + context.i18n.check_email_title, style: context.theme.appTextThemes.headline1, ), ], @@ -46,7 +46,7 @@ class CheckEmail extends HookConsumerWidget { Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('We emailed a magic link to'), + Text(context.i18n.check_email_subtitle), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -61,7 +61,7 @@ class CheckEmail extends HookConsumerWidget { padding: const EdgeInsets.symmetric(vertical: 36, horizontal: 20), child: Text( - 'Click the link and enter the code to log in or sign up.', + context.i18n.check_email_description, textAlign: TextAlign.center, style: context.theme.appTextThemes.subtitle2.copyWith( color: context.theme.appColors.secondaryText, diff --git a/lib/app/features/auth/views/pages/discover_creators/discover_creators.dart b/lib/app/features/auth/views/pages/discover_creators/discover_creators.dart index f2cad1785..030314045 100644 --- a/lib/app/features/auth/views/pages/discover_creators/discover_creators.dart +++ b/lib/app/features/auth/views/pages/discover_creators/discover_creators.dart @@ -67,10 +67,9 @@ class DiscoverCreators extends HookConsumerWidget { ), child: Column( children: [ - const TitleDescription( - title: 'Discover creators', - description: - 'Connect with visionaries and inspiring voices', + TitleDescription( + title: context.i18n.discover_creators_title, + description: context.i18n.discover_creators_description, ), Padding( padding: const EdgeInsets.only(bottom: 12), @@ -177,7 +176,9 @@ class DiscoverCreators extends HookConsumerWidget { ? null : context.theme.appColors.primaryAccent, label: Text( - isFollowing ? 'Following' : 'Follow', + isFollowing + ? context.i18n.button_following + : context.i18n.button_follow, style: context.theme.appTextThemes.caption .copyWith( color: isFollowing diff --git a/lib/app/features/auth/views/pages/enter_code/enter_code.dart b/lib/app/features/auth/views/pages/enter_code/enter_code.dart index 1066d90bf..571968f9d 100644 --- a/lib/app/features/auth/views/pages/enter_code/enter_code.dart +++ b/lib/app/features/auth/views/pages/enter_code/enter_code.dart @@ -42,7 +42,7 @@ class EnterCode extends HookConsumerWidget { height: 9, ), Text( - 'Enter the code', + context.i18n.enter_code_title, style: context.theme.appTextThemes.headline1, ), ], @@ -50,7 +50,7 @@ class EnterCode extends HookConsumerWidget { Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('Please enter the code sent to'), + Text(context.i18n.enter_code_description), Text( phoneNumber, style: context.theme.appTextThemes.subtitle, @@ -117,7 +117,7 @@ class EnterCode extends HookConsumerWidget { ), if (invalidCode.value) Text( - 'Invalid code, please try again!', + context.i18n.enter_code_invalid_code, style: context.theme.appTextThemes.body .copyWith(color: context.theme.appColors.attentionRed), ), @@ -127,11 +127,11 @@ class EnterCode extends HookConsumerWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - 'New code available in', + context.i18n.enter_code_available_in, style: context.theme.appTextThemes.subtitle2, ), Text( - ' 30s', + ' 30s', // TODO: Add countdown timer style: context.theme.appTextThemes.subtitle2 .copyWith(color: context.theme.appColors.primaryAccent), ), diff --git a/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart b/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart index fe98dbfa7..27a86401f 100644 --- a/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart +++ b/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart @@ -97,11 +97,11 @@ class FillProfile extends HookConsumerWidget { height: 19, ), Text( - 'Your profile', + context.i18n.fill_profile_title, style: context.theme.appTextThemes.headline1, ), Text( - 'Customize your account', + context.i18n.fill_profile_description, style: context.theme.appTextThemes.body2.copyWith( color: context.theme.appColors.tertararyText, ), @@ -138,7 +138,7 @@ class FillProfile extends HookConsumerWidget { // autofocus: true, leadingIcon: ImageIcon(AssetImage(Assets.images.fieldName.path)), - label: 'Name', + label: context.i18n.fill_profile_input_name, controller: nameController.controller, validator: (String? value) => validateName(value!), showLeadingSeparator: true, @@ -147,7 +147,7 @@ class FillProfile extends HookConsumerWidget { InputField( leadingIcon: ImageIcon(AssetImage(Assets.images.fieldNickname.path)), - label: 'Nickname', + label: context.i18n.fill_profile_input_nickname, controller: nicknameController.controller, validator: (String? value) => validateNickname(value!), showLeadingSeparator: true, @@ -157,7 +157,7 @@ class FillProfile extends HookConsumerWidget { InputField( leadingIcon: ImageIcon(AssetImage(Assets.images.fieldInviter.path)), - label: 'Who invited you', + label: context.i18n.fill_profile_input_who_invited, controller: inviterController.controller, validator: (String? value) => validateWhoInvited(value!), showLeadingSeparator: true, @@ -174,7 +174,7 @@ class FillProfile extends HookConsumerWidget { size: 24, ), onPressed: onSave, - label: const Text('Save'), + label: Text(context.i18n.button_save), mainAxisSize: MainAxisSize.max, ), ), diff --git a/lib/app/features/auth/views/pages/intro_page/intro_page.dart b/lib/app/features/auth/views/pages/intro_page/intro_page.dart index d5eba8c21..bef3ba373 100644 --- a/lib/app/features/auth/views/pages/intro_page/intro_page.dart +++ b/lib/app/features/auth/views/pages/intro_page/intro_page.dart @@ -47,7 +47,7 @@ class IntroPage extends HookConsumerWidget { bottom: 10, ), child: Text( - 'The Global Currency Reset', + context.i18n.intro_title, style: TextStyle( fontSize: 36, fontWeight: FontWeight.w900, @@ -59,7 +59,7 @@ class IntroPage extends HookConsumerWidget { child: Align( alignment: Alignment.centerLeft, child: Text( - '#DecentralizedFuture', + context.i18n.intro_description, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w800, @@ -80,7 +80,7 @@ class IntroPage extends HookConsumerWidget { onPressed: () { showMyBottomSheet(context); }, - child: const Text('Continue'), + child: Text(context.i18n.button_continue), ), ), ), diff --git a/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart b/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart index bc4acbf57..fda8b926f 100644 --- a/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart +++ b/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:ice/app/constants/ui.dart'; +import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/features/auth/views/pages/nostr_login/nostr_login.dart'; import 'package:ice/app/shared/widgets/auth_header/auth_header.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; @@ -33,8 +34,8 @@ class NostrAuth extends HookConsumerWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AuthHeaderWidget( - title: 'Nostr', - description: 'Create an account or login using your existing one', + title: context.i18n.nostr_auth_title, + description: context.i18n.nostr_auth_description, ), Image.asset( Assets.images.ostrichlogo.path, @@ -56,7 +57,7 @@ class NostrAuth extends HookConsumerWidget { // ); }, type: ButtonType.outlined, - label: const Text('Create account'), + label: Text(context.i18n.button_create_account), mainAxisSize: MainAxisSize.max, ), ), @@ -75,7 +76,7 @@ class NostrAuth extends HookConsumerWidget { context, ); }, - label: const Text('Login'), + label: Text(context.i18n.button_login), mainAxisSize: MainAxisSize.max, ), ), diff --git a/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart b/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart index c75f62087..6a8785e04 100644 --- a/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart +++ b/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:ice/app/constants/ui.dart'; +import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/features/auth/views/pages/nostr_login/controllers/name_controller.dart'; import 'package:ice/app/shared/widgets/auth_header/auth_header.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; @@ -20,8 +21,8 @@ class NostrLogin extends HookConsumerWidget { child: Column( children: [ AuthHeaderWidget( - title: 'Nostr', - description: 'Enter your Nostr private key', + title: context.i18n.nostr_login_title, + description: context.i18n.nostr_login_description, ), const SizedBox( height: 15, @@ -40,7 +41,7 @@ class NostrLogin extends HookConsumerWidget { leadingIcon: ImageIcon( AssetImage(Assets.images.fieldPrivatekey.path), ), - label: 'Your Private Key', + label: context.i18n.nostr_login_input_private_key, controller: privateKeyController.controller, validator: (String? value) => privateKeyController.onVerify(), @@ -57,7 +58,7 @@ class NostrLogin extends HookConsumerWidget { ), onPressed: () {}, type: ButtonType.disabled, - label: const Text('Paste from clipboard'), + label: Text(context.i18n.button_paste), mainAxisSize: MainAxisSize.max, ), ), diff --git a/lib/app/features/auth/views/pages/select_country/select_country.dart b/lib/app/features/auth/views/pages/select_country/select_country.dart index 0ec85825f..2064d6062 100644 --- a/lib/app/features/auth/views/pages/select_country/select_country.dart +++ b/lib/app/features/auth/views/pages/select_country/select_country.dart @@ -35,7 +35,9 @@ class SelectCountries extends HookConsumerWidget { color: context.theme.appColors.secondaryBackground, child: Stack( children: [ - const NavigationHeader(title: 'Select country'), + NavigationHeader( + title: context.i18n.select_countries_nav_title, + ), Padding( padding: const EdgeInsets.only(top: navigationHeaderHeight), child: Column( diff --git a/lib/app/features/auth/views/pages/select_languages/select_languages.dart b/lib/app/features/auth/views/pages/select_languages/select_languages.dart index e44441e98..404c2d8a0 100644 --- a/lib/app/features/auth/views/pages/select_languages/select_languages.dart +++ b/lib/app/features/auth/views/pages/select_languages/select_languages.dart @@ -44,10 +44,9 @@ class SelectLanguages extends HookConsumerWidget { ), child: Column( children: [ - const TitleDescription( - title: 'Select languages', - description: - 'You’ll be shown content in the selected language', + TitleDescription( + title: context.i18n.select_languages_title, + description: context.i18n.select_languages_description, ), Padding( padding: const EdgeInsets.only(bottom: 12), diff --git a/lib/app/features/dapps/views/pages/dapps.dart b/lib/app/features/dapps/views/pages/dapps.dart index 0dc8f55fc..0f04c4dbc 100644 --- a/lib/app/features/dapps/views/pages/dapps.dart +++ b/lib/app/features/dapps/views/pages/dapps.dart @@ -27,24 +27,28 @@ class DAppsPage extends HookConsumerWidget { const Featured(), const Categories(), Apps( - title: 'Highest ranked', + title: context.i18n.dapps_section_title_highest_ranked, items: featured, onPress: () { router.go( '/dapps/appsList', - extra: - AppsRouteData(title: 'Highest ranked', items: featured), + extra: AppsRouteData( + title: context.i18n.dapps_section_title_highest_ranked, + items: featured, + ), ); }, ), Apps( - title: 'Recently added', + title: context.i18n.dapps_section_title_recently_added, items: featured, onPress: () { router.go( '/dapps/appsList', - extra: - AppsRouteData(title: 'Recently added', items: featured), + extra: AppsRouteData( + title: context.i18n.dapps_section_title_recently_added, + items: featured, + ), ); }, ), @@ -52,7 +56,10 @@ class DAppsPage extends HookConsumerWidget { onPress: () { router.go( '/dapps/appsList', - extra: AppsRouteData(title: 'Favorites', items: featured), + extra: AppsRouteData( + title: context.i18n.dapps_section_title_favourites, + items: featured, + ), ); }, ), diff --git a/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart b/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart index 55c765bc8..6cc25663f 100644 --- a/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart +++ b/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart @@ -32,8 +32,8 @@ class DAppsList extends HookConsumerWidget { color: context.theme.appColors.secondaryBackground, child: Stack( children: [ - const NavigationHeader( - title: 'DeFi', + NavigationHeader( + title: context.i18n.dapps_list_defi, ), Padding( padding: const EdgeInsets.only(top: navigationHeaderHeight), diff --git a/lib/app/features/dapps/views/pages/widgets/categories.dart b/lib/app/features/dapps/views/pages/widgets/categories.dart index c39af50d0..3a0040059 100644 --- a/lib/app/features/dapps/views/pages/widgets/categories.dart +++ b/lib/app/features/dapps/views/pages/widgets/categories.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/features/dapps/views/pages/widgets/categories_collection.dart'; import 'package:ice/app/shared/widgets/section_header/section_header.dart'; @@ -7,10 +8,10 @@ class Categories extends StatelessWidget { @override Widget build(BuildContext context) { - return const Column( + return Column( children: [ - SectionHeader(title: 'Categories'), - CategoriesCollection(), + SectionHeader(title: context.i18n.dapps_section_title_categories), + const CategoriesCollection(), ], ); } diff --git a/lib/app/features/dapps/views/pages/widgets/categories_collection.dart b/lib/app/features/dapps/views/pages/widgets/categories_collection.dart index 504ab54cd..8da726d29 100644 --- a/lib/app/features/dapps/views/pages/widgets/categories_collection.dart +++ b/lib/app/features/dapps/views/pages/widgets/categories_collection.dart @@ -15,24 +15,26 @@ class CategoryItem { final String title; } -List featured = [ - CategoryItem( - iconImage: Assets.images.defi.path, - title: 'DeFi', - ), - CategoryItem( - iconImage: Assets.images.marketplace.path, - title: 'Marketplaces', - ), - CategoryItem( - iconImage: Assets.images.nft.path, - title: 'NFTs', - ), - CategoryItem( - iconImage: Assets.images.games.path, - title: 'Games', - ), -]; +List getFeaturedCategories(BuildContext context) { + return [ + CategoryItem( + iconImage: Assets.images.defi.path, + title: context.i18n.dapps_category_defi, + ), + CategoryItem( + iconImage: Assets.images.marketplace.path, + title: context.i18n.dapps_category_marketplaces, + ), + CategoryItem( + iconImage: Assets.images.nft.path, + title: context.i18n.dapps_category_nft, + ), + CategoryItem( + iconImage: Assets.images.games.path, + title: context.i18n.dapps_category_games, + ), + ]; +} class CategoriesCollection extends StatelessWidget { const CategoriesCollection({super.key}); @@ -42,6 +44,7 @@ class CategoriesCollection extends StatelessWidget { final double screenWidth = MediaQuery.of(context).size.width; final double itemWidth = screenWidth * 0.213; final double itemHeight = itemWidth + textContainerHeight; + final List featured = getFeaturedCategories(context); return SizedBox( height: itemHeight, diff --git a/lib/app/features/dapps/views/pages/widgets/favourites.dart b/lib/app/features/dapps/views/pages/widgets/favourites.dart index c4f8c2896..d509f6479 100644 --- a/lib/app/features/dapps/views/pages/widgets/favourites.dart +++ b/lib/app/features/dapps/views/pages/widgets/favourites.dart @@ -49,13 +49,13 @@ class Favourites extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - 'Favourites', + context.i18n.dapps_section_title_favourites, style: context.theme.appTextThemes.body.copyWith( color: context.theme.appColors.primaryText, ), ), Text( - '17 added dApps', + context.i18n.dapps_favourites_added(17), style: context.theme.appTextThemes.caption3.copyWith( color: context.theme.appColors.secondaryText, ), diff --git a/lib/app/features/dapps/views/pages/widgets/featured.dart b/lib/app/features/dapps/views/pages/widgets/featured.dart index fbdd7b31d..9baba02b2 100644 --- a/lib/app/features/dapps/views/pages/widgets/featured.dart +++ b/lib/app/features/dapps/views/pages/widgets/featured.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/features/dapps/views/pages/mocks/mocked_featured.dart'; import 'package:ice/app/features/dapps/views/pages/widgets/featured_collection.dart'; import 'package:ice/app/shared/widgets/section_header/section_header.dart'; @@ -10,7 +11,7 @@ class Featured extends StatelessWidget { Widget build(BuildContext context) { return Column( children: [ - const SectionHeader(title: 'Featured'), + SectionHeader(title: context.i18n.dapps_section_title_featured), FeaturedCollection(items: featured), ], ); diff --git a/lib/app/shared/widgets/email_input.dart b/lib/app/shared/widgets/email_input.dart index 9e787347d..12505f6db 100644 --- a/lib/app/shared/widgets/email_input.dart +++ b/lib/app/shared/widgets/email_input.dart @@ -36,7 +36,7 @@ class EmailInput extends HookWidget { autovalidateMode: AutovalidateMode.onUserInteraction, focusNode: focusNode, decoration: InputDecoration( - labelText: 'Email address', + labelText: context.i18n.email_input_placeholder, prefixIcon: isFocused.value ? null : IntrinsicHeight( @@ -87,7 +87,7 @@ class EmailInput extends HookWidget { ), validator: (String? email) { if (email != null && !EmailValidator.validate(email)) { - return 'Invalid email format'; + return context.i18n.email_input_invalid_email_format; } return null; }, diff --git a/lib/app/shared/widgets/search/search.dart b/lib/app/shared/widgets/search/search.dart index 409e97a3a..965382b9a 100644 --- a/lib/app/shared/widgets/search/search.dart +++ b/lib/app/shared/widgets/search/search.dart @@ -59,7 +59,7 @@ class _SearchState extends State { borderRadius: BorderRadius.circular(16), ), controller: _controller, - placeholder: 'Search', + placeholder: context.i18n.search_placeholder, placeholderStyle: context.theme.appTextThemes.body.copyWith( color: context.theme.appColors.tertararyText, ), @@ -93,7 +93,7 @@ class _SearchState extends State { CupertinoButton( onPressed: _onCancelTapped, child: Text( - 'Cancel', + context.i18n.button_cancel, style: context.theme.appTextThemes.caption .copyWith(color: context.theme.appColors.primaryAccent), ), diff --git a/lib/app/shared/widgets/secured_by/secured_by.dart b/lib/app/shared/widgets/secured_by/secured_by.dart index e39d14a3a..d5fe2dfa2 100644 --- a/lib/app/shared/widgets/secured_by/secured_by.dart +++ b/lib/app/shared/widgets/secured_by/secured_by.dart @@ -11,12 +11,15 @@ class SecuredBy extends StatelessWidget { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('Secured by', style: context.theme.appTextThemes.caption), + Text( + context.i18n.secured_by, + style: context.theme.appTextThemes.caption, + ), const SizedBox(width: 5), Image.asset(Assets.images.iceIcon.path), const SizedBox(width: 3), Text( - 'ice', + context.i18n.secured_by_ice, style: context.theme.appTextThemes.headline1.copyWith(fontSize: 17), ), ], diff --git a/lib/app/shared/widgets/wallet_header/wallet_header.dart b/lib/app/shared/widgets/wallet_header/wallet_header.dart index 5fd55a5ba..17f3e0b65 100644 --- a/lib/app/shared/widgets/wallet_header/wallet_header.dart +++ b/lib/app/shared/widgets/wallet_header/wallet_header.dart @@ -63,7 +63,7 @@ class WalletHeader extends HookConsumerWidget { fit: BoxFit.cover, ), const SizedBox(width: 8), - const Text('ice.wallet'), + Text(context.i18n.wallet_header_ice_wallet), const SizedBox(width: 8), Image.asset( Assets.images.selectArrows.path, diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 165c64e8c..6124619ea 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1,6 +1,15 @@ { "hello": "Hello! {userName}", "button_continue": "Continue", + "button_follow": "Follow", + "button_following": "Following", + "button_save": "Save", + "button_cancel": "Cancel", + "button_create_account": "Create account", + "button_login": "Login", + "button_paste": "Paste from clipboard", + "intro_title": "The Global Currency Reset", + "intro_description": "#DecentralizedFuture", "auth_privacy": "By continuing, you are agreeing to our [[:link]]Terms of Service[[/:link]] & [[:link]]Privacy Policy[[/:link]]", "auth_signIn_title": "Get started", "auth_signIn_description": "Choose your login method", @@ -8,5 +17,44 @@ "auth_signIn_input_phone_number": "Phone number", "auth_signIn_button_email": "Continue with Email", "auth_signIn_button_phone_number": "Continue with Phone", - "auth_signIn_or": "or" + "auth_signIn_or": "or", + "check_email_title": "Check email", + "check_email_subtitle": "We emailed a magic link to", + "check_email_description": "Click the link and enter the code to log in or sign up.", + "discover_creators_title": "Discover creators", + "discover_creators_description": "Connect with visionaries and inspiring voices", + "enter_code_title": "Enter the code", + "enter_code_description": "Please enter the code sent to", + "enter_code_invalid_code": "Invalid code, please try again!", + "enter_code_available_in": "New code available in", + "fill_profile_title": "Your profile", + "fill_profile_description": "Customize your account", + "fill_profile_input_name": "Name", + "fill_profile_input_nickname": "Nickname", + "fill_profile_input_who_invited": "Who invited you", + "nostr_auth_title": "Nostr", + "nostr_auth_description": "Create an account or login using your existing one", + "nostr_login_title": "Nostr", + "nostr_login_description": "Enter your Nostr private key", + "nostr_login_input_private_key": "Your Private Key", + "select_countries_nav_title": "Select country", + "select_languages_title": "Select languages", + "select_languages_description": "You’ll be shown content in the selected language", + "dapps_list_defi": "DeFi", + "dapps_section_title_highest_ranked": "Highest ranked", + "dapps_section_title_recently_added": "Recently added", + "dapps_section_title_favourites": "Favorites", + "dapps_section_title_featured": "Featured", + "dapps_section_title_categories": "Categories", + "dapps_category_defi": "DeFi", + "dapps_category_marketplaces": "Marketplaces", + "dapps_category_nft": "NFTs", + "dapps_category_games": "Games", + "dapps_favourites_added": "{count} added dApps", + "search_placeholder": "Search", + "secured_by": "Secured by", + "secured_by_ice": "ice", + "wallet_header_ice_wallet": "ice.wallet", + "email_input_placeholder": "Email address", + "email_input_invalid_email_format": "Invalid email format" } From 457557a7fcbb785df7ef976228b062ce4e352425 Mon Sep 17 00:00:00 2001 From: ice-hector <96414297+ice-hector@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:18:42 +0200 Subject: [PATCH 3/5] refactor: shadow approach --- lib/app/constants/ui.dart | 11 ------ .../pages/widgets/featured_collection.dart | 36 ++++++++++--------- lib/app/shared/ShadowText/shadow_text.dart | 29 +++++++++++++++ 3 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 lib/app/shared/ShadowText/shadow_text.dart diff --git a/lib/app/constants/ui.dart b/lib/app/constants/ui.dart index e9d7ce4ea..e8a53ba7a 100644 --- a/lib/app/constants/ui.dart +++ b/lib/app/constants/ui.dart @@ -1,14 +1,3 @@ -import 'package:flutter/material.dart'; - const double kDefaultPadding = 44.0; const double kDefaultIconButtonSide = 44.0; const double kDefaultNavHeaderTopPadding = 50.0; - -const TextStyle shadowStyle = TextStyle( - shadows: [ - Shadow( - offset: Offset(0, 0.5), - color: Color.fromRGBO(0, 0, 0, 0.4), - ), - ], -); diff --git a/lib/app/features/dapps/views/pages/widgets/featured_collection.dart b/lib/app/features/dapps/views/pages/widgets/featured_collection.dart index a73c6b614..6dff20141 100644 --- a/lib/app/features/dapps/views/pages/widgets/featured_collection.dart +++ b/lib/app/features/dapps/views/pages/widgets/featured_collection.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; import 'package:ice/app/features/dapps/views/pages/mocks/mocked_apps.dart'; +import 'package:ice/app/shared/ShadowText/shadow_text.dart'; class FeaturedCollection extends StatelessWidget { const FeaturedCollection({super.key, required this.items}); @@ -62,23 +62,25 @@ class FeaturedCollection extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - items[index].title, - style: context.theme.appTextThemes.body - .copyWith( - color: context - .theme.appColors.secondaryBackground, - ) - .merge(shadowStyle), + ShadowText( + child: Text( + items[index].title, + style: + context.theme.appTextThemes.body.copyWith( + color: context + .theme.appColors.secondaryBackground, + ), + ), ), - Text( - items[index].description ?? '', - style: context.theme.appTextThemes.caption3 - .copyWith( - color: context - .theme.appColors.secondaryBackground, - ) - .merge(shadowStyle), + ShadowText( + child: Text( + items[index].description ?? '', + style: context.theme.appTextThemes.caption3 + .copyWith( + color: context + .theme.appColors.secondaryBackground, + ), + ), ), ], ), diff --git a/lib/app/shared/ShadowText/shadow_text.dart b/lib/app/shared/ShadowText/shadow_text.dart new file mode 100644 index 000000000..dd89ce0bd --- /dev/null +++ b/lib/app/shared/ShadowText/shadow_text.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; + +class ShadowText extends StatelessWidget { + const ShadowText({ + super.key, + required this.child, + TextStyle? shadowStyle, + }) : shadowStyle = shadowStyle ?? defaultShadowStyle; + + final Widget child; + final TextStyle shadowStyle; + + static const TextStyle defaultShadowStyle = TextStyle( + shadows: [ + Shadow( + offset: Offset(0, 0.5), + color: Color.fromRGBO(0, 0, 0, 0.4), + ), + ], + ); + + @override + Widget build(BuildContext context) { + return DefaultTextStyle( + style: shadowStyle, + child: child, + ); + } +} From 722279d33c26e22e73ce389ff4023a4b21629604 Mon Sep 17 00:00:00 2001 From: ice-hector <96414297+ice-hector@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:46:11 +0200 Subject: [PATCH 4/5] fix: pr comments --- lib/app/constants/ui.dart | 3 - .../auth/views/pages/auth_page/auth_page.dart | 5 +- .../views/pages/check_email/check_email.dart | 5 +- .../views/pages/enter_code/enter_code.dart | 237 +++++++++--------- .../pages/fill_profile/fill_profile.dart | 5 +- .../views/pages/nostr_auth/nostr_auth.dart | 5 +- .../views/pages/nostr_login/nostr_login.dart | 5 +- .../views/pages/dapps_list/dapps_list.dart | 61 ++--- .../shared/widgets/inputs/text_fields.dart | 12 +- .../nav_header_offset/nav_header_offset.dart | 23 ++ .../screen_side_offset.dart | 23 ++ lib/app/shared/widgets/socials/socials.dart | 8 +- 12 files changed, 218 insertions(+), 174 deletions(-) delete mode 100644 lib/app/constants/ui.dart create mode 100644 lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart create mode 100644 lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart diff --git a/lib/app/constants/ui.dart b/lib/app/constants/ui.dart deleted file mode 100644 index e8a53ba7a..000000000 --- a/lib/app/constants/ui.dart +++ /dev/null @@ -1,3 +0,0 @@ -const double kDefaultPadding = 44.0; -const double kDefaultIconButtonSide = 44.0; -const double kDefaultNavHeaderTopPadding = 50.0; diff --git a/lib/app/features/auth/views/pages/auth_page/auth_page.dart b/lib/app/features/auth/views/pages/auth_page/auth_page.dart index d637d0605..387800187 100644 --- a/lib/app/features/auth/views/pages/auth_page/auth_page.dart +++ b/lib/app/features/auth/views/pages/auth_page/auth_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; import 'package:ice/app/features/auth/data/models/auth_state.dart'; @@ -21,6 +20,7 @@ import 'package:ice/app/shared/widgets/auth_header/auth_header.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; import 'package:ice/app/shared/widgets/inputs/text_fields.dart'; import 'package:ice/app/shared/widgets/modal_wrapper.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/app/shared/widgets/secured_by/secured_by.dart'; import 'package:ice/app/shared/widgets/socials/socials.dart'; import 'package:ice/app/shared/widgets/terms_privacy/terms_privacy.dart'; @@ -53,8 +53,7 @@ class AuthPage extends HookConsumerWidget { final PhoneNumberController numberController = PhoneNumberController(); return Scaffold( - body: Container( - margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding), + body: ScreenSideOffset( child: Column( children: [ AuthHeaderWidget( diff --git a/lib/app/features/auth/views/pages/check_email/check_email.dart b/lib/app/features/auth/views/pages/check_email/check_email.dart index e0bdeca47..b971c6bb6 100644 --- a/lib/app/features/auth/views/pages/check_email/check_email.dart +++ b/lib/app/features/auth/views/pages/check_email/check_email.dart @@ -2,9 +2,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/app/shared/widgets/terms_privacy/terms_privacy.dart'; import 'package:ice/generated/assets.gen.dart'; import 'package:pin_code_fields/pin_code_fields.dart'; @@ -21,8 +21,7 @@ class CheckEmail extends HookConsumerWidget { TextEditingController(text: '1234'); return Scaffold( - body: Container( - margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding), + body: ScreenSideOffset( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/app/features/auth/views/pages/enter_code/enter_code.dart b/lib/app/features/auth/views/pages/enter_code/enter_code.dart index 571968f9d..c3c3246eb 100644 --- a/lib/app/features/auth/views/pages/enter_code/enter_code.dart +++ b/lib/app/features/auth/views/pages/enter_code/enter_code.dart @@ -3,9 +3,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/app/shared/widgets/terms_privacy/terms_privacy.dart'; import 'package:ice/generated/assets.gen.dart'; import 'package:pin_code_fields/pin_code_fields.dart'; @@ -24,127 +24,130 @@ class EnterCode extends HookConsumerWidget { final ValueNotifier invalidCode = useState(false); return Scaffold( - body: Container( - margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding), - alignment: Alignment.center, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - const SizedBox( - height: 65, - ), - Image.asset( - Assets.images.enterCode.path, - ), - const SizedBox( - height: 9, - ), - Text( - context.i18n.enter_code_title, - style: context.theme.appTextThemes.headline1, - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(context.i18n.enter_code_description), - Text( - phoneNumber, - style: context.theme.appTextThemes.subtitle, - ), - Padding( - padding: const EdgeInsets.only(top: 30, bottom: 19), - child: SizedBox( - width: 248, - child: PinCodeTextField( - appContext: context, - length: 4, - animationType: AnimationType.fade, - cursorColor: Colors.black, - cursorWidth: 3, - cursorHeight: 25, - textStyle: context.theme.appTextThemes.inputFieldText, - pinTheme: PinTheme( - shape: PinCodeFieldShape.box, - borderRadius: BorderRadius.circular(16), - fieldHeight: 56, - fieldWidth: 50, - borderWidth: 1, - inactiveColor: invalidCode.value - ? context.theme.appColors.attentionRed - : context.theme.appColors.strokeElements, - disabledColor: context.theme.appColors.strokeElements, - activeColor: invalidCode.value - ? context.theme.appColors.attentionRed - : context.theme.appColors.primaryAccent, - errorBorderColor: context.theme.appColors.attentionRed, - activeFillColor: Colors.white, - inactiveFillColor: Colors.white, - selectedFillColor: Colors.white, - errorBorderWidth: 1, - activeBorderWidth: 1, - inactiveBorderWidth: 1, - disabledBorderWidth: 1, - selectedBorderWidth: 1, + body: ScreenSideOffset( + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + const SizedBox( + height: 65, + ), + Image.asset( + Assets.images.enterCode.path, + ), + const SizedBox( + height: 9, + ), + Text( + context.i18n.enter_code_title, + style: context.theme.appTextThemes.headline1, + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(context.i18n.enter_code_description), + Text( + phoneNumber, + style: context.theme.appTextThemes.subtitle, + ), + Padding( + padding: const EdgeInsets.only(top: 30, bottom: 19), + child: SizedBox( + width: 248, + child: PinCodeTextField( + appContext: context, + length: 4, + animationType: AnimationType.fade, + cursorColor: Colors.black, + cursorWidth: 3, + cursorHeight: 25, + textStyle: context.theme.appTextThemes.inputFieldText, + pinTheme: PinTheme( + shape: PinCodeFieldShape.box, + borderRadius: BorderRadius.circular(16), + fieldHeight: 56, + fieldWidth: 50, + borderWidth: 1, + inactiveColor: invalidCode.value + ? context.theme.appColors.attentionRed + : context.theme.appColors.strokeElements, + disabledColor: context.theme.appColors.strokeElements, + activeColor: invalidCode.value + ? context.theme.appColors.attentionRed + : context.theme.appColors.primaryAccent, + errorBorderColor: + context.theme.appColors.attentionRed, + activeFillColor: Colors.white, + inactiveFillColor: Colors.white, + selectedFillColor: Colors.white, + errorBorderWidth: 1, + activeBorderWidth: 1, + inactiveBorderWidth: 1, + disabledBorderWidth: 1, + selectedBorderWidth: 1, + ), + animationDuration: const Duration(milliseconds: 300), + keyboardType: TextInputType.number, + errorAnimationController: errorController, + controller: codeController, + onCompleted: (String completed) { + if (completed != '1111') { + invalidCode.value = true; + errorController.add( + ErrorAnimationType.shake, + ); + } else { + invalidCode.value = false; + } + }, + onChanged: (String text) { + if (invalidCode.value) { + invalidCode.value = false; + } + }, + beforeTextPaste: (String? text) { + return true; + }, ), - animationDuration: const Duration(milliseconds: 300), - keyboardType: TextInputType.number, - errorAnimationController: errorController, - controller: codeController, - onCompleted: (String completed) { - if (completed != '1111') { - invalidCode.value = true; - errorController.add( - ErrorAnimationType.shake, - ); - } else { - invalidCode.value = false; - } - }, - onChanged: (String text) { - if (invalidCode.value) { - invalidCode.value = false; - } - }, - beforeTextPaste: (String? text) { - return true; - }, ), ), - ), - if (invalidCode.value) + if (invalidCode.value) + Text( + context.i18n.enter_code_invalid_code, + style: context.theme.appTextThemes.body.copyWith( + color: context.theme.appColors.attentionRed, + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + context.i18n.enter_code_available_in, + style: context.theme.appTextThemes.subtitle2, + ), Text( - context.i18n.enter_code_invalid_code, - style: context.theme.appTextThemes.body - .copyWith(color: context.theme.appColors.attentionRed), + ' 30s', // TODO: Add countdown timer + style: context.theme.appTextThemes.subtitle2 + .copyWith(color: context.theme.appColors.primaryAccent), ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - context.i18n.enter_code_available_in, - style: context.theme.appTextThemes.subtitle2, - ), - Text( - ' 30s', // TODO: Add countdown timer - style: context.theme.appTextThemes.subtitle2 - .copyWith(color: context.theme.appColors.primaryAccent), - ), - ], - ), - Image.asset( - Assets.images.iceRound.path, - ), - const Padding( - padding: EdgeInsets.only(bottom: 48), - child: TermsPrivacy(), - ), - ], + ], + ), + Image.asset( + Assets.images.iceRound.path, + ), + const Padding( + padding: EdgeInsets.only(bottom: 48), + child: TermsPrivacy(), + ), + ], + ), ), ), ); diff --git a/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart b/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart index 27a86401f..6e30517c4 100644 --- a/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart +++ b/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; import 'package:ice/app/features/auth/views/pages/fill_profile/controllers/inviter_controller.dart'; @@ -12,6 +11,7 @@ import 'package:ice/app/features/auth/views/pages/fill_profile/validators.dart'; import 'package:ice/app/shared/utility/image_picker_and_cropper/image_picker_and_cropper.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; import 'package:ice/app/shared/widgets/inputs/text_fields.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/app/shared/widgets/text_field_wrapper/text_field_wrapper.dart'; import 'package:ice/generated/assets.gen.dart'; import 'package:image_cropper/image_cropper.dart'; @@ -83,8 +83,7 @@ class FillProfile extends HookConsumerWidget { return Scaffold( body: SingleChildScrollView( - child: Container( - margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding), + child: ScreenSideOffset( child: Column( children: [ const SizedBox( diff --git a/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart b/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart index fda8b926f..904a4da8e 100644 --- a/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart +++ b/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/features/auth/views/pages/nostr_login/nostr_login.dart'; import 'package:ice/app/shared/widgets/auth_header/auth_header.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; import 'package:ice/app/shared/widgets/modal_wrapper.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/generated/assets.gen.dart'; class NostrAuth extends HookConsumerWidget { @@ -28,8 +28,7 @@ class NostrAuth extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return Scaffold( - body: Container( - margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding), + body: ScreenSideOffset( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart b/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart index 6a8785e04..71d98dff5 100644 --- a/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart +++ b/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/features/auth/views/pages/nostr_login/controllers/name_controller.dart'; import 'package:ice/app/shared/widgets/auth_header/auth_header.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; import 'package:ice/app/shared/widgets/inputs/text_fields.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/generated/assets.gen.dart'; class NostrLogin extends HookConsumerWidget { @@ -16,8 +16,7 @@ class NostrLogin extends HookConsumerWidget { final PrivateKeyController privateKeyController = PrivateKeyController(); return Scaffold( body: SingleChildScrollView( - child: Container( - margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding), + child: ScreenSideOffset( child: Column( children: [ AuthHeaderWidget( diff --git a/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart b/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart index 6cc25663f..5687b5680 100644 --- a/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart +++ b/lib/app/features/dapps/views/pages/dapps_list/dapps_list.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; import 'package:ice/app/features/dapps/views/pages/mocks/mocked_apps.dart'; import 'package:ice/app/features/dapps/views/pages/widgets/apps_collection.dart'; +import 'package:ice/app/shared/widgets/nav_header_offset/nav_header_offset.dart'; import 'package:ice/app/shared/widgets/navigation_header/navigation_header.dart'; import 'package:ice/app/shared/widgets/search/search.dart'; @@ -26,37 +26,38 @@ class DAppsList extends HookConsumerWidget { }).toList(); return Scaffold( - body: Container( - margin: const EdgeInsets.only(top: kDefaultNavHeaderTopPadding), - width: double.infinity, - color: context.theme.appColors.secondaryBackground, - child: Stack( - children: [ - NavigationHeader( - title: context.i18n.dapps_list_defi, - ), - Padding( - padding: const EdgeInsets.only(top: navigationHeaderHeight), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Search( - onTextChanged: (String value) => searchText.value = value, - onClearText: () => searchText.value = '', - ), - Expanded( - child: ListView.builder( - itemCount: filteredApps.length, - itemBuilder: (BuildContext context, int index) { - final DAppItem app = filteredApps[index]; - return DAppGridItem(item: app, showIsFavourite: true); - }, + body: NavHeaderOffset( + child: Container( + width: double.infinity, + color: context.theme.appColors.secondaryBackground, + child: Stack( + children: [ + NavigationHeader( + title: context.i18n.dapps_list_defi, + ), + Padding( + padding: const EdgeInsets.only(top: navigationHeaderHeight), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Search( + onTextChanged: (String value) => searchText.value = value, + onClearText: () => searchText.value = '', + ), + Expanded( + child: ListView.builder( + itemCount: filteredApps.length, + itemBuilder: (BuildContext context, int index) { + final DAppItem app = filteredApps[index]; + return DAppGridItem(item: app, showIsFavourite: true); + }, + ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/app/shared/widgets/inputs/text_fields.dart b/lib/app/shared/widgets/inputs/text_fields.dart index e97100223..ddbd52a4e 100644 --- a/lib/app/shared/widgets/inputs/text_fields.dart +++ b/lib/app/shared/widgets/inputs/text_fields.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; import 'package:ice/app/shared/widgets/decorators.dart'; import 'package:ice/app/shared/widgets/inputs/input_field_controller.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/app/utils/extensions.dart'; import 'package:ice/app/values/borders.dart'; import 'package:ice/app/values/constants.dart'; @@ -215,8 +215,8 @@ class InputFormField extends FormField { height: 34, child: TextFormField( scrollPadding: EdgeInsets.only( - bottom: controller.scrollPadding.zeroOrValue + - kDefaultPadding, + bottom: + controller.scrollPadding.zeroOrValue + kDefaultMargin, ), enabled: controller.enabled, controller: textController, @@ -244,7 +244,7 @@ class InputFormField extends FormField { focusedErrorBorder: InputFieldBorder(), label: Padding( padding: - const EdgeInsets.only(bottom: kDefaultPadding / 2), + const EdgeInsets.only(bottom: kDefaultMargin / 2), child: Text( label, style: context.theme.appTextThemes.subtitle.copyWith( @@ -292,7 +292,7 @@ class InputFormField extends FormField { children: [ field, Padding( - padding: EdgeInsets.only(left: kDefaultPadding, top: 4.0.s), + padding: EdgeInsets.only(left: kDefaultMargin, top: 4.0.s), child: Text( error, overflow: TextOverflow.ellipsis, @@ -357,7 +357,7 @@ class TextFieldToEdit extends StatelessWidget { height: 56.0.s, color: _kBackgroundColor, child: Padding( - padding: const EdgeInsets.all(kDefaultPadding), + padding: const EdgeInsets.all(kDefaultMargin), child: Row( children: [ Expanded( diff --git a/lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart b/lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart new file mode 100644 index 000000000..65b98b3b0 --- /dev/null +++ b/lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +const double kDefaultNavHeaderTopPadding = 50.0; +const EdgeInsets defaultInsets = + EdgeInsets.only(top: kDefaultNavHeaderTopPadding); + +class NavHeaderOffset extends StatelessWidget { + const NavHeaderOffset({ + super.key, + required this.child, + EdgeInsets? insets, + }) : insets = insets ?? defaultInsets; + final Widget child; + final EdgeInsets insets; + + @override + Widget build(BuildContext context) { + return Container( + margin: insets, + child: child, + ); + } +} diff --git a/lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart b/lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart new file mode 100644 index 000000000..fb7741caa --- /dev/null +++ b/lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +const double kDefaultMargin = 44.0; +const EdgeInsets defaultInsets = + EdgeInsets.symmetric(horizontal: kDefaultMargin); + +class ScreenSideOffset extends StatelessWidget { + const ScreenSideOffset({ + super.key, + required this.child, + EdgeInsets? insets, + }) : insets = insets ?? defaultInsets; + final Widget child; + final EdgeInsets insets; + + @override + Widget build(BuildContext context) { + return Container( + margin: insets, + child: child, + ); + } +} diff --git a/lib/app/shared/widgets/socials/socials.dart b/lib/app/shared/widgets/socials/socials.dart index 3a548097c..158578092 100644 --- a/lib/app/shared/widgets/socials/socials.dart +++ b/lib/app/shared/widgets/socials/socials.dart @@ -1,11 +1,13 @@ import 'package:flutter/material.dart'; -import 'package:ice/app/constants/ui.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; +import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/generated/assets.gen.dart'; enum SocialButtonType { apple, nostr, x, expand, fb, github, discord, linkedin } +const double kDefaultSocialIconButtonSide = 44.0; + Map socialIcons = { SocialButtonType.apple: Assets.images.apple.path, SocialButtonType.nostr: Assets.images.nostr.path, @@ -49,9 +51,9 @@ class _SocialsState extends State { final double screenWidth = MediaQuery.of(context).size.width; final double buttonWidth = context.theme.iconButtonTheme.style?.iconSize ?.resolve({}) ?? - kDefaultIconButtonSide; + kDefaultSocialIconButtonSide; final double spaceBetweenButtons = - (screenWidth - 2 * kDefaultPadding - 4 * buttonWidth) / 3; + (screenWidth - 2 * kDefaultMargin - 4 * buttonWidth) / 3; return Column( children: [ From 9a1b132697693d30fa47f59dc5868131818ba698 Mon Sep 17 00:00:00 2001 From: ice-hector <96414297+ice-hector@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:02:22 +0200 Subject: [PATCH 5/5] fix: pr comments --- .../auth/views/pages/auth_page/auth_page.dart | 2 +- .../views/pages/check_email/check_email.dart | 2 +- .../views/pages/enter_code/enter_code.dart | 2 +- .../pages/fill_profile/fill_profile.dart | 2 +- .../views/pages/nostr_auth/nostr_auth.dart | 2 +- .../views/pages/nostr_login/nostr_login.dart | 2 +- .../shared/widgets/inputs/text_fields.dart | 16 ++++---- .../nav_header_offset/nav_header_offset.dart | 8 ++-- .../screen_side_offset.dart | 40 ++++++++++++++++--- lib/app/shared/widgets/socials/socials.dart | 7 ++-- 10 files changed, 57 insertions(+), 26 deletions(-) diff --git a/lib/app/features/auth/views/pages/auth_page/auth_page.dart b/lib/app/features/auth/views/pages/auth_page/auth_page.dart index 387800187..bb1b5eaaa 100644 --- a/lib/app/features/auth/views/pages/auth_page/auth_page.dart +++ b/lib/app/features/auth/views/pages/auth_page/auth_page.dart @@ -53,7 +53,7 @@ class AuthPage extends HookConsumerWidget { final PhoneNumberController numberController = PhoneNumberController(); return Scaffold( - body: ScreenSideOffset( + body: ScreenSideOffset.large( child: Column( children: [ AuthHeaderWidget( diff --git a/lib/app/features/auth/views/pages/check_email/check_email.dart b/lib/app/features/auth/views/pages/check_email/check_email.dart index b971c6bb6..aacab2879 100644 --- a/lib/app/features/auth/views/pages/check_email/check_email.dart +++ b/lib/app/features/auth/views/pages/check_email/check_email.dart @@ -21,7 +21,7 @@ class CheckEmail extends HookConsumerWidget { TextEditingController(text: '1234'); return Scaffold( - body: ScreenSideOffset( + body: ScreenSideOffset.large( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/app/features/auth/views/pages/enter_code/enter_code.dart b/lib/app/features/auth/views/pages/enter_code/enter_code.dart index c3c3246eb..c02ab255b 100644 --- a/lib/app/features/auth/views/pages/enter_code/enter_code.dart +++ b/lib/app/features/auth/views/pages/enter_code/enter_code.dart @@ -24,7 +24,7 @@ class EnterCode extends HookConsumerWidget { final ValueNotifier invalidCode = useState(false); return Scaffold( - body: ScreenSideOffset( + body: ScreenSideOffset.large( child: Container( alignment: Alignment.center, child: Column( diff --git a/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart b/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart index 6e30517c4..7ade87b11 100644 --- a/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart +++ b/lib/app/features/auth/views/pages/fill_profile/fill_profile.dart @@ -83,7 +83,7 @@ class FillProfile extends HookConsumerWidget { return Scaffold( body: SingleChildScrollView( - child: ScreenSideOffset( + child: ScreenSideOffset.large( child: Column( children: [ const SizedBox( diff --git a/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart b/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart index 904a4da8e..b51b709d3 100644 --- a/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart +++ b/lib/app/features/auth/views/pages/nostr_auth/nostr_auth.dart @@ -28,7 +28,7 @@ class NostrAuth extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return Scaffold( - body: ScreenSideOffset( + body: ScreenSideOffset.large( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart b/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart index 71d98dff5..f998565dd 100644 --- a/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart +++ b/lib/app/features/auth/views/pages/nostr_login/nostr_login.dart @@ -16,7 +16,7 @@ class NostrLogin extends HookConsumerWidget { final PrivateKeyController privateKeyController = PrivateKeyController(); return Scaffold( body: SingleChildScrollView( - child: ScreenSideOffset( + child: ScreenSideOffset.large( child: Column( children: [ AuthHeaderWidget( diff --git a/lib/app/shared/widgets/inputs/text_fields.dart b/lib/app/shared/widgets/inputs/text_fields.dart index ddbd52a4e..49cb0d4d2 100644 --- a/lib/app/shared/widgets/inputs/text_fields.dart +++ b/lib/app/shared/widgets/inputs/text_fields.dart @@ -1,16 +1,17 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/extensions/theme_data.dart'; import 'package:ice/app/shared/widgets/decorators.dart'; import 'package:ice/app/shared/widgets/inputs/input_field_controller.dart'; -import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; import 'package:ice/app/utils/extensions.dart'; import 'package:ice/app/values/borders.dart'; import 'package:ice/app/values/constants.dart'; import 'package:ice/generated/assets.gen.dart'; const Color _kBackgroundColor = Color(0xFFFFFFFF); +double defaultTextFieldMargin = 44.0.w; class InputField extends StatefulWidget { InputField({ @@ -215,8 +216,8 @@ class InputFormField extends FormField { height: 34, child: TextFormField( scrollPadding: EdgeInsets.only( - bottom: - controller.scrollPadding.zeroOrValue + kDefaultMargin, + bottom: controller.scrollPadding.zeroOrValue + + defaultTextFieldMargin, ), enabled: controller.enabled, controller: textController, @@ -243,8 +244,9 @@ class InputFormField extends FormField { errorBorder: InputFieldBorder(), focusedErrorBorder: InputFieldBorder(), label: Padding( - padding: - const EdgeInsets.only(bottom: kDefaultMargin / 2), + padding: EdgeInsets.only( + bottom: defaultTextFieldMargin / 2, + ), child: Text( label, style: context.theme.appTextThemes.subtitle.copyWith( @@ -292,7 +294,7 @@ class InputFormField extends FormField { children: [ field, Padding( - padding: EdgeInsets.only(left: kDefaultMargin, top: 4.0.s), + padding: EdgeInsets.only(left: defaultTextFieldMargin, top: 4.0.s), child: Text( error, overflow: TextOverflow.ellipsis, @@ -357,7 +359,7 @@ class TextFieldToEdit extends StatelessWidget { height: 56.0.s, color: _kBackgroundColor, child: Padding( - padding: const EdgeInsets.all(kDefaultMargin), + padding: EdgeInsets.all(defaultTextFieldMargin), child: Row( children: [ Expanded( diff --git a/lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart b/lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart index 65b98b3b0..602efd3a1 100644 --- a/lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart +++ b/lib/app/shared/widgets/nav_header_offset/nav_header_offset.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; -const double kDefaultNavHeaderTopPadding = 50.0; -const EdgeInsets defaultInsets = - EdgeInsets.only(top: kDefaultNavHeaderTopPadding); +double defaultNavHeaderTopPadding = 50.0.w; +EdgeInsets defaultInsets = EdgeInsets.only(top: defaultNavHeaderTopPadding); class NavHeaderOffset extends StatelessWidget { - const NavHeaderOffset({ + NavHeaderOffset({ super.key, required this.child, EdgeInsets? insets, diff --git a/lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart b/lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart index fb7741caa..09f7d28a3 100644 --- a/lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart +++ b/lib/app/shared/widgets/screen_side_offset/screen_side_offset.dart @@ -1,15 +1,43 @@ import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; -const double kDefaultMargin = 44.0; -const EdgeInsets defaultInsets = - EdgeInsets.symmetric(horizontal: kDefaultMargin); +double defaultLargeMargin = 44.0.w; +double defaultSmallMargin = 16.0.w; class ScreenSideOffset extends StatelessWidget { - const ScreenSideOffset({ + const ScreenSideOffset._({ super.key, required this.child, - EdgeInsets? insets, - }) : insets = insets ?? defaultInsets; + required this.insets, + }); + + // Factory constructor for large margin + factory ScreenSideOffset.large({ + Key? key, + required Widget child, + }) { + final EdgeInsets defaultLargeInsets = + EdgeInsets.symmetric(horizontal: defaultLargeMargin); + return ScreenSideOffset._( + key: key, + insets: defaultLargeInsets, + child: child, + ); + } + + // Factory constructor for small margin + factory ScreenSideOffset.small({ + Key? key, + required Widget child, + }) { + final EdgeInsets defaultSmallInsets = + EdgeInsets.symmetric(horizontal: defaultSmallMargin); + return ScreenSideOffset._( + key: key, + insets: defaultSmallInsets, + child: child, + ); + } final Widget child; final EdgeInsets insets; diff --git a/lib/app/shared/widgets/socials/socials.dart b/lib/app/shared/widgets/socials/socials.dart index 158578092..5d5dd6d44 100644 --- a/lib/app/shared/widgets/socials/socials.dart +++ b/lib/app/shared/widgets/socials/socials.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:ice/app/extensions/build_context.dart'; import 'package:ice/app/shared/widgets/button/button.dart'; import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; @@ -6,7 +7,7 @@ import 'package:ice/generated/assets.gen.dart'; enum SocialButtonType { apple, nostr, x, expand, fb, github, discord, linkedin } -const double kDefaultSocialIconButtonSide = 44.0; +double defaultSocialIconButtonSide = 44.0.w; Map socialIcons = { SocialButtonType.apple: Assets.images.apple.path, @@ -51,9 +52,9 @@ class _SocialsState extends State { final double screenWidth = MediaQuery.of(context).size.width; final double buttonWidth = context.theme.iconButtonTheme.style?.iconSize ?.resolve({}) ?? - kDefaultSocialIconButtonSide; + defaultSocialIconButtonSide; final double spaceBetweenButtons = - (screenWidth - 2 * kDefaultMargin - 4 * buttonWidth) / 3; + (screenWidth - 2 * defaultLargeMargin - 4 * buttonWidth) / 3; return Column( children: [