From d31cc55b22d602f700d6fdec273876a961bd295a Mon Sep 17 00:00:00 2001 From: Mohammed Mohsin <59914433+mdmohsin7@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:51:41 +0530 Subject: [PATCH] set line length to 120 --- lib/components/error_dialog.dart | 12 +- lib/components/full_page_error_indicator.dart | 11 +- lib/components/member_info_row.dart | 8 +- lib/components/search_result_row.dart | 9 +- lib/components/search_user/search_user.dart | 14 +- .../select_picture_box.dart | 6 +- lib/components/text_form_field_custom.dart | 8 +- .../remote/api/esr_callback_repository.dart | 3 +- .../remote/api/stat_repository.dart | 6 +- lib/design/app_theme.dart | 263 +++++++----------- .../account_under_recovery_screen.dart | 10 +- ...rdian_approve_or_deny_recovery_screen.dart | 13 +- .../import_key_accounts_widget.dart | 25 +- .../import_words_accounts_widget.dart | 22 +- .../import_key/import_key_screen.dart | 50 ++-- .../import_key/import_words_screen.dart | 59 ++-- lib/screens/authentication/login_screen.dart | 43 +-- .../components/onboarding_pages.dart | 12 +- .../onboarding/onboarding_screen.dart | 10 +- .../components/guardian_row_widget.dart | 11 +- .../recover_account_found_screen.dart | 147 +++------- .../components/invite_link_fail_dialog.dart | 3 +- .../components/passcode_created_dialog.dart | 9 +- .../components/passcode_screen.dart | 22 +- .../verification/verification_screen.dart | 41 +-- .../components/flag_user_info_dialog.dart | 6 +- .../flag_user_confirmation_dialog.dart | 20 +- .../components/remove_flag_info_dialog.dart | 6 +- .../invite/components/invite_link_dialog.dart | 19 +- .../explore_screens/invite/invite_screen.dart | 27 +- .../components/claimed_invite_row.dart | 9 +- .../plant_seeds_success_dialog.dart | 19 +- .../plant_seeds/plant_seeds_screen.dart | 36 +-- .../vouch_for_member_confirmation_dialog.dart | 20 +- .../not_qualified_to_vouch_dialog.dart | 6 +- .../citizenship/components/resident_view.dart | 90 +++--- .../receive_seeds_invoice_use_case.dart | 13 +- .../mappers/send_amount_change_mapper.dart | 22 +- lib/seeds_app.dart | 45 +-- 39 files changed, 367 insertions(+), 788 deletions(-) diff --git a/lib/components/error_dialog.dart b/lib/components/error_dialog.dart index 3ae9d6148..58a9b9ff3 100644 --- a/lib/components/error_dialog.dart +++ b/lib/components/error_dialog.dart @@ -8,22 +8,16 @@ class ErrorDialog extends StatelessWidget { final String details; final VoidCallback? onRightButtonPressed; - const ErrorDialog( - {super.key, - required this.title, - required this.details, - this.onRightButtonPressed}); + const ErrorDialog({super.key, required this.title, required this.details, this.onRightButtonPressed}); Future show(BuildContext context) { - return showDialog( - context: context, barrierDismissible: false, builder: (_) => this); + return showDialog(context: context, barrierDismissible: false, builder: (_) => this); } @override Widget build(BuildContext context) { return CustomDialog( - icon: const CustomPaint( - size: Size(60, 60), painter: RedExclamationCircle()), + icon: const CustomPaint(size: Size(60, 60), painter: RedExclamationCircle()), rightButtonTitle: 'Retry', onRightButtonPressed: () { Navigator.of(context).pop(); diff --git a/lib/components/full_page_error_indicator.dart b/lib/components/full_page_error_indicator.dart index 582051035..66ccf72f8 100644 --- a/lib/components/full_page_error_indicator.dart +++ b/lib/components/full_page_error_indicator.dart @@ -8,8 +8,7 @@ class FullPageErrorIndicator extends StatelessWidget { final String? buttonTitle; final VoidCallback? buttonOnPressed; - const FullPageErrorIndicator( - {this.errorMessage, this.buttonTitle, this.buttonOnPressed, super.key}); + const FullPageErrorIndicator({this.errorMessage, this.buttonTitle, this.buttonOnPressed, super.key}); @override Widget build(BuildContext context) { @@ -20,10 +19,7 @@ class FullPageErrorIndicator extends StatelessWidget { child: Center( child: Text( errorMessage ?? GlobalError.unknown.localizedDescription(context), - style: Theme.of(context) - .textTheme - .titleSmall! - .copyWith(color: AppColors.red1), + style: Theme.of(context).textTheme.titleSmall!.copyWith(color: AppColors.red1), ), ), ), @@ -31,8 +27,7 @@ class FullPageErrorIndicator extends StatelessWidget { if (buttonTitle != null && buttonOnPressed != null) Padding( padding: const EdgeInsets.fromLTRB(16, 16, 16, 16), - child: - FlatButtonLong(title: buttonTitle!, onPressed: buttonOnPressed), + child: FlatButtonLong(title: buttonTitle!, onPressed: buttonOnPressed), ), ]); } diff --git a/lib/components/member_info_row.dart b/lib/components/member_info_row.dart index 43b56a2e2..477549380 100644 --- a/lib/components/member_info_row.dart +++ b/lib/components/member_info_row.dart @@ -31,9 +31,7 @@ class MemberInfoRow extends StatelessWidget { children: [ Flexible( child: Text( - member.nickname.isNotEmpty - ? member.nickname - : member.account, + member.nickname.isNotEmpty ? member.nickname : member.account, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.labelLarge, ), @@ -45,9 +43,7 @@ class MemberInfoRow extends StatelessWidget { ], ), const SizedBox(height: 8), - Text(member.account, - style: - Theme.of(context).textTheme.subtitle2OpacityEmphasis) + Text(member.account, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis) ], ), ), diff --git a/lib/components/search_result_row.dart b/lib/components/search_result_row.dart index 5e7c997fc..c3fd52a52 100644 --- a/lib/components/search_result_row.dart +++ b/lib/components/search_result_row.dart @@ -34,9 +34,7 @@ class SearchResultRow extends StatelessWidget { children: [ Flexible( child: Text( - member.nickname.isNotEmpty - ? member.nickname - : member.account, + member.nickname.isNotEmpty ? member.nickname : member.account, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.labelLarge, ), @@ -49,10 +47,7 @@ class SearchResultRow extends StatelessWidget { ], ), const SizedBox(height: 8), - Text(member.account, - style: Theme.of(context) - .textTheme - .subtitle2OpacityEmphasis) + Text(member.account, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis) ], ), ), diff --git a/lib/components/search_user/search_user.dart b/lib/components/search_user/search_user.dart index 911b95fc6..bd0a886fc 100644 --- a/lib/components/search_user/search_user.dart +++ b/lib/components/search_user/search_user.dart @@ -29,16 +29,12 @@ class SearchUser extends StatelessWidget { child: Column( children: [ const Padding( - padding: EdgeInsets.only( - right: horizontalEdgePadding, - left: horizontalEdgePadding, - top: 10), + padding: EdgeInsets.only(right: horizontalEdgePadding, left: horizontalEdgePadding, top: 10), child: SearchUserTextField(), ), if (title != null) Padding( - padding: - const EdgeInsets.symmetric(horizontal: horizontalEdgePadding), + padding: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding), child: Align( alignment: Alignment.centerLeft, child: Column( @@ -56,12 +52,10 @@ class SearchUser extends StatelessWidget { case PageState.loading: case PageState.failure: case PageState.success: - if (state.pageState == PageState.success && - state.users.isEmpty) { + if (state.pageState == PageState.success && state.users.isEmpty) { return Padding( padding: const EdgeInsets.all(16.0), - child: Center( - child: Text(context.loc.searchUserNoUserFound)), + child: Center(child: Text(context.loc.searchUserNoUserFound)), ); } else { return Expanded( diff --git a/lib/components/select_picture_box/select_picture_box.dart b/lib/components/select_picture_box/select_picture_box.dart index b8ee6b68a..1795933e2 100644 --- a/lib/components/select_picture_box/select_picture_box.dart +++ b/lib/components/select_picture_box/select_picture_box.dart @@ -34,11 +34,7 @@ class SelectPictureBox extends StatelessWidget { dashPattern: [8, 4], strokeWidth: 2, color: AppColors.grey, - child: Ink( - height: 200, - child: Container( - width: width, - child: imageState(pictureBoxState, context))))); + child: Ink(height: 200, child: Container(width: width, child: imageState(pictureBoxState, context))))); } Widget imageState(PictureBoxState pictureState, BuildContext context) { diff --git a/lib/components/text_form_field_custom.dart b/lib/components/text_form_field_custom.dart index a9be3921e..9cade62ad 100644 --- a/lib/components/text_form_field_custom.dart +++ b/lib/components/text_form_field_custom.dart @@ -81,18 +81,14 @@ class TextFormFieldCustom extends StatelessWidget { suffixText: suffixText, suffixStyle: Theme.of(context).textTheme.titleSmall, suffixIcon: suffixIcon, - focusedBorder: const OutlineInputBorder( - borderSide: BorderSide(color: AppColors.canopy)), + focusedBorder: const OutlineInputBorder(borderSide: BorderSide(color: AppColors.canopy)), counterText: counterText, hintText: hintText, labelText: labelText, errorText: errorText, errorMaxLines: 2, errorStyle: const TextStyle(color: Colors.red, wordSpacing: 4.0), - labelStyle: Theme.of(context) - .textTheme - .subtitle3 - .copyWith(color: AppColors.white), + labelStyle: Theme.of(context).textTheme.subtitle3.copyWith(color: AppColors.white), hintStyle: Theme.of(context).textTheme.labelLarge, contentPadding: const EdgeInsets.all(16.0), border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), diff --git a/lib/datasource/remote/api/esr_callback_repository.dart b/lib/datasource/remote/api/esr_callback_repository.dart index d04870bac..ced4dc530 100644 --- a/lib/datasource/remote/api/esr_callback_repository.dart +++ b/lib/datasource/remote/api/esr_callback_repository.dart @@ -44,8 +44,7 @@ class ESRCallbackRepository extends HttpRepository { return http .post(postURI, headers: headers, body: params) - .then((http.Response response) => - mapHttpResponse(response, (dynamic body) { + .then((http.Response response) => mapHttpResponse(response, (dynamic body) { return true; })) .catchError((error) => mapHttpError(error)); diff --git a/lib/datasource/remote/api/stat_repository.dart b/lib/datasource/remote/api/stat_repository.dart index 41573b7e6..9b4e9c803 100644 --- a/lib/datasource/remote/api/stat_repository.dart +++ b/lib/datasource/remote/api/stat_repository.dart @@ -4,8 +4,7 @@ import 'package:seeds/datasource/remote/api/http_repo/http_repository.dart'; import 'package:seeds/datasource/remote/model/stat_model.dart'; class StatRepository extends HttpRepository { - Future> getTokenStat( - {required String tokenContract, required String symbol}) { + Future> getTokenStat({required String tokenContract, required String symbol}) { print('[http] get getTokenStat for $symbol'); final String request = ''' @@ -21,8 +20,7 @@ class StatRepository extends HttpRepository { return http .post(statURL, headers: headers, body: request) - .then((http.Response response) => - mapHttpResponse(response, (dynamic body) { + .then((http.Response response) => mapHttpResponse(response, (dynamic body) { return StatModel.fromJson(body); })) .catchError((dynamic error) => mapHttpError(error)); diff --git a/lib/design/app_theme.dart b/lib/design/app_theme.dart index 1f3b81cf0..1d50bef46 100644 --- a/lib/design/app_theme.dart +++ b/lib/design/app_theme.dart @@ -9,20 +9,16 @@ class SeedsAppTheme { useMaterial3: true, colorScheme: AppColorSchemes.darkColorScheme, appBarTheme: const AppBarTheme( - elevation: 0.0, - titleTextStyle: - TextStyle(fontSize: 18, fontWeight: FontWeight.w600) // headline7 + elevation: 0.0, titleTextStyle: TextStyle(fontSize: 18, fontWeight: FontWeight.w600) // headline7 ), scaffoldBackgroundColor: AppColorSchemes.darkColorScheme.surface, - bottomNavigationBarTheme: BottomNavigationBarThemeData( - backgroundColor: AppColorSchemes.darkColorScheme.surface), + bottomNavigationBarTheme: BottomNavigationBarThemeData(backgroundColor: AppColorSchemes.darkColorScheme.surface), fontFamily: 'SFProDisplay', textTheme: SeedsTextTheme.darkTheme, inputDecorationTheme: SeedsInputDecorationTheme.darkTheme, snackBarTheme: SnackBarThemeData( behavior: SnackBarBehavior.floating, - contentTextStyle: - TextStyle(color: AppColorSchemes.darkColorScheme.onSurface), + contentTextStyle: TextStyle(color: AppColorSchemes.darkColorScheme.onSurface), ), indicatorColor: AppColorSchemes.darkColorScheme.secondary, ); @@ -38,8 +34,7 @@ class SeedsAppTheme { appBarTheme: const AppBarTheme( backgroundColor: AppColors.primary, elevation: 0.0, - titleTextStyle: - TextStyle(fontSize: 18, fontWeight: FontWeight.w600), // headline7 + titleTextStyle: TextStyle(fontSize: 18, fontWeight: FontWeight.w600), // headline7 ), inputDecorationTheme: SeedsInputDecorationTheme.lightTheme, snackBarTheme: const SnackBarThemeData( @@ -70,8 +65,7 @@ class SeedsAppTheme { appBarTheme: const AppBarTheme( backgroundColor: AppColors.primary, elevation: 0.0, - titleTextStyle: - TextStyle(fontSize: 18, fontWeight: FontWeight.w600), // headline7 + titleTextStyle: TextStyle(fontSize: 18, fontWeight: FontWeight.w600), // headline7 ), inputDecorationTheme: SeedsInputDecorationTheme.darkTheme, snackBarTheme: const SnackBarThemeData( @@ -106,34 +100,20 @@ class SeedsTextTheme { return Typography.material2018() .englishLike .copyWith( - displaySmall: Typography.material2018() - .englishLike - .displaySmall! - .copyWith(fontSize: 42, fontWeight: FontWeight.w600), - headlineMedium: Typography.material2018() - .englishLike - .headlineMedium! - .copyWith(fontSize: 36, fontWeight: FontWeight.w500), - headlineSmall: Typography.material2018() - .englishLike - .headlineSmall! - .copyWith(fontSize: 28, fontWeight: FontWeight.w600), - titleLarge: Typography.material2018() - .englishLike - .titleLarge! - .copyWith(fontSize: 22, fontWeight: FontWeight.w500), - titleMedium: Typography.material2018() - .englishLike - .titleMedium! - .copyWith(fontSize: 18, fontWeight: FontWeight.w500), - titleSmall: Typography.material2018() - .englishLike - .titleSmall! - .copyWith(fontSize: 14, fontWeight: FontWeight.w400), - labelLarge: Typography.material2018() - .englishLike - .labelLarge! - .copyWith(fontSize: 16, fontWeight: FontWeight.w500), + displaySmall: + Typography.material2018().englishLike.displaySmall!.copyWith(fontSize: 42, fontWeight: FontWeight.w600), + headlineMedium: + Typography.material2018().englishLike.headlineMedium!.copyWith(fontSize: 36, fontWeight: FontWeight.w500), + headlineSmall: + Typography.material2018().englishLike.headlineSmall!.copyWith(fontSize: 28, fontWeight: FontWeight.w600), + titleLarge: + Typography.material2018().englishLike.titleLarge!.copyWith(fontSize: 22, fontWeight: FontWeight.w500), + titleMedium: + Typography.material2018().englishLike.titleMedium!.copyWith(fontSize: 18, fontWeight: FontWeight.w500), + titleSmall: + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 14, fontWeight: FontWeight.w400), + labelLarge: + Typography.material2018().englishLike.labelLarge!.copyWith(fontSize: 16, fontWeight: FontWeight.w500), ) .apply(displayColor: Colors.black, bodyColor: Colors.black); } @@ -142,34 +122,20 @@ class SeedsTextTheme { return Typography.material2018() .englishLike .copyWith( - displaySmall: Typography.material2018() - .englishLike - .displaySmall! - .copyWith(fontSize: 42, fontWeight: FontWeight.w600), - headlineMedium: Typography.material2018() - .englishLike - .headlineMedium! - .copyWith(fontSize: 36, fontWeight: FontWeight.w500), - headlineSmall: Typography.material2018() - .englishLike - .headlineSmall! - .copyWith(fontSize: 28, fontWeight: FontWeight.w600), - titleLarge: Typography.material2018() - .englishLike - .titleLarge! - .copyWith(fontSize: 22, fontWeight: FontWeight.w500), - titleMedium: Typography.material2018() - .englishLike - .titleMedium! - .copyWith(fontSize: 18, fontWeight: FontWeight.w500), - titleSmall: Typography.material2018() - .englishLike - .titleSmall! - .copyWith(fontSize: 14, fontWeight: FontWeight.w400), - labelLarge: Typography.material2018() - .englishLike - .labelLarge! - .copyWith(fontSize: 16, fontWeight: FontWeight.w500), + displaySmall: + Typography.material2018().englishLike.displaySmall!.copyWith(fontSize: 42, fontWeight: FontWeight.w600), + headlineMedium: + Typography.material2018().englishLike.headlineMedium!.copyWith(fontSize: 36, fontWeight: FontWeight.w500), + headlineSmall: + Typography.material2018().englishLike.headlineSmall!.copyWith(fontSize: 28, fontWeight: FontWeight.w600), + titleLarge: + Typography.material2018().englishLike.titleLarge!.copyWith(fontSize: 22, fontWeight: FontWeight.w500), + titleMedium: + Typography.material2018().englishLike.titleMedium!.copyWith(fontSize: 18, fontWeight: FontWeight.w500), + titleSmall: + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 14, fontWeight: FontWeight.w400), + labelLarge: + Typography.material2018().englishLike.labelLarge!.copyWith(fontSize: 16, fontWeight: FontWeight.w500), ) .apply(displayColor: Colors.white, bodyColor: Colors.white); } @@ -178,157 +144,114 @@ class SeedsTextTheme { // Make sure to import this file in order to use this text styles USE: import 'package:seeds/design/app_theme.dart'; // https://dart.dev/guides/language/extension-methods extension CustomStyles on TextTheme { - TextStyle get headline7 => - const TextStyle(fontSize: 18, fontWeight: FontWeight.w600); + TextStyle get headline7 => const TextStyle(fontSize: 18, fontWeight: FontWeight.w600); - TextStyle get headline7LowEmphasis => - const TextStyle(fontSize: 18, fontWeight: FontWeight.w400); + TextStyle get headline7LowEmphasis => const TextStyle(fontSize: 18, fontWeight: FontWeight.w400); - TextStyle get headline8 => - const TextStyle(fontSize: 20, fontWeight: FontWeight.w500); + TextStyle get headline8 => const TextStyle(fontSize: 20, fontWeight: FontWeight.w500); - TextStyle get subtitle1HighEmphasis => Typography.material2018() - .englishLike - .titleMedium! - .copyWith(fontSize: 18, fontWeight: FontWeight.w600); + TextStyle get subtitle1HighEmphasis => + Typography.material2018().englishLike.titleMedium!.copyWith(fontSize: 18, fontWeight: FontWeight.w600); - TextStyle get subtitle2HighEmphasis => Typography.material2018() - .englishLike - .titleSmall! - .copyWith(fontSize: 14, fontWeight: FontWeight.w500); + TextStyle get subtitle2HighEmphasis => + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 14, fontWeight: FontWeight.w500); - TextStyle get subtitle2LowEmphasis => Typography.material2018() + TextStyle get subtitle2LowEmphasis => + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 14, fontWeight: FontWeight.w300); + + TextStyle get subtitle2OpacityEmphasis => Typography.material2018() .englishLike .titleSmall! - .copyWith(fontSize: 14, fontWeight: FontWeight.w300); - - TextStyle get subtitle2OpacityEmphasis => - Typography.material2018().englishLike.titleSmall!.copyWith( - fontSize: 12, - fontWeight: FontWeight.w400, - color: Colors.white.withOpacity(0.5)); - - TextStyle get subtitle2OpacityBlack => - Typography.material2018().englishLike.titleSmall!.copyWith( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Colors.black.withOpacity(0.5)); + .copyWith(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white.withOpacity(0.5)); - TextStyle get subtitle3 => Typography.material2018() + TextStyle get subtitle2OpacityBlack => Typography.material2018() .englishLike .titleSmall! - .copyWith(fontSize: 12, fontWeight: FontWeight.w400); + .copyWith(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.black.withOpacity(0.5)); - TextStyle get subtitle2Green3LowEmphasis => - subtitle2LowEmphasis.copyWith(color: AppColors.green3); + TextStyle get subtitle3 => + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 12, fontWeight: FontWeight.w400); - TextStyle get subtitle2BlackHighEmphasis => - subtitle2HighEmphasis.copyWith(color: AppColors.black); + TextStyle get subtitle2Green3LowEmphasis => subtitle2LowEmphasis.copyWith(color: AppColors.green3); - TextStyle get subtitle2HighEmphasisGreen1 => - subtitle2HighEmphasis.copyWith(color: AppColors.green1); + TextStyle get subtitle2BlackHighEmphasis => subtitle2HighEmphasis.copyWith(color: AppColors.black); - TextStyle get subtitle2BlackLowEmphasis => - subtitle2LowEmphasis.copyWith(color: AppColors.black); + TextStyle get subtitle2HighEmphasisGreen1 => subtitle2HighEmphasis.copyWith(color: AppColors.green1); + + TextStyle get subtitle2BlackLowEmphasis => subtitle2LowEmphasis.copyWith(color: AppColors.black); TextStyle get subtitle2Black => titleSmall!.copyWith(color: AppColors.black); - TextStyle get subtitle2Green2 => - titleSmall!.copyWith(color: AppColors.green2); + TextStyle get subtitle2Green2 => titleSmall!.copyWith(color: AppColors.green2); - TextStyle get subtitle2Darkgreen1L => - titleSmall!.copyWith(color: AppColors.primary); + TextStyle get subtitle2Darkgreen1L => titleSmall!.copyWith(color: AppColors.primary); - TextStyle get subtitle2OpacityEmphasisBlack => - subtitle2OpacityEmphasis.copyWith(color: AppColors.black); + TextStyle get subtitle2OpacityEmphasisBlack => subtitle2OpacityEmphasis.copyWith(color: AppColors.black); TextStyle get subtitle3Green => subtitle3.copyWith(color: AppColors.green3); TextStyle get subtitle3Red => subtitle3.copyWith(color: AppColors.red1); - TextStyle get subtitle3Opacity => - subtitle3.copyWith(color: Colors.white.withOpacity(0.5)); + TextStyle get subtitle3Opacity => subtitle3.copyWith(color: Colors.white.withOpacity(0.5)); - TextStyle get subtitle3LightGreen6 => - subtitle3.copyWith(color: AppColors.lightGreen6); + TextStyle get subtitle3LightGreen6 => subtitle3.copyWith(color: AppColors.lightGreen6); - TextStyle get subtitle3OpacityEmphasis => - Typography.material2018().englishLike.titleSmall!.copyWith( - fontSize: 13, - fontWeight: FontWeight.w400, - color: Colors.white.withOpacity(0.5)); + TextStyle get subtitle3OpacityEmphasis => Typography.material2018() + .englishLike + .titleSmall! + .copyWith(fontSize: 13, fontWeight: FontWeight.w400, color: Colors.white.withOpacity(0.5)); - TextStyle get subtitle3OpacityEmphasisGreen => - subtitle3.copyWith(color: AppColors.green3); + TextStyle get subtitle3OpacityEmphasisGreen => subtitle3.copyWith(color: AppColors.green3); - TextStyle get subtitle3OpacityEmphasisRed => - subtitle3.copyWith(color: AppColors.red1); + TextStyle get subtitle3OpacityEmphasisRed => subtitle3.copyWith(color: AppColors.red1); - TextStyle get subtitle4 => Typography.material2018() - .englishLike - .titleSmall! - .copyWith(fontSize: 13, fontWeight: FontWeight.w400); + TextStyle get subtitle4 => + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 13, fontWeight: FontWeight.w400); TextStyle get buttonHighEmphasis => Typography.material2018() .englishLike .labelLarge! .copyWith(fontSize: 16, fontWeight: FontWeight.w500, letterSpacing: 2); - TextStyle get buttonOpacityEmphasis => - Typography.material2018().englishLike.labelLarge!.copyWith( - fontSize: 16, - fontWeight: FontWeight.w400, - letterSpacing: 2, - color: Colors.white.withOpacity(0.5)); - - TextStyle get buttonLowEmphasis => Typography.material2018() + TextStyle get buttonOpacityEmphasis => Typography.material2018() .englishLike .labelLarge! - .copyWith(fontSize: 16, fontWeight: FontWeight.w400); + .copyWith(fontSize: 16, fontWeight: FontWeight.w400, letterSpacing: 2, color: Colors.white.withOpacity(0.5)); - TextStyle get button1 => Typography.material2018() - .englishLike - .labelLarge! - .copyWith(fontSize: 25, fontWeight: FontWeight.w400); + TextStyle get buttonLowEmphasis => + Typography.material2018().englishLike.labelLarge!.copyWith(fontSize: 16, fontWeight: FontWeight.w400); - TextStyle get button1Black => Typography.material2018() - .englishLike - .button1 - .copyWith(color: AppColors.darkGreen2); + TextStyle get button1 => + Typography.material2018().englishLike.labelLarge!.copyWith(fontSize: 25, fontWeight: FontWeight.w400); - TextStyle get buttonWhiteL => Typography.material2018() - .englishLike - .labelLarge! - .copyWith(color: AppColors.white); + TextStyle get button1Black => Typography.material2018().englishLike.button1.copyWith(color: AppColors.darkGreen2); - TextStyle get buttonGreen1 => Typography.material2018() + TextStyle get buttonWhiteL => Typography.material2018().englishLike.labelLarge!.copyWith(color: AppColors.white); + + TextStyle get buttonGreen1 => Typography.material2018().englishLike.labelLarge!.copyWith(color: AppColors.green1); + + TextStyle get buttonBlack => Typography.material2018() .englishLike .labelLarge! - .copyWith(color: AppColors.green1); - - TextStyle get buttonBlack => - Typography.material2018().englishLike.labelLarge!.copyWith( - fontSize: 16, fontWeight: FontWeight.w500, color: AppColors.black); + .copyWith(fontSize: 16, fontWeight: FontWeight.w500, color: AppColors.black); - TextStyle get headline4Black => - Typography.material2018().englishLike.headlineMedium!.copyWith( - fontSize: 36, fontWeight: FontWeight.w500, color: AppColors.black); + TextStyle get headline4Black => Typography.material2018() + .englishLike + .headlineMedium! + .copyWith(fontSize: 36, fontWeight: FontWeight.w500, color: AppColors.black); - TextStyle get headline6Green => - Typography.material2018().englishLike.titleLarge!.copyWith( - fontSize: 22, fontWeight: FontWeight.w500, color: AppColors.green3); + TextStyle get headline6Green => Typography.material2018() + .englishLike + .titleLarge! + .copyWith(fontSize: 22, fontWeight: FontWeight.w500, color: AppColors.green3); - TextStyle get headline7Green => headline7.copyWith( - fontSize: 22, fontWeight: FontWeight.w500, color: AppColors.green3); + TextStyle get headline7Green => + headline7.copyWith(fontSize: 22, fontWeight: FontWeight.w500, color: AppColors.green3); - TextStyle get subtitle1Green1 => titleMedium!.copyWith( - fontSize: 18, - fontWeight: FontWeight.w500, - letterSpacing: 2, - color: AppColors.green1); + TextStyle get subtitle1Green1 => + titleMedium!.copyWith(fontSize: 18, fontWeight: FontWeight.w500, letterSpacing: 2, color: AppColors.green1); - TextStyle get subtitle1Red2 => - subtitle1Green1.copyWith(color: AppColors.red1); + TextStyle get subtitle1Red2 => subtitle1Green1.copyWith(color: AppColors.red1); } class SeedsInputDecorationTheme { diff --git a/lib/screens/app/components/account_under_recovery_screen.dart b/lib/screens/app/components/account_under_recovery_screen.dart index 5ac45ed98..e27c64f7f 100644 --- a/lib/screens/app/components/account_under_recovery_screen.dart +++ b/lib/screens/app/components/account_under_recovery_screen.dart @@ -16,8 +16,7 @@ class AccountUnderRecoveryScreen extends StatelessWidget { child: CustomDialog( singleLargeButtonTitle: 'Cancel Recovery'.i18n, onSingleLargeButtonPressed: () { - BlocProvider.of(context) - .add(const OnStopGuardianActiveRecoveryTapped()); + BlocProvider.of(context).add(const OnStopGuardianActiveRecoveryTapped()); }, children: [ Container( @@ -25,12 +24,9 @@ class AccountUnderRecoveryScreen extends StatelessWidget { width: 250, decoration: const BoxDecoration( color: AppColors.white, - borderRadius: - BorderRadius.all(Radius.circular(defaultCardBorderRadius)), + borderRadius: BorderRadius.all(Radius.circular(defaultCardBorderRadius)), image: DecorationImage( - image: AssetImage( - 'assets/images/guardians/guardian_shield.png'), - fit: BoxFit.fitWidth), + image: AssetImage('assets/images/guardians/guardian_shield.png'), fit: BoxFit.fitWidth), ), ), const SizedBox(height: 20), diff --git a/lib/screens/app/components/guardian_approve_or_deny_recovery_screen.dart b/lib/screens/app/components/guardian_approve_or_deny_recovery_screen.dart index df6a88f12..809f293eb 100644 --- a/lib/screens/app/components/guardian_approve_or_deny_recovery_screen.dart +++ b/lib/screens/app/components/guardian_approve_or_deny_recovery_screen.dart @@ -20,12 +20,10 @@ class GuardianApproveOrDenyScreen extends StatelessWidget { leftButtonTitle: 'Dismiss'.i18n, rightButtonTitle: 'Accept Request'.i18n, onLeftButtonPressed: () { - BlocProvider.of(context) - .add(OnDismissGuardianRecoveryTapped()); + BlocProvider.of(context).add(OnDismissGuardianRecoveryTapped()); }, onRightButtonPressed: () { - BlocProvider.of(context) - .add(OnApproveGuardianRecoveryTapped(data)); + BlocProvider.of(context).add(OnApproveGuardianRecoveryTapped(data)); }, children: [ Container( @@ -33,12 +31,9 @@ class GuardianApproveOrDenyScreen extends StatelessWidget { width: 250, decoration: const BoxDecoration( color: AppColors.white, - borderRadius: - BorderRadius.all(Radius.circular(defaultCardBorderRadius)), + borderRadius: BorderRadius.all(Radius.circular(defaultCardBorderRadius)), image: DecorationImage( - image: AssetImage( - 'assets/images/guardians/guardian_shield.png'), - fit: BoxFit.fitWidth), + image: AssetImage('assets/images/guardians/guardian_shield.png'), fit: BoxFit.fitWidth), ), ), const SizedBox(height: 20), diff --git a/lib/screens/authentication/import_key/components/import_key_accounts_widget.dart b/lib/screens/authentication/import_key/components/import_key_accounts_widget.dart index d10819d14..6d4a9588f 100644 --- a/lib/screens/authentication/import_key/components/import_key_accounts_widget.dart +++ b/lib/screens/authentication/import_key/components/import_key_accounts_widget.dart @@ -19,8 +19,8 @@ class ImportKeyAccountsWidget extends StatelessWidget { return BlocConsumer( listenWhen: (_, current) => current.accountSelected != null, listener: (context, state) { - BlocProvider.of(context).add(OnImportAccount( - account: state.accountSelected!, authData: state.authData!)); + BlocProvider.of(context) + .add(OnImportAccount(account: state.accountSelected!, authData: state.authData!)); }, builder: (context, state) { switch (state.pageState) { @@ -29,8 +29,7 @@ class ImportKeyAccountsWidget extends StatelessWidget { case PageState.failure: return Center( child: Text( - state.error?.localizedDescription(context) ?? - GlobalError.unknown.localizedDescription(context), + state.error?.localizedDescription(context) ?? GlobalError.unknown.localizedDescription(context), style: Theme.of(context).textTheme.subtitle1Red2, )); case PageState.success: @@ -39,17 +38,13 @@ class ImportKeyAccountsWidget extends StatelessWidget { shrinkWrap: true, children: state.accounts .map((ProfileModel? profile) => Padding( - padding: const EdgeInsets.symmetric( - vertical: 6, horizontal: horizontalEdgePadding), + padding: const EdgeInsets.symmetric(vertical: 6, horizontal: horizontalEdgePadding), child: MaterialButton( padding: EdgeInsets.zero, color: AppColors.darkGreen2, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - defaultCardBorderRadius)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(defaultCardBorderRadius)), onPressed: () { - context.read().add( - AccountSelected(account: profile!.account)); + context.read().add(AccountSelected(account: profile!.account)); }, child: Padding( padding: const EdgeInsets.only(top: 6, bottom: 6), @@ -61,16 +56,12 @@ class ImportKeyAccountsWidget extends StatelessWidget { nickname: profile.nickname, ), title: Text( - profile.nickname.isNotEmpty - ? profile.nickname - : profile.account, + profile.nickname.isNotEmpty ? profile.nickname : profile.account, style: Theme.of(context).textTheme.labelLarge, ), subtitle: Text( profile.account, - style: Theme.of(context) - .textTheme - .subtitle3OpacityEmphasis, + style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), trailing: const Icon(Icons.navigate_next), ), diff --git a/lib/screens/authentication/import_key/components/import_words_accounts_widget.dart b/lib/screens/authentication/import_key/components/import_words_accounts_widget.dart index 2bf876b80..796090459 100644 --- a/lib/screens/authentication/import_key/components/import_words_accounts_widget.dart +++ b/lib/screens/authentication/import_key/components/import_words_accounts_widget.dart @@ -19,8 +19,8 @@ class ImportWordsAccountsWidget extends StatelessWidget { return BlocConsumer( listenWhen: (_, current) => current.accountSelected != null, listener: (context, state) { - BlocProvider.of(context).add(OnImportAccount( - account: state.accountSelected!, authData: state.authData!)); + BlocProvider.of(context) + .add(OnImportAccount(account: state.accountSelected!, authData: state.authData!)); }, builder: (context, state) { switch (state.pageState) { @@ -29,8 +29,7 @@ class ImportWordsAccountsWidget extends StatelessWidget { case PageState.failure: return Center( child: Text( - state.error?.localizedDescription(context) ?? - GlobalError.unknown.localizedDescription(context), + state.error?.localizedDescription(context) ?? GlobalError.unknown.localizedDescription(context), style: Theme.of(context).textTheme.subtitle1Red2, )); case PageState.success: @@ -42,12 +41,9 @@ class ImportWordsAccountsWidget extends StatelessWidget { child: MaterialButton( padding: EdgeInsets.zero, color: AppColors.darkGreen2, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - defaultCardBorderRadius)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(defaultCardBorderRadius)), onPressed: () { - context.read().add( - AccountSelected(account: profile!.account)); + context.read().add(AccountSelected(account: profile!.account)); }, child: Padding( padding: const EdgeInsets.only(top: 6, bottom: 6), @@ -59,16 +55,12 @@ class ImportWordsAccountsWidget extends StatelessWidget { nickname: profile.nickname, ), title: Text( - profile.nickname.isNotEmpty - ? profile.nickname - : profile.account, + profile.nickname.isNotEmpty ? profile.nickname : profile.account, style: Theme.of(context).textTheme.labelLarge, ), subtitle: Text( profile.account, - style: Theme.of(context) - .textTheme - .subtitle3OpacityEmphasis, + style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), trailing: const Icon(Icons.navigate_next), ), diff --git a/lib/screens/authentication/import_key/import_key_screen.dart b/lib/screens/authentication/import_key/import_key_screen.dart index 808b147df..6b8e3c372 100644 --- a/lib/screens/authentication/import_key/import_key_screen.dart +++ b/lib/screens/authentication/import_key/import_key_screen.dart @@ -40,8 +40,7 @@ class _ImportKeyScreenState extends State { void _onSubmitted() { FocusScope.of(context).unfocus(); if (_formImportKey.currentState!.validate()) { - _importKeyBloc - .add(FindAccountByKey(privateKey: _keyController.text, words: [])); + _importKeyBloc.add(FindAccountByKey(privateKey: _keyController.text, words: [])); } } @@ -64,40 +63,32 @@ class _ImportKeyScreenState extends State { key: _formImportKey, autovalidateMode: AutovalidateMode.disabled, child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: horizontalEdgePadding), + padding: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding), child: Column( children: [ TextFormFieldCustom( autofocus: true, - labelText: context - .loc.importKeyPrivateKeyFieldPlaceholder, + labelText: context.loc.importKeyPrivateKeyFieldPlaceholder, suffixIcon: IconButton( - icon: const Icon(Icons.paste, - color: AppColors.white), + icon: const Icon(Icons.paste, color: AppColors.white), onPressed: () async { - final clipboardData = - await Clipboard.getData('text/plain'); - final clipboardText = - clipboardData?.text ?? ''; + final clipboardData = await Clipboard.getData('text/plain'); + final clipboardText = clipboardData?.text ?? ''; _keyController.text = clipboardText; // ignore: use_build_context_synchronously - BlocProvider.of(context).add( - OnPrivateKeyChange( - privateKeyChanged: clipboardText)); + BlocProvider.of(context) + .add(OnPrivateKeyChange(privateKeyChanged: clipboardText)); _onSubmitted(); }, ), onFieldSubmitted: (value) { - BlocProvider.of(context).add( - OnPrivateKeyChange( - privateKeyChanged: value)); + BlocProvider.of(context) + .add(OnPrivateKeyChange(privateKeyChanged: value)); }, controller: _keyController, onChanged: (value) { - BlocProvider.of(context).add( - OnPrivateKeyChange( - privateKeyChanged: value)); + BlocProvider.of(context) + .add(OnPrivateKeyChange(privateKeyChanged: value)); }, ), ], @@ -112,21 +103,15 @@ class _ImportKeyScreenState extends State { style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( - text: context.loc - .importKeyImportUsingRecoveryPhraseActionLink, - style: Theme.of(context) - .textTheme - .subtitle2Green2, + text: context.loc.importKeyImportUsingRecoveryPhraseActionLink, + style: Theme.of(context).textTheme.subtitle2Green2, recognizer: TapGestureRecognizer() ..onTap = () { Navigator.of(context).pop(); - NavigationService.of(context) - .navigateTo(Routes.importWords); + NavigationService.of(context).navigateTo(Routes.importWords); }), const TextSpan(text: " "), - TextSpan( - text: context.loc - .importKeyImportUsingRecoveryPhraseDescription), + TextSpan(text: context.loc.importKeyImportUsingRecoveryPhraseDescription), ], ), ), @@ -137,8 +122,7 @@ class _ImportKeyScreenState extends State { ], ), Padding( - padding: const EdgeInsets.symmetric( - horizontal: horizontalEdgePadding), + padding: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding), child: Align( alignment: Alignment.bottomCenter, child: FlatButtonLong( diff --git a/lib/screens/authentication/import_key/import_words_screen.dart b/lib/screens/authentication/import_key/import_words_screen.dart index f4891b4f6..2e5d40a43 100644 --- a/lib/screens/authentication/import_key/import_words_screen.dart +++ b/lib/screens/authentication/import_key/import_words_screen.dart @@ -30,8 +30,7 @@ class ImportWordsScreen extends StatelessWidget { title: context.loc.importKeySearchButtonTitle, onPressed: () { FocusScope.of(context).unfocus(); - BlocProvider.of(context) - .add(const FindAccountFromWords()); + BlocProvider.of(context).add(const FindAccountFromWords()); }, enabled: state.enableButton, ), @@ -61,68 +60,53 @@ class ImportWordsScreen extends StatelessWidget { return Padding( padding: EdgeInsets.only( left: (index % _numberOfColumns == 0) ? 0 : 8, - right: ((index + 1) % _numberOfColumns == 0) - ? 0 - : 8), + right: ((index + 1) % _numberOfColumns == 0) ? 0 : 8), child: Autocomplete( - fieldViewBuilder: (context, textEditingController, - focusNode, onFieldSubmitted) { - textEditingController.text = - state.userEnteredWords[index] ?? ""; + fieldViewBuilder: (context, textEditingController, focusNode, onFieldSubmitted) { + textEditingController.text = state.userEnteredWords[index] ?? ""; textEditingController.selection = - TextSelection.fromPosition(TextPosition( - offset: - textEditingController.text.length)); + TextSelection.fromPosition(TextPosition(offset: textEditingController.text.length)); return TextField( controller: textEditingController, focusNode: focusNode, autocorrect: false, enableSuggestions: false, enabled: true, - textInputAction: index < 11 - ? TextInputAction.next - : TextInputAction.done, + textInputAction: index < 11 ? TextInputAction.next : TextInputAction.done, onChanged: (value) { - BlocProvider.of(context).add( - OnWordChange( - word: value, wordIndex: index)); + BlocProvider.of(context) + .add(OnWordChange(word: value, wordIndex: index)); }, keyboardType: TextInputType.visiblePassword, decoration: InputDecoration( - floatingLabelBehavior: - FloatingLabelBehavior.always, + floatingLabelBehavior: FloatingLabelBehavior.always, labelText: (index + 1).toString(), border: const OutlineInputBorder(), ), ); }, - optionsBuilder: - (TextEditingValue textEditingValue) { + optionsBuilder: (TextEditingValue textEditingValue) { if (textEditingValue.text == '') { return const Iterable.empty(); } return wordList.where((String option) { - return option.startsWith( - textEditingValue.text.toLowerCase()); + return option.startsWith(textEditingValue.text.toLowerCase()); }); }, onSelected: (String selection) { FocusScope.of(context).nextFocus(); - BlocProvider.of(context).add( - OnWordChange( - word: selection, wordIndex: index)); + BlocProvider.of(context) + .add(OnWordChange(word: selection, wordIndex: index)); }, ), ); }), ), - if (state.pageState != PageState.loading && - state.accounts.isEmpty) + if (state.pageState != PageState.loading && state.accounts.isEmpty) TextButton( child: Text(context.loc.importWordClipBoardTitle), onPressed: () { - BlocProvider.of(context) - .add(const OnUserPastedWords()); + BlocProvider.of(context).add(const OnUserPastedWords()); }, ), const SizedBox(height: 16), @@ -132,21 +116,16 @@ class ImportWordsScreen extends StatelessWidget { style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( - text: context.loc - .importKeyImportUsingPrivateKeyActionLink, - style: - Theme.of(context).textTheme.subtitle2Green2, + text: context.loc.importKeyImportUsingPrivateKeyActionLink, + style: Theme.of(context).textTheme.subtitle2Green2, recognizer: TapGestureRecognizer() ..onTap = () { Navigator.of(context).pop(); - NavigationService.of(context) - .navigateTo(Routes.importKey); + NavigationService.of(context).navigateTo(Routes.importKey); }, ), const TextSpan(text: " "), - TextSpan( - text: context.loc - .importKeyImportUsingPrivateKeyDescription), + TextSpan(text: context.loc.importKeyImportUsingPrivateKeyDescription), ], ), ), diff --git a/lib/screens/authentication/login_screen.dart b/lib/screens/authentication/login_screen.dart index b80d8faa0..39c6ae0db 100644 --- a/lib/screens/authentication/login_screen.dart +++ b/lib/screens/authentication/login_screen.dart @@ -22,27 +22,21 @@ class LoginScreen extends StatelessWidget { padding: const EdgeInsets.all(16), child: TextButton( style: TextButton.styleFrom( - shape: const BeveledRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(10)))), + shape: const BeveledRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10)))), onPressed: () { if (settingsStorage.inRecoveryMode) { - NavigationService.of(context).navigateTo( - Routes.recoverAccountFound, settingsStorage.accountName); + NavigationService.of(context).navigateTo(Routes.recoverAccountFound, settingsStorage.accountName); } else { - NavigationService.of(context) - .navigateTo(Routes.recoverAccountSearch); + NavigationService.of(context).navigateTo(Routes.recoverAccountSearch); } }, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(context.loc.loginRecoverAccountActionSegment1, - style: Theme.of(context).textTheme.titleSmall), + Text(context.loc.loginRecoverAccountActionSegment1, style: Theme.of(context).textTheme.titleSmall), Text(context.loc.loginRecoverAccountActionLink, - style: - Theme.of(context).textTheme.subtitle2HighEmphasisGreen1), - Text(context.loc.loginRecoverAccountActionSegment2, - style: Theme.of(context).textTheme.titleSmall), + style: Theme.of(context).textTheme.subtitle2HighEmphasisGreen1), + Text(context.loc.loginRecoverAccountActionSegment2, style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -55,42 +49,33 @@ class LoginScreen extends StatelessWidget { Container( height: max(0, min(height * 0.4, height - _approxWidgetHeight)), decoration: const BoxDecoration( - image: DecorationImage( - fit: BoxFit.fitWidth, - image: AssetImage("assets/images/login/background.png")), + image: DecorationImage(fit: BoxFit.fitWidth, image: AssetImage("assets/images/login/background.png")), ), ), - SvgPicture.asset( - "assets/images/login/seeds_light_wallet_logo.svg"), + SvgPicture.asset("assets/images/login/seeds_light_wallet_logo.svg"), const SizedBox(height: 80), Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(context.loc.loginFirstTimeHere, - style: Theme.of(context).textTheme.titleSmall), + Text(context.loc.loginFirstTimeHere, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 10), FlatButtonLong( - onPressed: () => NavigationService.of(context) - .navigateTo(Routes.signup), + onPressed: () => NavigationService.of(context).navigateTo(Routes.signup), title: context.loc.loginClaimInviteCodeButtonTitle, ), const SizedBox(height: 40), - Text(context.loc.loginAlreadyHaveAnAccount, - style: Theme.of(context).textTheme.titleSmall), + Text(context.loc.loginAlreadyHaveAnAccount, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 10), FlatButtonLongOutlined( onPressed: () { /// We use remoteConfigurations directly here because this page doesnt have blocs. /// !!!Please do not copy this pattern!!! - if (remoteConfigurations - .featureFlagExportRecoveryPhraseEnabled) { - NavigationService.of(context) - .navigateTo(Routes.importWords); + if (remoteConfigurations.featureFlagExportRecoveryPhraseEnabled) { + NavigationService.of(context).navigateTo(Routes.importWords); } else { - NavigationService.of(context) - .navigateTo(Routes.importKey); + NavigationService.of(context).navigateTo(Routes.importKey); } }, title: context.loc.loginImportAccountButtonTitle, diff --git a/lib/screens/authentication/onboarding/components/onboarding_pages.dart b/lib/screens/authentication/onboarding/components/onboarding_pages.dart index ff2cbc8b4..b9603877e 100644 --- a/lib/screens/authentication/onboarding/components/onboarding_pages.dart +++ b/lib/screens/authentication/onboarding/components/onboarding_pages.dart @@ -31,13 +31,11 @@ class OnboardingPage extends StatelessWidget { height: MediaQuery.of(context).size.height / 2, decoration: const BoxDecoration( color: AppColors.lightGreen4, - borderRadius: - BorderRadius.vertical(bottom: Radius.elliptical(300, 50)), + borderRadius: BorderRadius.vertical(bottom: Radius.elliptical(300, 50)), ), child: Center( child: Container( - padding: const EdgeInsets.only( - bottom: 20, top: 50, right: 40, left: 40), + padding: const EdgeInsets.only(bottom: 20, top: 50, right: 40, left: 40), child: Stack( clipBehavior: Clip.none, children: [ @@ -63,11 +61,9 @@ class OnboardingPage extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, - style: Theme.of(context).textTheme.displaySmall), + Text(title, style: Theme.of(context).textTheme.displaySmall), const SizedBox(height: 30), - Text(subTitle, - style: Theme.of(context).textTheme.labelLarge), + Text(subTitle, style: Theme.of(context).textTheme.labelLarge), ], ), ], diff --git a/lib/screens/authentication/onboarding/onboarding_screen.dart b/lib/screens/authentication/onboarding/onboarding_screen.dart index 908fe8d72..bbe1201b9 100644 --- a/lib/screens/authentication/onboarding/onboarding_screen.dart +++ b/lib/screens/authentication/onboarding/onboarding_screen.dart @@ -51,8 +51,7 @@ class OnboardingState extends State { height: height * 0.91, viewportFraction: 1, enableInfiniteScroll: false, - onPageChanged: (index, _) => - setState(() => _selectedIndex = index), + onPageChanged: (index, _) => setState(() => _selectedIndex = index), ), ), Expanded( @@ -66,17 +65,14 @@ class OnboardingState extends State { ) : const SizedBox.shrink(), ), - Expanded( - child: DotsIndicator( - dotsCount: 3, position: _selectedIndex.toDouble())), + Expanded(child: DotsIndicator(dotsCount: 3, position: _selectedIndex.toDouble())), if (_selectedIndex == 2) Expanded( child: Row( children: [ Flexible( child: InkWell( - onTap: () => NavigationService.of(context) - .navigateTo(Routes.login, null, true), + onTap: () => NavigationService.of(context).navigateTo(Routes.login, null, true), child: Text( context.loc.onboardingJoinButtonTitle, maxLines: 2, diff --git a/lib/screens/authentication/recover/recover_account_found/components/guardian_row_widget.dart b/lib/screens/authentication/recover/recover_account_found/components/guardian_row_widget.dart index bcdf9989d..b17864675 100644 --- a/lib/screens/authentication/recover/recover_account_found/components/guardian_row_widget.dart +++ b/lib/screens/authentication/recover/recover_account_found/components/guardian_row_widget.dart @@ -18,9 +18,7 @@ class GuardianRowWidget extends StatelessWidget { @override Widget build(BuildContext context) { return ListTile( - trailing: showGuardianSigned - ? const Icon(Icons.check_circle, color: AppColors.green) - : const SizedBox.shrink(), + trailing: showGuardianSigned ? const Icon(Icons.check_circle, color: AppColors.green) : const SizedBox.shrink(), leading: ProfileAvatar( size: 60, image: guardianModel.image, @@ -28,13 +26,10 @@ class GuardianRowWidget extends StatelessWidget { nickname: guardianModel.nickname, ), title: Text( - (!guardianModel.nickname.isNullOrEmpty) - ? guardianModel.nickname - : guardianModel.account, + (!guardianModel.nickname.isNullOrEmpty) ? guardianModel.nickname : guardianModel.account, style: Theme.of(context).textTheme.labelLarge, ), - subtitle: Text(guardianModel.account, - style: Theme.of(context).textTheme.subtitle2OpacityEmphasis), + subtitle: Text(guardianModel.account, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis), onTap: () {}); } } diff --git a/lib/screens/authentication/recover/recover_account_found/recover_account_found_screen.dart b/lib/screens/authentication/recover/recover_account_found/recover_account_found_screen.dart index a52b4ec9f..74e3ff3e0 100644 --- a/lib/screens/authentication/recover/recover_account_found/recover_account_found_screen.dart +++ b/lib/screens/authentication/recover/recover_account_found/recover_account_found_screen.dart @@ -27,28 +27,23 @@ class RecoverAccountFoundScreen extends StatelessWidget { @override Widget build(BuildContext context) { // ignore: cast_nullable_to_non_nullable - final String userAccount = - ModalRoute.of(context)!.settings.arguments! as String; + final String userAccount = ModalRoute.of(context)!.settings.arguments! as String; return BlocProvider( - create: (_) => - RecoverAccountFoundBloc(userAccount)..add(const FetchInitialData()), + create: (_) => RecoverAccountFoundBloc(userAccount)..add(const FetchInitialData()), child: BlocConsumer( listenWhen: (_, current) => current.pageCommand != null, listener: (context, state) { final pageCommand = state.pageCommand; - BlocProvider.of(context) - .add(const ClearRecoverPageCommand()); + BlocProvider.of(context).add(const ClearRecoverPageCommand()); if (pageCommand is ShowLinkCopied) { - eventBus.fire(ShowSnackBar.success( - context.loc.recoverAccountFoundShowLinkCopied)); + eventBus.fire(ShowSnackBar.success(context.loc.recoverAccountFoundShowLinkCopied)); } else if (pageCommand is ShowErrorMessage) { eventBus.fire(ShowSnackBar(pageCommand.message)); } else if (pageCommand is CancelRecoveryProcess) { Navigator.of(context).pop(); } else if (pageCommand is OnRecoverAccountSuccess) { - BlocProvider.of(context) - .add(const OnRecoverAccount()); + BlocProvider.of(context).add(const OnRecoverAccount()); } }, builder: (context, state) { @@ -67,9 +62,7 @@ class RecoverAccountFoundScreen extends StatelessWidget { padding: const EdgeInsets.all(8.0), child: IconButton( icon: const Icon(Icons.refresh), - onPressed: () => - BlocProvider.of(context) - .add(const OnRefreshTapped()), + onPressed: () => BlocProvider.of(context).add(const OnRefreshTapped()), ), ) ], @@ -89,13 +82,9 @@ class RecoverAccountFoundScreen extends StatelessWidget { return const FullPageLoadingIndicator(); case PageState.failure: return FullPageErrorIndicator( - errorMessage: state.error?.localizedDescription(context) ?? - GlobalError.unknown.localizedDescription(context), - buttonTitle: - context.loc.recoverAccountFoundFullPageErrorIndicatorTitle, - buttonOnPressed: () => - BlocProvider.of(context) - .add(const OnCancelProcessTapped()), + errorMessage: state.error?.localizedDescription(context) ?? GlobalError.unknown.localizedDescription(context), + buttonTitle: context.loc.recoverAccountFoundFullPageErrorIndicatorTitle, + buttonOnPressed: () => BlocProvider.of(context).add(const OnCancelProcessTapped()), ); case PageState.success: switch (state.recoveryStatus) { @@ -109,15 +98,12 @@ class RecoverAccountFoundScreen extends StatelessWidget { Stack( children: [ Padding( - padding: - const EdgeInsets.only(left: 8, right: 8, top: 8), + padding: const EdgeInsets.only(left: 8, right: 8, top: 8), child: TextFormFieldCustom( enabled: false, labelText: context.loc.recoverAccountFoundLinkTitle, suffixIcon: const SizedBox.shrink(), - controller: TextEditingController( - text: - state.linkToActivateGuardians?.toString()), + controller: TextEditingController(text: state.linkToActivateGuardians?.toString()), ), ), Positioned( @@ -126,12 +112,10 @@ class RecoverAccountFoundScreen extends StatelessWidget { child: Padding( padding: const EdgeInsets.only(right: 8, top: 8), child: IconButton( - icon: const Icon(Icons.share, - color: AppColors.white), + icon: const Icon(Icons.share, color: AppColors.white), splashRadius: 30, onPressed: () async { - await Share.share( - state.linkToActivateGuardians!.toString()); + await Share.share(state.linkToActivateGuardians!.toString()); }, ), ), @@ -144,57 +128,44 @@ class RecoverAccountFoundScreen extends StatelessWidget { children: [ Text(state.confirmedGuardianSignatures.toString(), style: Theme.of(context).textTheme.button1), - Text("/${state.userGuardiansData.length}", - style: Theme.of(context).textTheme.button1), + Text("/${state.userGuardiansData.length}", style: Theme.of(context).textTheme.button1), const SizedBox(width: 24), Flexible( child: Text( - context.loc - .recoverAccountFoundGuardiansAcceptedTitle, - style: - Theme.of(context).textTheme.buttonLowEmphasis, + context.loc.recoverAccountFoundGuardiansAcceptedTitle, + style: Theme.of(context).textTheme.buttonLowEmphasis, ), ), ], ), ), - const Padding( - padding: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 16.0), - child: DividerJungle()), + const Padding(padding: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 16.0), child: DividerJungle()), const SizedBox(height: 16), Expanded( child: ListView( children: state.userGuardiansData .map((e) => GuardianRowWidget( guardianModel: e, - showGuardianSigned: state - .alreadySignedGuardians - .where((String element) => - element == e.account) + showGuardianSigned: state.alreadySignedGuardians + .where((String element) => element == e.account) .isNotEmpty, )) .toList(), ), ), Padding( - padding: const EdgeInsets.symmetric( - horizontal: horizontalEdgePadding, vertical: 16), + padding: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding, vertical: 16), child: FlatButtonLong( title: context.loc.recoverAccountFoundReloadTitle, - onPressed: () => - BlocProvider.of(context) - .add(const OnRefreshTapped()), + onPressed: () => BlocProvider.of(context).add(const OnRefreshTapped()), ), ), Padding( - padding: const EdgeInsets.symmetric( - horizontal: horizontalEdgePadding), + padding: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding), child: FlatButtonLongOutlined( - title: context - .loc.recoverAccountFoundFullPageErrorIndicatorTitle, + title: context.loc.recoverAccountFoundFullPageErrorIndicatorTitle, onPressed: () => - BlocProvider.of(context) - .add(const OnCancelProcessTapped()), + BlocProvider.of(context).add(const OnCancelProcessTapped()), ), ), ], @@ -206,104 +177,70 @@ class RecoverAccountFoundScreen extends StatelessWidget { bottomSheet: Padding( padding: const EdgeInsets.all(horizontalEdgePadding), child: FlatButtonLong( - enabled: state.recoveryStatus == - RecoveryStatus.readyToClaimAccount, + enabled: state.recoveryStatus == RecoveryStatus.readyToClaimAccount, title: context.loc.recoverAccountFoundClaimButtonTitle, - onPressed: () => - BlocProvider.of(context) - .add(const OnClaimAccountTapped()), + onPressed: () => BlocProvider.of(context).add(const OnClaimAccountTapped()), ), ), body: SafeArea( child: SingleChildScrollView( child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: horizontalEdgePadding), + padding: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding), child: Column( children: [ const SizedBox(height: 10), Padding( padding: const EdgeInsets.all(16.0), child: Text( - context.loc - .recoverAccountFoundAllGuardiansAcceptedTitle, - style: Theme.of(context) - .textTheme - .subtitle2LowEmphasis, + context.loc.recoverAccountFoundAllGuardiansAcceptedTitle, + style: Theme.of(context).textTheme.subtitle2LowEmphasis, textAlign: TextAlign.center, ), ), const SizedBox(height: 40), - const Image( - image: AssetImage( - 'assets/images/guardians/check_circle.png')), + const Image(image: AssetImage('assets/images/guardians/check_circle.png')), const SizedBox(height: 100), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ - Text( - state.currentRemainingTime - ?.hoursFormatted ?? - '00', - style: Theme.of(context) - .textTheme - .headlineMedium), + Text(state.currentRemainingTime?.hoursFormatted ?? '00', + style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(bottom: 6), - child: Text(':', - style: Theme.of(context) - .textTheme - .headlineMedium), + child: Text(':', style: Theme.of(context).textTheme.headlineMedium), ) ], ), Row( children: [ - Text( - state.currentRemainingTime?.minFormatted ?? - '00', - style: Theme.of(context) - .textTheme - .headlineMedium), + Text(state.currentRemainingTime?.minFormatted ?? '00', + style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(bottom: 6), - child: Text(':', - style: Theme.of(context) - .textTheme - .headlineMedium), + child: Text(':', style: Theme.of(context).textTheme.headlineMedium), ) ], ), Row( children: [ - Text( - '${state.currentRemainingTime?.secFormatted ?? '00'} ', - style: Theme.of(context) - .textTheme - .headlineMedium), + Text('${state.currentRemainingTime?.secFormatted ?? '00'} ', + style: Theme.of(context).textTheme.headlineMedium), ], ), Padding( padding: const EdgeInsets.only(top: 14), - child: Text( - context.loc.recoverAccountFoundHoursLeft, - style: - Theme.of(context).textTheme.titleSmall), + child: Text(context.loc.recoverAccountFoundHoursLeft, + style: Theme.of(context).textTheme.titleSmall), ) ], ), const SizedBox(height: 20), - if (state.recoveryStatus == - RecoveryStatus.readyToClaimAccount) + if (state.recoveryStatus == RecoveryStatus.readyToClaimAccount) Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(context - .loc.recoverAccountFoundRecoveredTitle), - Text(state.userAccount) - ], + children: [Text(context.loc.recoverAccountFoundRecoveredTitle), Text(state.userAccount)], ), const SizedBox(height: 150), ], diff --git a/lib/screens/authentication/sign_up/components/invite_link_fail_dialog.dart b/lib/screens/authentication/sign_up/components/invite_link_fail_dialog.dart index e1b809acb..48cf2cbdd 100644 --- a/lib/screens/authentication/sign_up/components/invite_link_fail_dialog.dart +++ b/lib/screens/authentication/sign_up/components/invite_link_fail_dialog.dart @@ -12,8 +12,7 @@ class InviteLinkFailDialog extends StatelessWidget { icon: const Icon(Icons.cancel_outlined, size: 60, color: AppColors.red), singleLargeButtonTitle: context.loc.genericCloseButtonTitle, children: [ - Text(context.loc.signUpInviteCodeErrorTitle, - style: Theme.of(context).textTheme.titleLarge), + Text(context.loc.signUpInviteCodeErrorTitle, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 24.0), Text( context.loc.signUpInviteCodeErrorDescription, diff --git a/lib/screens/authentication/verification/components/passcode_created_dialog.dart b/lib/screens/authentication/verification/components/passcode_created_dialog.dart index 6f19e8bc7..7ab4fe946 100644 --- a/lib/screens/authentication/verification/components/passcode_created_dialog.dart +++ b/lib/screens/authentication/verification/components/passcode_created_dialog.dart @@ -8,19 +8,16 @@ class PasscodeCreatedDialog extends StatelessWidget { const PasscodeCreatedDialog({super.key}); Future show(BuildContext context) async { - return showDialog( - context: context, barrierDismissible: false, builder: (_) => this); + return showDialog(context: context, barrierDismissible: false, builder: (_) => this); } @override Widget build(BuildContext context) { return CustomDialog( - icon: - SvgPicture.asset('assets/images/security/success_outlined_icon.svg'), + icon: SvgPicture.asset('assets/images/security/success_outlined_icon.svg'), singleLargeButtonTitle: context.loc.genericCloseButtonTitle, children: [ - Text(context.loc.verificationPasscodeDialogTitle, - style: Theme.of(context).textTheme.button1), + Text(context.loc.verificationPasscodeDialogTitle, style: Theme.of(context).textTheme.button1), const SizedBox(height: 30.0), Text( context.loc.verificationPasscodeDialogSubTitle, diff --git a/lib/screens/authentication/verification/components/passcode_screen.dart b/lib/screens/authentication/verification/components/passcode_screen.dart index 9a4995019..6718d460c 100644 --- a/lib/screens/authentication/verification/components/passcode_screen.dart +++ b/lib/screens/authentication/verification/components/passcode_screen.dart @@ -18,18 +18,13 @@ class PasscodeScreen extends StatefulWidget { final ValueSetter onPasscodeCompleted; final Widget? bottomWidget; - const PasscodeScreen( - {super.key, - required this.title, - required this.onPasscodeCompleted, - this.bottomWidget}); + const PasscodeScreen({super.key, required this.title, required this.onPasscodeCompleted, this.bottomWidget}); @override State createState() => _PasscodeScreenState(); } -class _PasscodeScreenState extends State - with SingleTickerProviderStateMixin { +class _PasscodeScreenState extends State with SingleTickerProviderStateMixin { late AnimationController controller; late Animation animation; String enteredPasscode = ''; @@ -37,10 +32,8 @@ class _PasscodeScreenState extends State @override void initState() { super.initState(); - controller = AnimationController( - duration: const Duration(milliseconds: 300), vsync: this); - final Animation curve = - CurvedAnimation(parent: controller, curve: _ShakeCurve()); + controller = AnimationController(duration: const Duration(milliseconds: 300), vsync: this); + final Animation curve = CurvedAnimation(parent: controller, curve: _ShakeCurve()); animation = Tween(begin: 0.0, end: 10.0).animate(curve as Animation) ..addStatusListener((status) { if (status == AnimationStatus.completed) { @@ -103,9 +96,7 @@ class _PasscodeScreenState extends State for (int i = 0; i < _passwordDigits; i++) Container( margin: const EdgeInsets.all(8), - child: Circle( - filled: i < enteredPasscode.length, - extraSize: animation.value), + child: Circle(filled: i < enteredPasscode.length, extraSize: animation.value), ), ], ), @@ -120,8 +111,7 @@ class _PasscodeScreenState extends State child: CupertinoButton( onPressed: () { if (enteredPasscode.isNotEmpty) { - setState(() => enteredPasscode = enteredPasscode.substring( - 0, enteredPasscode.length - 1)); + setState(() => enteredPasscode = enteredPasscode.substring(0, enteredPasscode.length - 1)); } }, child: Container( diff --git a/lib/screens/authentication/verification/verification_screen.dart b/lib/screens/authentication/verification/verification_screen.dart index 7cc116bf7..80b0d5442 100644 --- a/lib/screens/authentication/verification/verification_screen.dart +++ b/lib/screens/authentication/verification/verification_screen.dart @@ -32,25 +32,20 @@ class VerificationScreen extends StatelessWidget { listenWhen: (_, current) => current.pageCommand != null, listener: (context, state) { final pageCommand = state.pageCommand; - BlocProvider.of(context) - .add(const ClearVerificationPageCommand()); + BlocProvider.of(context).add(const ClearVerificationPageCommand()); if (pageCommand is PasscodeNotMatch) { - eventBus.fire(ShowSnackBar.success( - context.loc.verificationScreenSnackBarError)); + eventBus.fire(ShowSnackBar.success(context.loc.verificationScreenSnackBarError)); } else if (pageCommand is BiometricAuthorized) { if (_isUnpoppable) { // Onboarding or timeout authentication: just unlock - BlocProvider.of(context) - .add(const UnlockWallet()); + BlocProvider.of(context).add(const UnlockWallet()); } Navigator.of(context).pop(true); } else if (pageCommand is PasscodeValid) { - final authenticationBloc = - BlocProvider.of(context); + final authenticationBloc = BlocProvider.of(context); if (state.isCreateMode) { // Enable and save new passcode - authenticationBloc - .add(EnablePasscode(newPasscode: state.newPasscode!)); + authenticationBloc.add(EnablePasscode(newPasscode: state.newPasscode!)); if (_isUnpoppable) { authenticationBloc.add(const UnlockWallet()); } @@ -71,38 +66,28 @@ class VerificationScreen extends StatelessWidget { case PageState.failure: case PageState.success: return PasscodeScreen( - title: Text( - state.passcodeTitle.localizedDescription(context), + title: Text(state.passcodeTitle.localizedDescription(context), style: Theme.of(context).textTheme.titleSmall), onPasscodeCompleted: (passcode) { if (state.isCreateMode && state.newPasscode == null) { - BlocProvider.of(context) - .add(OnPasscodeCreated(passcode)); + BlocProvider.of(context).add(OnPasscodeCreated(passcode)); } else { - BlocProvider.of(context) - .add(OnVerifyPasscode(passcode)); + BlocProvider.of(context).add(OnVerifyPasscode(passcode)); } }, bottomWidget: state.showTryAgainBiometric ? Padding( padding: const EdgeInsets.only(top: 30), child: InkWell( - onTap: () => - BlocProvider.of(context) - .add(const InitBiometricAuth()), + onTap: () => BlocProvider.of(context).add(const InitBiometricAuth()), borderRadius: BorderRadius.circular(16.0), child: Container( - padding: const EdgeInsets.symmetric( - vertical: 8.0, horizontal: 16.0), + padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16.0), - border: - Border.all(color: AppColors.white)), - child: Text( - context.loc.verificationScreenButtonTitle, - style: Theme.of(context) - .textTheme - .titleSmall), + border: Border.all(color: AppColors.white)), + child: Text(context.loc.verificationScreenButtonTitle, + style: Theme.of(context).textTheme.titleSmall), ), ), ) diff --git a/lib/screens/explore_screens/explore/components/flag_user_info_dialog.dart b/lib/screens/explore_screens/explore/components/flag_user_info_dialog.dart index 61a43a892..90a683001 100644 --- a/lib/screens/explore_screens/explore/components/flag_user_info_dialog.dart +++ b/lib/screens/explore_screens/explore/components/flag_user_info_dialog.dart @@ -11,11 +11,9 @@ class FlagUserInfoDialog extends StatelessWidget { @override Widget build(BuildContext context) { return CustomDialog( - icon: const CustomPaint( - size: Size(60, 60), painter: RedExclamationCircle()), + icon: const CustomPaint(size: Size(60, 60), painter: RedExclamationCircle()), children: [ - Text(context.loc.explorerFlagInfoDialogTitle, - style: Theme.of(context).textTheme.button1), + Text(context.loc.explorerFlagInfoDialogTitle, style: Theme.of(context).textTheme.button1), const SizedBox(height: 30.0), Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), diff --git a/lib/screens/explore_screens/flag/flag_user/components/flag_user_confirmation_dialog.dart b/lib/screens/explore_screens/flag/flag_user/components/flag_user_confirmation_dialog.dart index af8aca311..479fbe97a 100644 --- a/lib/screens/explore_screens/flag/flag_user/components/flag_user_confirmation_dialog.dart +++ b/lib/screens/explore_screens/flag/flag_user/components/flag_user_confirmation_dialog.dart @@ -19,18 +19,15 @@ class FlagUserConfirmationDialog extends StatelessWidget { return true; }, child: CustomDialog( - icon: const CustomPaint( - size: Size(60, 60), painter: RedExclamationCircle()), + icon: const CustomPaint(size: Size(60, 60), painter: RedExclamationCircle()), leftButtonTitle: 'Back', rightButtonTitle: "Yes I'm sure", onRightButtonPressed: () { - BlocProvider.of(context) - .add(OnConfirmFlagUserTap()); + BlocProvider.of(context).add(OnConfirmFlagUserTap()); Navigator.of(context).pop(); }, children: [ - Text('Are you sure?', - style: Theme.of(context).textTheme.titleLarge), + Text('Are you sure?', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 10.0), Text( 'Flagging has strong negative consequences so please make sure you are flagging the right person!', @@ -45,14 +42,9 @@ class FlagUserConfirmationDialog extends StatelessWidget { style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( - text: - '${state.selectedProfile?.nickname} (${state.selectedProfile?.account})', - style: Theme.of(context) - .textTheme - .subtitle2Green3LowEmphasis), - TextSpan( - text: '?', - style: Theme.of(context).textTheme.titleSmall), + text: '${state.selectedProfile?.nickname} (${state.selectedProfile?.account})', + style: Theme.of(context).textTheme.subtitle2Green3LowEmphasis), + TextSpan(text: '?', style: Theme.of(context).textTheme.titleSmall), ]), ), ], diff --git a/lib/screens/explore_screens/flag/flags/components/remove_flag_info_dialog.dart b/lib/screens/explore_screens/flag/flags/components/remove_flag_info_dialog.dart index 4c2c93d18..88def3967 100644 --- a/lib/screens/explore_screens/flag/flags/components/remove_flag_info_dialog.dart +++ b/lib/screens/explore_screens/flag/flags/components/remove_flag_info_dialog.dart @@ -16,12 +16,10 @@ class RemoveFlagInfoDialog extends StatelessWidget { leftButtonTitle: 'Back', rightButtonTitle: "Yes I'm sure", onRightButtonPressed: () { - BlocProvider.of(context) - .add(OnRemoveUserFlagTapped(userAccount)); + BlocProvider.of(context).add(OnRemoveUserFlagTapped(userAccount)); Navigator.of(context).pop(); }, - icon: const CustomPaint( - size: Size(60, 60), painter: RedExclamationCircle()), + icon: const CustomPaint(size: Size(60, 60), painter: RedExclamationCircle()), children: [ Text('Are you sure?', style: Theme.of(context).textTheme.button1), const SizedBox(height: 30.0), diff --git a/lib/screens/explore_screens/invite/components/invite_link_dialog.dart b/lib/screens/explore_screens/invite/components/invite_link_dialog.dart index 2de1ae26c..ab3b0ea5c 100644 --- a/lib/screens/explore_screens/invite/components/invite_link_dialog.dart +++ b/lib/screens/explore_screens/invite/components/invite_link_dialog.dart @@ -32,12 +32,9 @@ class _InviteLinkDialogState extends State { child: Center( child: SingleChildScrollView( child: CustomDialog( - icon: SvgPicture.asset( - 'assets/images/security/success_outlined_icon.svg'), + icon: SvgPicture.asset('assets/images/security/success_outlined_icon.svg'), rightButtonTitle: context.loc.inviteLinkDialogRightButtonTitle, - leftButtonTitle: _showCloseDialogButton - ? context.loc.genericCloseButtonTitle - : '', + leftButtonTitle: _showCloseDialogButton ? context.loc.genericCloseButtonTitle : '', onRightButtonPressed: () async { setState(() => _showCloseDialogButton = true); await Share.share(state.dynamicSecretLink!); @@ -46,21 +43,17 @@ class _InviteLinkDialogState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(state.tokenAmount.amountString(), - style: Theme.of(context).textTheme.headlineMedium), + Text(state.tokenAmount.amountString(), style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(top: 12, left: 4), - child: Text(state.tokenAmount.symbol, - style: Theme.of(context).textTheme.titleSmall), + child: Text(state.tokenAmount.symbol, style: Theme.of(context).textTheme.titleSmall), ), ], ), const SizedBox(height: 4.0), - Text(state.fiatAmount.asFormattedString(), - style: Theme.of(context).textTheme.titleSmall), + Text(state.fiatAmount.asFormattedString(), style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 20.0), - QrCodeGeneratorWidget( - data: state.dynamicSecretLink!, size: 254), + QrCodeGeneratorWidget(data: state.dynamicSecretLink!, size: 254), const SizedBox(height: 20.0), Text( context.loc.inviteLinkDialogMessage, diff --git a/lib/screens/explore_screens/invite/invite_screen.dart b/lib/screens/explore_screens/invite/invite_screen.dart index 4e3f0fb2a..9c383047d 100644 --- a/lib/screens/explore_screens/invite/invite_screen.dart +++ b/lib/screens/explore_screens/invite/invite_screen.dart @@ -26,15 +26,13 @@ class InviteScreen extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => InviteBloc(BlocProvider.of(context).state) - ..add(const LoadUserBalance()), + create: (context) => InviteBloc(BlocProvider.of(context).state)..add(const LoadUserBalance()), child: Scaffold( appBar: AppBar( title: Text(context.loc.inviteScreenAppBarTitle), actions: [ TextButton( - onPressed: () => NavigationService.of(context) - .navigateTo(Routes.manageInvites), + onPressed: () => NavigationService.of(context).navigateTo(Routes.manageInvites), child: Text( context.loc.inviteScreenManageInvitesTitle, style: Theme.of(context).textTheme.subtitle2Green3LowEmphasis, @@ -61,8 +59,7 @@ class InviteScreen extends StatelessWidget { ); } if (pageCommand is ShowErrorMessage) { - eventBus.fire(ShowSnackBar( - pageCommand.message.localizedDescription(context))); + eventBus.fire(ShowSnackBar(pageCommand.message.localizedDescription(context))); } }, builder: (context, state) { @@ -80,29 +77,24 @@ class InviteScreen extends StatelessWidget { children: [ SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height - - Scaffold.of(context).appBarMaxHeight!, + height: MediaQuery.of(context).size.height - Scaffold.of(context).appBarMaxHeight!, child: Column( children: [ const SizedBox(height: 16), Text(context.loc.inviteScreenInputAmountTitle, - style: - Theme.of(context).textTheme.titleLarge), + style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 16), AmountEntryWidget( tokenDataModel: TokenDataModel(0), onValueChange: (value) { - BlocProvider.of(context).add( - OnAmountChange(amountChanged: value)); + BlocProvider.of(context).add(OnAmountChange(amountChanged: value)); }, autoFocus: state.isAutoFocus, ), const SizedBox(height: 24), AlertInputValue( - state.errorMessage - ?.localizedDescription(context) ?? - GlobalError.unknown - .localizedDescription(context), + state.errorMessage?.localizedDescription(context) ?? + GlobalError.unknown.localizedDescription(context), isVisible: state.alertMessage != null), const SizedBox(height: 24), BalanceRow( @@ -119,8 +111,7 @@ class InviteScreen extends StatelessWidget { child: FlatButtonLong( title: context.loc.inviteScreenButtonTitle, enabled: state.isCreateInviteButtonEnabled, - onPressed: () => BlocProvider.of(context) - .add(const OnCreateInviteButtonTapped()), + onPressed: () => BlocProvider.of(context).add(const OnCreateInviteButtonTapped()), ), ), ], diff --git a/lib/screens/explore_screens/manage_invites/components/claimed_invite_row.dart b/lib/screens/explore_screens/manage_invites/components/claimed_invite_row.dart index 4628819a6..a67b5ae01 100644 --- a/lib/screens/explore_screens/manage_invites/components/claimed_invite_row.dart +++ b/lib/screens/explore_screens/manage_invites/components/claimed_invite_row.dart @@ -40,17 +40,12 @@ class ClaimedInviteRow extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - (name != null && name?.isNotEmpty == true) - ? name! - : account, + (name != null && name?.isNotEmpty == true) ? name! : account, textAlign: TextAlign.start, style: Theme.of(context).textTheme.labelLarge, ), const SizedBox(height: 8), - Text(account, - style: Theme.of(context) - .textTheme - .subtitle2OpacityEmphasis) + Text(account, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis) ], ), ), diff --git a/lib/screens/explore_screens/plant_seeds/components/plant_seeds_success_dialog.dart b/lib/screens/explore_screens/plant_seeds/components/plant_seeds_success_dialog.dart index a0f38399a..fc9f99854 100644 --- a/lib/screens/explore_screens/plant_seeds/components/plant_seeds_success_dialog.dart +++ b/lib/screens/explore_screens/plant_seeds/components/plant_seeds_success_dialog.dart @@ -25,8 +25,7 @@ class PlantSeedsSuccessDialog extends StatelessWidget { return true; }, child: CustomDialog( - icon: SvgPicture.asset( - 'assets/images/security/success_outlined_icon.svg'), + icon: SvgPicture.asset('assets/images/security/success_outlined_icon.svg'), singleLargeButtonTitle: context.loc.genericCloseButtonTitle, onSingleLargeButtonPressed: () { Navigator.of(context).pop(); @@ -37,29 +36,19 @@ class PlantSeedsSuccessDialog extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - BlocProvider.of(context) - .state - .tokenAmount - .amountString(), + BlocProvider.of(context).state.tokenAmount.amountString(), style: Theme.of(context).textTheme.headlineMedium, ), Padding( padding: const EdgeInsets.only(top: 12, left: 4), - child: Text( - BlocProvider.of(context) - .state - .tokenAmount - .symbol, + child: Text(BlocProvider.of(context).state.tokenAmount.symbol, style: Theme.of(context).textTheme.titleSmall), ), ], ), const SizedBox(height: 4.0), Text( - BlocProvider.of(context) - .state - .fiatAmount - .asFormattedString(), + BlocProvider.of(context).state.fiatAmount.asFormattedString(), style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 30.0), diff --git a/lib/screens/explore_screens/plant_seeds/plant_seeds_screen.dart b/lib/screens/explore_screens/plant_seeds/plant_seeds_screen.dart index 24b50641b..ab1657401 100644 --- a/lib/screens/explore_screens/plant_seeds/plant_seeds_screen.dart +++ b/lib/screens/explore_screens/plant_seeds/plant_seeds_screen.dart @@ -24,9 +24,7 @@ class PlantSeedsScreen extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => - PlantSeedsBloc(BlocProvider.of(context).state) - ..add(const LoadUserBalance()), + create: (context) => PlantSeedsBloc(BlocProvider.of(context).state)..add(const LoadUserBalance()), child: Scaffold( appBar: AppBar(title: Text(context.loc.plantSeedsAppBarTitle)), body: BlocConsumer( @@ -34,23 +32,19 @@ class PlantSeedsScreen extends StatelessWidget { listener: (context, state) { final pageCommand = state.pageCommand; if (pageCommand is ShowPlantSeedsSuccess) { - const PlantSeedsSuccessDialog() - .show(context, BlocProvider.of(context)); + const PlantSeedsSuccessDialog().show(context, BlocProvider.of(context)); } if (pageCommand is ShowError) { - eventBus.fire(ShowSnackBar( - pageCommand.error.localizedDescription(context))); + eventBus.fire(ShowSnackBar(pageCommand.error.localizedDescription(context))); } }, - buildWhen: (previous, current) => - previous.pageState != current.pageState, + buildWhen: (previous, current) => previous.pageState != current.pageState, builder: (context, state) { switch (state.pageState) { case PageState.loading: return const FullPageLoadingIndicator(); case PageState.failure: - return FullPageErrorIndicator( - errorMessage: state.error?.localizedDescription(context)); + return FullPageErrorIndicator(errorMessage: state.error?.localizedDescription(context)); case PageState.success: return SafeArea( minimum: const EdgeInsets.all(horizontalEdgePadding), @@ -58,27 +52,21 @@ class PlantSeedsScreen extends StatelessWidget { children: [ SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height - - Scaffold.of(context).appBarMaxHeight!, + height: MediaQuery.of(context).size.height - Scaffold.of(context).appBarMaxHeight!, child: Column( children: [ const SizedBox(height: 16), - Text(context.loc.plantSeedsPlantAmount, - style: - Theme.of(context).textTheme.titleLarge), + Text(context.loc.plantSeedsPlantAmount, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 16), AmountEntryWidget( tokenDataModel: TokenDataModel(0), onValueChange: (value) { - BlocProvider.of(context).add( - OnAmountChange(amountChanged: value)); + BlocProvider.of(context).add(OnAmountChange(amountChanged: value)); }, autoFocus: state.isAutoFocus, ), const SizedBox(height: 24), - AlertInputValue( - context.loc.plantSeedsNotEnoughBalanceAlert, - isVisible: state.showAlert), + AlertInputValue(context.loc.plantSeedsNotEnoughBalanceAlert, isVisible: state.showAlert), const SizedBox(height: 24), BalanceRow( label: context.loc.plantSeedsAvailableBalance, @@ -97,8 +85,7 @@ class PlantSeedsScreen extends StatelessWidget { ), BlocBuilder( buildWhen: (previous, current) { - return previous.isPlantSeedsButtonEnabled != - current.isPlantSeedsButtonEnabled; + return previous.isPlantSeedsButtonEnabled != current.isPlantSeedsButtonEnabled; }, builder: (context, state) { return Align( @@ -107,8 +94,7 @@ class PlantSeedsScreen extends StatelessWidget { title: context.loc.plantSeedsPlantButtonTitle, enabled: state.isPlantSeedsButtonEnabled, onPressed: () => - BlocProvider.of(context) - .add(const OnPlantSeedsButtonTapped()), + BlocProvider.of(context).add(const OnPlantSeedsButtonTapped()), ), ); }, diff --git a/lib/screens/explore_screens/vouch/vouch_for_a_member/components/vouch_for_member_confirmation_dialog.dart b/lib/screens/explore_screens/vouch/vouch_for_a_member/components/vouch_for_member_confirmation_dialog.dart index ec5bc7a1f..4531dab19 100644 --- a/lib/screens/explore_screens/vouch/vouch_for_a_member/components/vouch_for_member_confirmation_dialog.dart +++ b/lib/screens/explore_screens/vouch/vouch_for_a_member/components/vouch_for_member_confirmation_dialog.dart @@ -19,18 +19,15 @@ class VouchForMemberConfirmationDialog extends StatelessWidget { return true; }, child: CustomDialog( - icon: const CustomPaint( - size: Size(60, 60), painter: VouchWhiteBackground()), + icon: const CustomPaint(size: Size(60, 60), painter: VouchWhiteBackground()), leftButtonTitle: "Cancel", rightButtonTitle: "Yes I'm sure", onRightButtonPressed: () { - BlocProvider.of(context) - .add(OnConfirmVouchForMemberTap()); + BlocProvider.of(context).add(OnConfirmVouchForMemberTap()); Navigator.of(context).pop(); }, children: [ - Text('Please read carefully', - style: Theme.of(context).textTheme.titleLarge), + Text('Please read carefully', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 10.0), Text( 'Vouching for someone means you are taking responsibility for their actions. If they are flagged, you will also lose reputation points. On the other hand, if they continue progressing to become citizens, you will gain reputation points! Choose carefully!', @@ -45,14 +42,9 @@ class VouchForMemberConfirmationDialog extends StatelessWidget { style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( - text: - '${state.selectedMember?.nickname} (${state.selectedMember?.account})', - style: Theme.of(context) - .textTheme - .subtitle2Green3LowEmphasis), - TextSpan( - text: '?', - style: Theme.of(context).textTheme.titleSmall), + text: '${state.selectedMember?.nickname} (${state.selectedMember?.account})', + style: Theme.of(context).textTheme.subtitle2Green3LowEmphasis), + TextSpan(text: '?', style: Theme.of(context).textTheme.titleSmall), ]), ), ], diff --git a/lib/screens/explore_screens/vouch/vouched_tab/components/not_qualified_to_vouch_dialog.dart b/lib/screens/explore_screens/vouch/vouched_tab/components/not_qualified_to_vouch_dialog.dart index 6355e31c1..f2f95c687 100644 --- a/lib/screens/explore_screens/vouch/vouched_tab/components/not_qualified_to_vouch_dialog.dart +++ b/lib/screens/explore_screens/vouch/vouched_tab/components/not_qualified_to_vouch_dialog.dart @@ -8,12 +8,10 @@ class NotQualifiedToVouchDialog extends StatelessWidget { @override Widget build(BuildContext context) { return CustomDialog( - icon: const CustomPaint( - size: Size(60, 60), painter: VouchWhiteBackground()), + icon: const CustomPaint(size: Size(60, 60), painter: VouchWhiteBackground()), singleLargeButtonTitle: "Ok, Thank you!", children: [ - Text('Not qualified to Vouch!', - style: Theme.of(context).textTheme.titleLarge), + Text('Not qualified to Vouch!', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 16.0), Text( 'As a visitor you do not have permission to vouch for another member just yet. Please go through the steps to become a Resident or Citizen to vouch for others members!', diff --git a/lib/screens/profile_screens/citizenship/components/resident_view.dart b/lib/screens/profile_screens/citizenship/components/resident_view.dart index 532daf531..6b29d419f 100644 --- a/lib/screens/profile_screens/citizenship/components/resident_view.dart +++ b/lib/screens/profile_screens/citizenship/components/resident_view.dart @@ -20,8 +20,7 @@ class ResidentView extends StatefulWidget { _ResidentViewState createState() => _ResidentViewState(); } -class _ResidentViewState extends State - with TickerProviderStateMixin { +class _ResidentViewState extends State with TickerProviderStateMixin { late AnimationController _controller; late Animation _timeLineAnimation; late Animation _reputationAnimation; @@ -38,8 +37,7 @@ class _ResidentViewState extends State @override void initState() { - _controller = - AnimationController(duration: const Duration(seconds: 1), vsync: this); + _controller = AnimationController(duration: const Duration(seconds: 1), vsync: this); super.initState(); } @@ -53,46 +51,33 @@ class _ResidentViewState extends State Widget build(BuildContext context) { return BlocConsumer( listenWhen: (previous, current) => - previous.pageState != PageState.success && - current.pageState == PageState.success, + previous.pageState != PageState.success && current.pageState == PageState.success, listener: (context, state) { - _timeLineAnimation = - Tween(begin: 0, end: state.progressTimeline) - .animate(_controller) - ..addListener(() { - setState(() => _timeLine = _timeLineAnimation.value.toInt()); - }); - _reputationAnimation = Tween( - begin: 0, end: state.reputationScore?.toDouble() ?? 0) - .animate(_controller) + _timeLineAnimation = Tween(begin: 0, end: state.progressTimeline).animate(_controller) + ..addListener(() { + setState(() => _timeLine = _timeLineAnimation.value.toInt()); + }); + _reputationAnimation = Tween(begin: 0, end: state.reputationScore?.toDouble() ?? 0).animate(_controller) ..addListener(() { setState(() => _reputation = _reputationAnimation.value.toInt()); }); - _citizenCeremonyAnimation = - Tween(begin: 0, end: state.citizenCeremony!.toDouble()) - .animate(_controller) - ..addListener(() { - setState(() => _citizenCeremony = - _citizenCeremonyAnimation.value.toInt() * 100); - }); - _ageAnimation = - Tween(begin: 0, end: state.profile!.accountAge.toDouble()) - .animate(_controller) - ..addListener(() { - setState(() => _age = _ageAnimation.value.toInt()); - }); - _seedsAnimation = Tween(begin: 0, end: state.plantedSeeds) - .animate(_controller) + _citizenCeremonyAnimation = Tween(begin: 0, end: state.citizenCeremony!.toDouble()).animate(_controller) ..addListener(() { - setState(() => _seeds = _seedsAnimation.value.toInt()); + setState(() => _citizenCeremony = _citizenCeremonyAnimation.value.toInt() * 100); }); - _transactionsAnimation = Tween( - begin: 0, end: state.seedsTransactionsCount?.toDouble()) - .animate(_controller) + _ageAnimation = Tween(begin: 0, end: state.profile!.accountAge.toDouble()).animate(_controller) ..addListener(() { - setState( - () => _transactions = _transactionsAnimation.value.toInt()); + setState(() => _age = _ageAnimation.value.toInt()); }); + _seedsAnimation = Tween(begin: 0, end: state.plantedSeeds).animate(_controller) + ..addListener(() { + setState(() => _seeds = _seedsAnimation.value.toInt()); + }); + _transactionsAnimation = + Tween(begin: 0, end: state.seedsTransactionsCount?.toDouble()).animate(_controller) + ..addListener(() { + setState(() => _transactions = _transactionsAnimation.value.toInt()); + }); _controller.forward(); }, builder: (context, state) { @@ -126,8 +111,7 @@ class _ResidentViewState extends State const SizedBox(height: 8.0), Text( state.profile!.statusString.i18n, - style: - Theme.of(context).textTheme.headline7LowEmphasis, + style: Theme.of(context).textTheme.headline7LowEmphasis, ), ], ), @@ -137,8 +121,7 @@ class _ResidentViewState extends State DecoratedBox( decoration: const BoxDecoration( color: AppColors.lightGreen2, - borderRadius: BorderRadius.all( - Radius.circular(defaultCardBorderRadius)), + borderRadius: BorderRadius.all(Radius.circular(defaultCardBorderRadius)), ), child: Padding( padding: const EdgeInsets.all(16.0), @@ -147,12 +130,8 @@ class _ResidentViewState extends State Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Progress Timeline'.i18n, - style: Theme.of(context).textTheme.labelLarge), - Text('$_timeLine%', - style: Theme.of(context) - .textTheme - .subtitle2LowEmphasis), + Text('Progress Timeline'.i18n, style: Theme.of(context).textTheme.labelLarge), + Text('$_timeLine%', style: Theme.of(context).textTheme.subtitle2LowEmphasis), ], ), const SizedBox(height: 16.0), @@ -178,21 +157,17 @@ class _ResidentViewState extends State childAspectRatio: 0.8, children: [ CircularProgressItem( - icon: SvgPicture.asset( - 'assets/images/citizenship/community.svg'), + icon: SvgPicture.asset('assets/images/citizenship/community.svg'), totalStep: citizenRequiredCitizenVouched * 100, currentStep: _citizenCeremony, circleRadius: 30, title: 'Citizen Ceremony'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, - rate: _citizenCeremony == citizenRequiredCitizenVouched - ? 'Passed' - : 'Waiting', + rate: _citizenCeremony == citizenRequiredCitizenVouched ? 'Passed' : 'Waiting', rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( - icon: SvgPicture.asset( - 'assets/images/citizenship/reputation.svg'), + icon: SvgPicture.asset('assets/images/citizenship/reputation.svg'), totalStep: citizenRequiredReputation, currentStep: _reputation, circleRadius: 30, @@ -202,8 +177,7 @@ class _ResidentViewState extends State rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( - icon: - SvgPicture.asset('assets/images/citizenship/age.svg'), + icon: SvgPicture.asset('assets/images/citizenship/age.svg'), totalStep: citizenRequiredAccountAge, currentStep: _age, circleRadius: 30, @@ -213,8 +187,7 @@ class _ResidentViewState extends State rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( - icon: SvgPicture.asset( - 'assets/images/citizenship/planted.svg'), + icon: SvgPicture.asset('assets/images/citizenship/planted.svg'), totalStep: citizenRequiredPlantedSeeds, currentStep: _seeds, circleRadius: 30, @@ -224,8 +197,7 @@ class _ResidentViewState extends State rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( - icon: SvgPicture.asset( - 'assets/images/citizenship/transaction.svg'), + icon: SvgPicture.asset('assets/images/citizenship/transaction.svg'), totalStep: citizenRequiredSeedsTransactions, currentStep: _transactions, circleRadius: 30, diff --git a/lib/screens/transfer/receive/receive_enter_data/interactor/usecases/receive_seeds_invoice_use_case.dart b/lib/screens/transfer/receive/receive_enter_data/interactor/usecases/receive_seeds_invoice_use_case.dart index 87c137d73..9c2ab2960 100644 --- a/lib/screens/transfer/receive/receive_enter_data/interactor/usecases/receive_seeds_invoice_use_case.dart +++ b/lib/screens/transfer/receive/receive_enter_data/interactor/usecases/receive_seeds_invoice_use_case.dart @@ -6,11 +6,9 @@ import 'package:seeds/domain-shared/base_use_case.dart'; import 'package:seeds/domain-shared/shared_use_cases/cerate_firebase_dynamic_link_use_case.dart'; import 'package:seeds/utils/result_extension.dart'; -class ReceiveSeedsInvoiceUseCase - extends InputUseCase { +class ReceiveSeedsInvoiceUseCase extends InputUseCase { final InvoiceRepository _invoiceRepository = InvoiceRepository(); - final CreateFirebaseDynamicLinkUseCase _firebaseDynamicLinkUseCase = - CreateFirebaseDynamicLinkUseCase(); + final CreateFirebaseDynamicLinkUseCase _firebaseDynamicLinkUseCase = CreateFirebaseDynamicLinkUseCase(); static _Input input({required TokenDataModel tokenAmount, String? memo}) => _Input(tokenAmount: tokenAmount, memo: memo); @@ -27,11 +25,10 @@ class ReceiveSeedsInvoiceUseCase if (invoice.isError) { return Result.error(invoice.asError!.error); } else { - final Result decodedInvoice = await _firebaseDynamicLinkUseCase - .createDynamicLink(invoiceTargetLink, invoice.valueOrCrash); + final Result decodedInvoice = + await _firebaseDynamicLinkUseCase.createDynamicLink(invoiceTargetLink, invoice.valueOrCrash); - return Result.value(ReceiveInvoiceResponse( - invoice.valueOrCrash, decodedInvoice.valueOrNull)); + return Result.value(ReceiveInvoiceResponse(invoice.valueOrCrash, decodedInvoice.valueOrNull)); } } } diff --git a/lib/screens/transfer/send/send_enter_data/interactor/mappers/send_amount_change_mapper.dart b/lib/screens/transfer/send/send_enter_data/interactor/mappers/send_amount_change_mapper.dart index ee7994dbd..ecfa71828 100644 --- a/lib/screens/transfer/send/send_enter_data/interactor/mappers/send_amount_change_mapper.dart +++ b/lib/screens/transfer/send/send_enter_data/interactor/mappers/send_amount_change_mapper.dart @@ -6,33 +6,25 @@ import 'package:seeds/screens/transfer/send/send_enter_data/interactor/viewmodel import 'package:seeds/utils/rate_states_extensions.dart'; class SendAmountChangeMapper extends StateMapper { - SendEnterDataState mapResultToState( - SendEnterDataState currentState, RatesState rateState, String quantity) { + SendEnterDataState mapResultToState(SendEnterDataState currentState, RatesState rateState, String quantity) { final double parsedQuantity = double.tryParse(quantity) ?? 0; - final tokenAmount = - TokenDataModel(parsedQuantity, token: settingsStorage.selectedToken); + final tokenAmount = TokenDataModel(parsedQuantity, token: settingsStorage.selectedToken); final selectedFiat = settingsStorage.selectedFiatCurrency; final fiatAmount = rateState.tokenToFiat(tokenAmount, selectedFiat); final toAccount = currentState.sendTo.account; final double currentAvailable = currentState.availableBalance?.amount ?? 0; - final double insufficiency = - currentState.availableBalance?.asFormattedString() == - tokenAmount.asFormattedString() - ? 0.0 - : parsedQuantity - currentAvailable; + final double insufficiency = currentState.availableBalance?.asFormattedString() == tokenAmount.asFormattedString() + ? 0.0 + : parsedQuantity - currentAvailable; return currentState.copyWith( fiatAmount: fiatAmount, - isNextButtonEnabled: parsedQuantity > 0 && - !settingsStorage.selectedToken - .blockTransfer(insufficiency, toAccount), + isNextButtonEnabled: parsedQuantity > 0 && !settingsStorage.selectedToken.blockTransfer(insufficiency, toAccount), tokenAmount: tokenAmount, - showAlert: settingsStorage.selectedToken - .warnTransfer(insufficiency, toAccount) != - null, + showAlert: settingsStorage.selectedToken.warnTransfer(insufficiency, toAccount) != null, ); } } diff --git a/lib/seeds_app.dart b/lib/seeds_app.dart index 4be9f9525..e55f3ce47 100644 --- a/lib/seeds_app.dart +++ b/lib/seeds_app.dart @@ -22,8 +22,7 @@ class SeedsApp extends StatelessWidget { child: MultiBlocProvider( providers: [ BlocProvider(create: (_) => RootBloc()), - BlocProvider( - create: (_) => AuthenticationBloc()..add(const InitAuthStatus())), + BlocProvider(create: (_) => AuthenticationBloc()..add(const InitAuthStatus())), BlocProvider(create: (_) => RatesBloc()), BlocProvider(create: (_) => DeeplinkBloc()), ], @@ -33,38 +32,27 @@ class SeedsApp extends StatelessWidget { listenWhen: (_, current) => current.busEvent != null, listener: (context, state) { final BusEvent busEvent = state.busEvent!; - BlocProvider.of(context) - .add(const ClearRootBusEvent()); + BlocProvider.of(context).add(const ClearRootBusEvent()); if (busEvent is ShowSnackBar) { final ShowSnackBar event = busEvent; - Snack(event.message, rootScaffoldMessengerKey.currentState, - event.snackType) - .show(); + Snack(event.message, rootScaffoldMessengerKey.currentState, event.snackType).show(); } }, ), BlocListener( - listenWhen: (previous, current) => - previous.inviteLinkData == null && - current.inviteLinkData != null, - listener: (context, _) => - BlocProvider.of(context) - .add(const OnInviteLinkRecived()), + listenWhen: (previous, current) => previous.inviteLinkData == null && current.inviteLinkData != null, + listener: (context, _) => BlocProvider.of(context).add(const OnInviteLinkRecived()), ) ], child: Builder( builder: (context) { final navigator = NavigationService.of(context); return GestureDetector( - onTap: () => BlocProvider.of(context) - .add(const InitAuthTimer()), - onPanDown: (_) => BlocProvider.of(context) - .add(const InitAuthTimer()), - onPanUpdate: (_) => BlocProvider.of(context) - .add(const InitAuthTimer()), + onTap: () => BlocProvider.of(context).add(const InitAuthTimer()), + onPanDown: (_) => BlocProvider.of(context).add(const InitAuthTimer()), + onPanUpdate: (_) => BlocProvider.of(context).add(const InitAuthTimer()), child: MaterialApp( - localizationsDelegates: - AppLocalizations.localizationsDelegates, + localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, theme: SeedsAppTheme.darkTheme, scaffoldMessengerKey: rootScaffoldMessengerKey, @@ -72,10 +60,8 @@ class SeedsApp extends StatelessWidget { onGenerateRoute: navigator.onGenerateRoute, builder: (_, child) { return I18n( - child: - BlocListener( - listenWhen: (previous, current) => - previous.authStatus != current.authStatus, + child: BlocListener( + listenWhen: (previous, current) => previous.authStatus != current.authStatus, listener: (_, state) { switch (state.authStatus) { case AuthStatus.emptyAccount: @@ -90,14 +76,11 @@ class SeedsApp extends StatelessWidget { case AuthStatus.emptyPasscode: case AuthStatus.locked: if (navigator.currentRouteName() == null || - navigator.currentRouteName() == - Routes.importKey || - navigator.currentRouteName() == - Routes.importWords) { + navigator.currentRouteName() == Routes.importKey || + navigator.currentRouteName() == Routes.importWords) { navigator.pushAndRemoveAll(Routes.app); } - navigator - .navigateTo(Routes.verificationUnpoppable); + navigator.navigateTo(Routes.verificationUnpoppable); break; case AuthStatus.unlocked: navigator.pushApp();