diff --git a/README.md b/README.md index a364f24df..a83f14766 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,9 @@ cd seeds_light_wallet flutter pub get flutter run ``` +## Code Rules +- Set line length to 120 in your editor +- Most other rules are definied in the flutter linter file. ## Build diff --git a/analysis_options.yaml b/analysis_options.yaml index 2f44248af..ec00eab70 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -32,7 +32,6 @@ linter: always_put_control_body_on_new_line: true use_string_buffers: false # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 - always_require_non_null_named_parameters: true always_specify_types: false always_use_package_imports: true annotate_overrides: true @@ -97,13 +96,10 @@ linter: hash_and_equals: true implementation_imports: true # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 - iterable_contains_unrelated_type: true # - join_return_with_assignment # not required by flutter style leading_newlines_in_multiline_strings: true library_names: true library_prefixes: true - #- lines_longer_than_80_chars # not required by flutter style - list_remove_unrelated_type: true # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 missing_whitespace_between_adjacent_strings: true no_adjacent_strings_in_list: true @@ -134,7 +130,6 @@ linter: prefer_constructors_over_static_methods: true prefer_contains: true # - prefer_double_quotes # opposite of prefer_single_quotes - prefer_equal_for_default_values: true # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods prefer_final_fields: true prefer_final_in_for_each: true diff --git a/android/app/build.gradle b/android/app/build.gradle index 8ad1f598f..1f682909a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) { def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") + throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e58e83f44..6ee4b2a47 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,12 +8,12 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 1BE62388CD53A0DD11BE7DC7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CE283C5EBBEE4772868880D /* Pods_Runner.framework */; }; 24BE020026BD3995004DF703 /* seeds_logo_font@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 24BE01FF26BD3995004DF703 /* seeds_logo_font@2x.png */; }; 24BE020226BD39D6004DF703 /* seeds_mark@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 24BE020126BD39D6004DF703 /* seeds_mark@2x.png */; }; 24BE020426BD39EA004DF703 /* seeds_flower@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 24BE020326BD39EA004DF703 /* seeds_flower@2x.png */; }; 24CCE17F23B4AC99001456E4 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 24CCE17E23B4AC99001456E4 /* GoogleService-Info.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 6F6A9E5F5A69C0DDAF6B9022 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0FE0612AFD9402558124097 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; @@ -34,6 +34,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0B2E7E85732146DFDDB1319E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 243D697823B4C3DB00BD14A7 /* SEEDS Wallet.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "SEEDS Wallet.entitlements"; sourceTree = ""; }; @@ -42,7 +43,7 @@ 24BE020326BD39EA004DF703 /* seeds_flower@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "seeds_flower@2x.png"; sourceTree = ""; }; 24C2636523B472A1007B4494 /* SEEDS WalletProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "SEEDS WalletProfile.entitlements"; sourceTree = ""; }; 24CCE17E23B4AC99001456E4 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; - 2CE283C5EBBEE4772868880D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2F16F71436E0D5F7B7C65FD0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -54,9 +55,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B11A4EAE3A9A893782AFCAEC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - B6186DBE48D89C12AEF20DDB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - C20B7DCC52A741F5E790E171 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + D0FE0612AFD9402558124097 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DC96C70AEC2A6CE276389E10 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -64,27 +64,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1BE62388CD53A0DD11BE7DC7 /* Pods_Runner.framework in Frameworks */, + 6F6A9E5F5A69C0DDAF6B9022 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 5FCA6F6250AFD43006525538 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 2CE283C5EBBEE4772868880D /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 9596D6FAAAEB03B8CB2392FB /* Pods */ = { isa = PBXGroup; children = ( - B11A4EAE3A9A893782AFCAEC /* Pods-Runner.debug.xcconfig */, - B6186DBE48D89C12AEF20DDB /* Pods-Runner.release.xcconfig */, - C20B7DCC52A741F5E790E171 /* Pods-Runner.profile.xcconfig */, + DC96C70AEC2A6CE276389E10 /* Pods-Runner.debug.xcconfig */, + 2F16F71436E0D5F7B7C65FD0 /* Pods-Runner.release.xcconfig */, + 0B2E7E85732146DFDDB1319E /* Pods-Runner.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -107,7 +99,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 9596D6FAAAEB03B8CB2392FB /* Pods */, - 5FCA6F6250AFD43006525538 /* Frameworks */, + E64266E9FB82FA7DC2EDB89B /* Frameworks */, ); sourceTree = ""; }; @@ -148,6 +140,14 @@ name = "Supporting Files"; sourceTree = ""; }; + E64266E9FB82FA7DC2EDB89B /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0FE0612AFD9402558124097 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -155,15 +155,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - CEF6C8D3E481B30814A07F41 /* [CP] Check Pods Manifest.lock */, + F7B1A7BF35BB321F8CE33792 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - FA988D8D15CE77DA976ACEBD /* [CP] Embed Pods Frameworks */, - FC2EC1C77FA5FA671C3334D7 /* [CP] Copy Pods Resources */, + 008C5F8FC019C1E000A59341 /* [CP] Embed Pods Frameworks */, + B663730435A7BA1588D02121 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -228,60 +228,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - CEF6C8D3E481B30814A07F41 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - FA988D8D15CE77DA976ACEBD /* [CP] Embed Pods Frameworks */ = { + 008C5F8FC019C1E000A59341 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -321,7 +268,6 @@ "${BUILT_PRODUCTS_DIR}/in_app_review/in_app_review.framework", "${BUILT_PRODUCTS_DIR}/leveldb-library/leveldb.framework", "${BUILT_PRODUCTS_DIR}/local_auth_darwin/local_auth_darwin.framework", - "${BUILT_PRODUCTS_DIR}/local_auth_ios/local_auth_ios.framework", "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", "${BUILT_PRODUCTS_DIR}/package_info_plus/package_info_plus.framework", "${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework", @@ -368,7 +314,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/in_app_review.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/leveldb.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth_darwin.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth_ios.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info_plus.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework", @@ -385,7 +330,38 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - FC2EC1C77FA5FA671C3334D7 /* [CP] Copy Pods Resources */ = { + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + B663730435A7BA1588D02121 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -407,6 +383,28 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; showEnvVarsInLog = 0; }; + F7B1A7BF35BB321F8CE33792 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/lib/components/custom_dialog.dart b/lib/components/custom_dialog.dart index 0a65c75c0..90810b9bc 100644 --- a/lib/components/custom_dialog.dart +++ b/lib/components/custom_dialog.dart @@ -126,7 +126,7 @@ class CustomDialog extends StatelessWidget { child: CircleAvatar( backgroundColor: Colors.transparent, radius: _avatarRadius, - child: Container( + child: DecoratedBox( decoration: BoxDecoration( color: AppColors.white, shape: BoxShape.circle, diff --git a/lib/components/error_dialog.dart b/lib/components/error_dialog.dart index e423e4d40..58a9b9ff3 100644 --- a/lib/components/error_dialog.dart +++ b/lib/components/error_dialog.dart @@ -27,11 +27,11 @@ class ErrorDialog extends StatelessWidget { children: [ Text( title, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, overflow: TextOverflow.ellipsis, ), const SizedBox(height: 20.0), - Text(details, style: Theme.of(context).textTheme.subtitle2), + Text(details, style: Theme.of(context).textTheme.titleSmall), ], ); } diff --git a/lib/components/full_page_error_indicator.dart b/lib/components/full_page_error_indicator.dart index fe5e05bd0..66ccf72f8 100644 --- a/lib/components/full_page_error_indicator.dart +++ b/lib/components/full_page_error_indicator.dart @@ -19,7 +19,7 @@ class FullPageErrorIndicator extends StatelessWidget { child: Center( child: Text( errorMessage ?? GlobalError.unknown.localizedDescription(context), - style: Theme.of(context).textTheme.subtitle2!.copyWith(color: AppColors.red1), + style: Theme.of(context).textTheme.titleSmall!.copyWith(color: AppColors.red1), ), ), ), diff --git a/lib/components/member_info_row.dart b/lib/components/member_info_row.dart index 027e0ba1e..477549380 100644 --- a/lib/components/member_info_row.dart +++ b/lib/components/member_info_row.dart @@ -33,12 +33,12 @@ class MemberInfoRow extends StatelessWidget { child: Text( member.nickname.isNotEmpty ? member.nickname : member.account, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ), Text( member.statusString, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ], ), diff --git a/lib/components/search_result_row.dart b/lib/components/search_result_row.dart index 202d41484..c3fd52a52 100644 --- a/lib/components/search_result_row.dart +++ b/lib/components/search_result_row.dart @@ -36,13 +36,13 @@ class SearchResultRow extends StatelessWidget { child: Text( member.nickname.isNotEmpty ? member.nickname : member.account, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ), const SizedBox(width: 10), Text( member.statusString, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ], ), diff --git a/lib/components/search_user/search_user.dart b/lib/components/search_user/search_user.dart index fa29232bd..bd0a886fc 100644 --- a/lib/components/search_user/search_user.dart +++ b/lib/components/search_user/search_user.dart @@ -40,7 +40,7 @@ class SearchUser extends StatelessWidget { child: Column( children: [ const SizedBox(height: 20), - Text(title!, style: Theme.of(context).textTheme.subtitle2), + Text(title!, style: Theme.of(context).textTheme.titleSmall), ], ), ), diff --git a/lib/components/select_picture_box/select_picture_box.dart b/lib/components/select_picture_box/select_picture_box.dart index 541eeb650..1795933e2 100644 --- a/lib/components/select_picture_box/select_picture_box.dart +++ b/lib/components/select_picture_box/select_picture_box.dart @@ -46,7 +46,7 @@ class SelectPictureBox extends StatelessWidget { Row(mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon(Icons.add), const SizedBox(width: 6), - Text(title, style: Theme.of(context).textTheme.subtitle2) + Text(title, style: Theme.of(context).textTheme.titleSmall) ]) ]); case PictureBoxState.imagePicked: diff --git a/lib/components/snack.dart b/lib/components/snack.dart index 6f26c2ebc..ed9941745 100644 --- a/lib/components/snack.dart +++ b/lib/components/snack.dart @@ -24,11 +24,9 @@ class Snack extends SnackBar { return Snack._(title, scaffoldMessengerState, color: color, duration: duration); } - Snack._(this.title, this.scaffoldMessengerState, {Key? key, required Color color, required Duration duration}) + Snack._(this.title, this.scaffoldMessengerState, {required Color color, required super.duration}) : super( - key: key, backgroundColor: color, - duration: duration, content: Row( children: [ Expanded(child: Text(title, textAlign: TextAlign.center)), diff --git a/lib/components/text_form_field_custom.dart b/lib/components/text_form_field_custom.dart index 1f97f74ad..9cade62ad 100644 --- a/lib/components/text_form_field_custom.dart +++ b/lib/components/text_form_field_custom.dart @@ -76,10 +76,10 @@ class TextFormFieldCustom extends StatelessWidget { maxLines: maxLines, enabled: enabled, validator: validator, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, decoration: InputDecoration( suffixText: suffixText, - suffixStyle: Theme.of(context).textTheme.subtitle2, + suffixStyle: Theme.of(context).textTheme.titleSmall, suffixIcon: suffixIcon, focusedBorder: const OutlineInputBorder(borderSide: BorderSide(color: AppColors.canopy)), counterText: counterText, @@ -89,7 +89,7 @@ class TextFormFieldCustom extends StatelessWidget { errorMaxLines: 2, errorStyle: const TextStyle(color: Colors.red, wordSpacing: 4.0), labelStyle: Theme.of(context).textTheme.subtitle3.copyWith(color: AppColors.white), - hintStyle: Theme.of(context).textTheme.button, + hintStyle: Theme.of(context).textTheme.labelLarge, contentPadding: const EdgeInsets.all(16.0), border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), ), diff --git a/lib/crypto/dart_esr/src/encoding_options.dart b/lib/crypto/dart_esr/src/encoding_options.dart index 53c1f7f4b..5cffc801b 100644 --- a/lib/crypto/dart_esr/src/encoding_options.dart +++ b/lib/crypto/dart_esr/src/encoding_options.dart @@ -44,7 +44,7 @@ class DefaultAbiProvider implements AbiProvider { class DefaultTextEncoder implements TextEncoder { @override Uint8List encode(String input) { - return utf8.encode(input) as Uint8List; + return utf8.encode(input); } } diff --git a/lib/crypto/dart_esr/src/signing_request_manager.dart b/lib/crypto/dart_esr/src/signing_request_manager.dart index f8ca35ebe..c791b6df3 100644 --- a/lib/crypto/dart_esr/src/signing_request_manager.dart +++ b/lib/crypto/dart_esr/src/signing_request_manager.dart @@ -470,7 +470,7 @@ class SigningRequestManager { case 'action': return [Action.fromJson(Map.from(req[1]))]; case 'action[]': - print("*** actions: ${req.toString()}"); + print("*** actions: $req"); final actions = req[1] as List; final List resultActions = List.from(actions.map( @@ -674,7 +674,7 @@ class ResolvedSigningRequest { refBlockNnum = int.parse(payload.rbn!); refBlockPrefix = int.parse(payload.rid!); } catch (e) { - print("Error fromPayload: ${e.toString()}"); + print("Error fromPayload: $e"); } return request.resolve( diff --git a/lib/crypto/dart_esr/zlib/src/util/archive_exception.dart b/lib/crypto/dart_esr/zlib/src/util/archive_exception.dart index f648fe217..310fbacf3 100644 --- a/lib/crypto/dart_esr/zlib/src/util/archive_exception.dart +++ b/lib/crypto/dart_esr/zlib/src/util/archive_exception.dart @@ -1,5 +1,4 @@ /// An exception thrown when there was a problem in the archive library. class ArchiveException extends FormatException { - ArchiveException(String message, [dynamic source, int? offset]) - : super(message, source, offset); + ArchiveException(super.message, [super.source, super.offset]); } diff --git a/lib/crypto/eosdart/src/client.dart b/lib/crypto/eosdart/src/client.dart index 0ac06f93a..b3eac76da 100644 --- a/lib/crypto/eosdart/src/client.dart +++ b/lib/crypto/eosdart/src/client.dart @@ -194,7 +194,7 @@ class EOSClient { /// Get required key by transaction from EOS blockchain Future getRequiredKeys(Transaction transaction, List availableKeys) async { final NodeInfo info = await getInfo(); - final Block refBlock = await getBlock((info.headBlockNum).toString()); + final Block refBlock = await getBlock(info.headBlockNum.toString()); Transaction trx = await _fullFill(transaction, refBlock); trx = await _serializeActions(trx); @@ -224,7 +224,7 @@ class EOSClient { /// Get Key Accounts Future getKeyAccounts(String pubKey) async { return _post('/history/get_key_accounts', {'public_key': pubKey}).then((accountNames) { - return AccountNames.fromJson(accountNames); + return AccountNames.fromJson(accountNames as Map); }); } @@ -314,19 +314,6 @@ class EOSClient { return ser.arrayToHex(buffer.asUint8List()); } -// Future> _getTransactionAbis(Transaction transaction) async { -// Set accounts = Set(); -// List result = []; -// -// for (Action action in transaction.actions) { -// accounts.add(action.account); -// } -// -// for (String accountName in accounts) { -// result.add(await this.getRawAbi(accountName)); -// } -// } - Future _pushTransactionArgs( String? chainId, Type transactionType, Transaction transaction, bool sign) async { final List signatures = []; diff --git a/lib/crypto/eosdart/src/models/abi.dart b/lib/crypto/eosdart/src/models/abi.dart index e8439d836..94c569b84 100644 --- a/lib/crypto/eosdart/src/models/abi.dart +++ b/lib/crypto/eosdart/src/models/abi.dart @@ -5,11 +5,11 @@ import 'dart:typed_data'; import 'package:json_annotation/json_annotation.dart'; -import './conversion_helper.dart'; import '../eosdart_base.dart'; import '../jsons.dart'; import '../numeric.dart'; import '../serialize.dart' as ser; +import './conversion_helper.dart'; part 'abi.g.dart'; @@ -65,7 +65,7 @@ class AbiResp with ConversionHelper { var b = t.deserialize!(t, buffer); return Abi.fromJson(json.decode(json.encode(b))); } catch (e) { - print(e.toString()); + print(e); return null; } } diff --git a/lib/crypto/eosdart/src/models/conversion_helper.dart b/lib/crypto/eosdart/src/models/conversion_helper.dart index 6047598bb..af30af620 100644 --- a/lib/crypto/eosdart/src/models/conversion_helper.dart +++ b/lib/crypto/eosdart/src/models/conversion_helper.dart @@ -17,7 +17,7 @@ mixin ConversionHelper { } static Uint8List base64ToBuffer(String base64String) { - return utf8.encode(base64String) as Uint8List; + return utf8.encode(base64String); } static String bufferToBase64(Uint8List buffer) { diff --git a/lib/crypto/eosdart/src/models/transaction.dart b/lib/crypto/eosdart/src/models/transaction.dart index ee61b9580..ad0d1d74d 100644 --- a/lib/crypto/eosdart/src/models/transaction.dart +++ b/lib/crypto/eosdart/src/models/transaction.dart @@ -1,12 +1,13 @@ // ignore_for_file: always_use_package_imports, unnecessary_this, prefer_final_locals import 'dart:typed_data'; + import 'package:json_annotation/json_annotation.dart'; -import './action.dart'; -import './conversion_helper.dart'; import '../eosdart_base.dart'; import '../serialize.dart' as ser; +import './action.dart'; +import './conversion_helper.dart'; part 'transaction.g.dart'; diff --git a/lib/crypto/eosdart/src/numeric.dart b/lib/crypto/eosdart/src/numeric.dart index c9c2e17e4..9bb57df18 100644 --- a/lib/crypto/eosdart/src/numeric.dart +++ b/lib/crypto/eosdart/src/numeric.dart @@ -109,7 +109,7 @@ String binaryToDecimal(Uint8List bignum, {minDigits = 1}) { /// @param minDigits 0-pad result to this many digits String signedBinaryToDecimal(Uint8List bignum, {int minDigits = 1}) { if (isNegative(bignum)) { - var x = bignum.getRange(0, 0) as Uint8List; + var x = Uint8List.fromList(bignum.getRange(0, bignum.length).toList()); negate(x); return '-' + binaryToDecimal(x, minDigits: minDigits); } @@ -244,8 +244,8 @@ Uint8List digestSha256X2(Uint8List data) { IKey stringToKey(String s, KeyType type, int size, String suffix) { var whole = base58ToBinary(size + 4, s); - var result; - var digest; + IKey result; + List digest; if (suffix == '') { result = IKey(type, whole.sublist(1,size)); digest = digestSha256X2(whole.sublist(0,size)); diff --git a/lib/crypto/eosdart/src/serialize.dart b/lib/crypto/eosdart/src/serialize.dart index 8fd2b7218..cddda83ff 100644 --- a/lib/crypto/eosdart/src/serialize.dart +++ b/lib/crypto/eosdart/src/serialize.dart @@ -446,8 +446,8 @@ Type createType( void Function(Type self, SerialBuffer buffer, Object data, {SerializerState state, bool allowExtensions})? serialize, Object? Function(Type self, SerialBuffer buffer, {SerializerState? state, bool? allowExtensions})? deserialize, - String? baseName: "", - List? fields: const [], + String? baseName = "", + List? fields = const [], Type? extensionOf}) { var t = Type( aliasOfName: aliasOfName, diff --git a/lib/crypto/eosdart_ecc/src/key.dart b/lib/crypto/eosdart_ecc/src/key.dart index de49cec30..f99c041ce 100644 --- a/lib/crypto/eosdart_ecc/src/key.dart +++ b/lib/crypto/eosdart_ecc/src/key.dart @@ -157,7 +157,7 @@ class EOSPrivateKey extends EOSKey { /// Sign the string data using the private key EOSSignature signString(String data) { - return sign(utf8.encode(data) as Uint8List); + return sign(utf8.encode(data)); } /// Sign the SHA256 hashed data using the private key diff --git a/lib/crypto/eosdart_ecc/src/key_base.dart b/lib/crypto/eosdart_ecc/src/key_base.dart index 4681c3b16..aff71511c 100644 --- a/lib/crypto/eosdart_ecc/src/key_base.dart +++ b/lib/crypto/eosdart_ecc/src/key_base.dart @@ -33,7 +33,7 @@ abstract class EOSKey { } else { Uint8List check = key; if (keyType != null) { - check = concat(key, utf8.encode(keyType) as Uint8List); + check = concat(key, utf8.encode(keyType)); } newChecksum = RIPEMD160Digest().process(check).sublist(0, 4); } @@ -52,7 +52,7 @@ abstract class EOSKey { Uint8List keyBuffer = key; if (keyType != null) { - keyBuffer = concat(key, utf8.encode(keyType) as Uint8List); + keyBuffer = concat(key, utf8.encode(keyType)); } Uint8List checksum = RIPEMD160Digest().process(keyBuffer).sublist(0, 4); return base58.encode(concat(key, checksum)); diff --git a/lib/datasource/local/biometrics_service.dart b/lib/datasource/local/biometrics_service.dart index 2ddd5aca2..0f155c132 100644 --- a/lib/datasource/local/biometrics_service.dart +++ b/lib/datasource/local/biometrics_service.dart @@ -1,7 +1,7 @@ import 'package:flutter/services.dart' show PlatformException; import 'package:local_auth/local_auth.dart'; import 'package:local_auth_android/local_auth_android.dart'; -import 'package:local_auth_ios/local_auth_ios.dart'; +import 'package:local_auth_darwin/local_auth_darwin.dart'; class BiometricsService { final LocalAuthentication _localAuth; diff --git a/lib/datasource/local/models/token_data_model.dart b/lib/datasource/local/models/token_data_model.dart index b3cc67f4d..b139b4ae8 100644 --- a/lib/datasource/local/models/token_data_model.dart +++ b/lib/datasource/local/models/token_data_model.dart @@ -7,7 +7,8 @@ import 'package:seeds/utils/rate_states_extensions.dart'; class TokenDataModel extends AmountDataModel { String? id; - TokenDataModel(double amount, {TokenModel token = seedsToken}) + final TokenModel token; + TokenDataModel(double amount, {TokenModel this.token = seedsToken}) : super( amount: amount, symbol: token.symbol, @@ -37,7 +38,7 @@ class TokenDataModel extends AmountDataModel { } TokenDataModel copyWith(double amount) { - return TokenDataModel(amount, token: TokenModel.fromId(id!)); + return TokenDataModel(amount, token: token); } } diff --git a/lib/datasource/local/settings_storage.dart b/lib/datasource/local/settings_storage.dart index 7b897b3e0..393386c39 100644 --- a/lib/datasource/local/settings_storage.dart +++ b/lib/datasource/local/settings_storage.dart @@ -73,7 +73,7 @@ class _SettingsStorage { if (storedValue != null && storedValue.split("#").length < 3) { storedValue = "$storedValue#telos"; } - return TokenModel.fromId(storedValue ?? seedsToken.id); + return TokenModel.fromId(storedValue ?? seedsToken.id)!; } bool get inRecoveryMode => _preferences.getBool(_kInRecoveryMode) ?? false; diff --git a/lib/datasource/remote/api/balance_repository.dart b/lib/datasource/remote/api/balance_repository.dart index 9b0d0c534..13692ac48 100644 --- a/lib/datasource/remote/api/balance_repository.dart +++ b/lib/datasource/remote/api/balance_repository.dart @@ -6,7 +6,7 @@ import 'package:seeds/datasource/remote/model/balance_model.dart'; class BalanceRepository extends HttpRepository { Future> getTokenBalance(String userAccount, {required String tokenContract, required String symbol}) { - print('[http] get seeds getTokenBalance $userAccount for $symbol'); + print('[http] get getTokenBalance $userAccount for $symbol'); final String request = ''' { diff --git a/lib/datasource/remote/api/eos_repo/eos_repository.dart b/lib/datasource/remote/api/eos_repo/eos_repository.dart index 9b8dafa02..001072e2f 100644 --- a/lib/datasource/remote/api/eos_repo/eos_repository.dart +++ b/lib/datasource/remote/api/eos_repo/eos_repository.dart @@ -74,7 +74,12 @@ abstract class EosRepository { } ErrorResult mapEosError(dynamic error) { + final regex = RegExp(r'^.*Internal Service Error.*assertion failure with message: ([^\"]*)'); print('mapEosError: $error'); + final match = regex.firstMatch(error); + if (match != null && match.groupCount == 1) { + return ErrorResult("Transaction error:\n${match.group(1)!}"); + } return ErrorResult(error); } } diff --git a/lib/datasource/remote/api/esr_callback_repository.dart b/lib/datasource/remote/api/esr_callback_repository.dart index f2369b079..e5e6efe7f 100644 --- a/lib/datasource/remote/api/esr_callback_repository.dart +++ b/lib/datasource/remote/api/esr_callback_repository.dart @@ -34,11 +34,11 @@ import 'package:seeds/datasource/remote/api/http_repo/http_repository.dart'; /// At the moment can't justify the effort for a generic implementation. class ESRCallbackRepository extends HttpRepository { - Future> callback(String _callbackUrl, String transactionId) { - print("[http] issue callback $_callbackUrl"); + Future> callback(String callbackUrl, String transactionId) { + print("[http] issue callback $callbackUrl"); - final callbackUrl = fillTemplate(_callbackUrl, transactionId); - final uri = Uri.parse(callbackUrl); + final parsedUrl = fillTemplate(callbackUrl, transactionId); + final uri = Uri.parse(parsedUrl); final params = jsonEncode(uri.queryParameters); final postURI = Uri(scheme: uri.scheme, host: uri.host, path: uri.path); diff --git a/lib/datasource/remote/api/guardians_repository.dart b/lib/datasource/remote/api/guardians_repository.dart index a70807ffc..799fb69db 100644 --- a/lib/datasource/remote/api/guardians_repository.dart +++ b/lib/datasource/remote/api/guardians_repository.dart @@ -217,7 +217,7 @@ class GuardiansRepository extends EosRepository with HttpRepository { final permissionsMap = _requiredAuthToJson(permission.requiredAuth!); - print('converted JSPN: ${permissionsMap.toString()}'); + print('converted JSPN: $permissionsMap'); final accountName = settingsStorage.accountName; final actions = [ diff --git a/lib/datasource/remote/api/invite_repository.dart b/lib/datasource/remote/api/invite_repository.dart index f3cc44627..a7308c1a9 100644 --- a/lib/datasource/remote/api/invite_repository.dart +++ b/lib/datasource/remote/api/invite_repository.dart @@ -91,7 +91,7 @@ class InviteRepository extends HttpRepository with EosRepository { print('[http] find invite by hash'); final inviteURL = Uri.parse('$baseURL/v1/chain/get_table_rows'); - // 'https://node.hypha.earth/v1/chain/get_table_rows'; // todo: Why is this still Hypha when config has changed? + // 'https://node.hypha.earth/v1/chain/get_table_rows'; // `todo`: Why is this still Hypha when config has changed? final request = createRequest( code: SeedsCode.accountJoin, diff --git a/lib/datasource/remote/api/invoice_repository.dart b/lib/datasource/remote/api/invoice_repository.dart index 3d56782d9..b4c282ab0 100644 --- a/lib/datasource/remote/api/invoice_repository.dart +++ b/lib/datasource/remote/api/invoice_repository.dart @@ -2,6 +2,7 @@ import 'package:async/async.dart'; import 'package:seeds/crypto/dart_esr/dart_esr.dart' as esr; import 'package:seeds/datasource/local/models/token_data_model.dart'; +import 'package:seeds/datasource/remote/model/token_model.dart'; import 'package:seeds/datasource/remote/api/eos_repo/eos_repository.dart'; import 'package:seeds/datasource/remote/api/eos_repo/seeds_eos_actions.dart'; import 'package:seeds/datasource/remote/firebase/firebase_remote_config.dart'; @@ -17,7 +18,7 @@ class InvoiceRepository extends EosRepository { final Map data = { 'from': esr.ESRConstants.PlaceholderName, 'to': accountName, - 'quantity': tokenAmount.asFormattedString(), + 'quantity': TokenModel.getAssetString(tokenAmount.id, tokenAmount.amount), 'memo': memo ?? '' }; diff --git a/lib/datasource/remote/api/key_accounts_repository.dart b/lib/datasource/remote/api/key_accounts_repository.dart index 75338f362..395085a70 100644 --- a/lib/datasource/remote/api/key_accounts_repository.dart +++ b/lib/datasource/remote/api/key_accounts_repository.dart @@ -3,6 +3,7 @@ import 'package:http/http.dart' as http; import 'package:seeds/datasource/remote/api/http_repo/http_repository.dart'; class KeyAccountsRepository extends HttpRepository { + Future> getKeyAccounts(String publicKey) { print('[http] getKeyAccounts'); @@ -14,7 +15,7 @@ class KeyAccountsRepository extends HttpRepository { .then((http.Response response) => mapHttpResponse(response, (dynamic body) { print('result: $body'); - final result = List.from(body['account_names']); + final result = List.from(body['account_names'] as Iterable); result.sort(); @@ -22,20 +23,23 @@ class KeyAccountsRepository extends HttpRepository { })) .catchError((dynamic error) => mapHttpError(error)); } - +} + // Future> getAccountsByKey(String publicKey) { // print('[http] getAccountsByKey'); // final url = Uri.parse('$baseURL/v1/chain/get_accounts_by_authorizers'); - // final body = '{ "accounts": [], "keys": []"$publicKey"] }'; + // final body = '{ "accounts": [], "keys": ["$publicKey"] }'; // return http // .post(url, headers: headers, body: body) // .then((http.Response response) => mapHttpResponse(response, (dynamic body) { // print('result: $body'); - + // // restriction to `active` permission matches ProfileRepository.getAccountPublicKeys // final result = - // List.from(body['accounts']).map((e) => e['account_name']).toList().toSet().toList(); + // List.from(body['accounts'] as List).cast>() + // .where((e) => e['permission_name'] as String == 'active') + // .map((e) => e['account_name'] as String).toList().toSet().toList(); // result.sort(); @@ -43,4 +47,4 @@ class KeyAccountsRepository extends HttpRepository { // })) // .catchError((dynamic error) => mapHttpError(error)); // } -} + diff --git a/lib/datasource/remote/api/profile_repository.dart b/lib/datasource/remote/api/profile_repository.dart index 20d49431b..772cf0dea 100644 --- a/lib/datasource/remote/api/profile_repository.dart +++ b/lib/datasource/remote/api/profile_repository.dart @@ -37,8 +37,8 @@ class ProfileRepository extends HttpRepository with EosRepository { // TODO(Raul): Unify this code with _getAccountPermissions in guardians repo // Returns the first active key permission - String - Future getAccountPublicKey(String accountName) async { - print('[http] getAccountPublicKey'); + Future getAccountPublicKeys(String accountName) async { + print('[http] getAccountPublicKeys'); final url = Uri.parse('$host/v1/chain/get_account'); final body = '{ "account_name": "$accountName" }'; @@ -50,7 +50,7 @@ class ProfileRepository extends HttpRepository with EosRepository { final permissions = allAccounts.map((item) => Permission.fromJson(item)).toList(); final Permission activePermission = permissions.firstWhere((element) => element.permName == "active"); final RequiredAuth? activeAuth = activePermission.requiredAuth; - return activeAuth?.keys?.first?.key; + return activeAuth?.keys?.map((e)=>e?.key).toList(); })) .catchError((error) => mapHttpError(error)); } diff --git a/lib/datasource/remote/api/stat_repository.dart b/lib/datasource/remote/api/stat_repository.dart new file mode 100644 index 000000000..9b4e9c803 --- /dev/null +++ b/lib/datasource/remote/api/stat_repository.dart @@ -0,0 +1,28 @@ +import 'package:async/async.dart'; +import 'package:http/http.dart' as http; +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}) { + print('[http] get getTokenStat for $symbol'); + + final String request = ''' + { + "code":"$tokenContract", + "table": "stat", + "scope":"$symbol", + "json": "true" + } + '''; + + final statURL = Uri.parse('$baseURL/v1/chain/get_table_rows'); + + return http + .post(statURL, headers: headers, body: request) + .then((http.Response response) => mapHttpResponse(response, (dynamic body) { + return StatModel.fromJson(body); + })) + .catchError((dynamic error) => mapHttpError(error)); + } +} diff --git a/lib/datasource/remote/api/transactions_repository.dart b/lib/datasource/remote/api/transactions_repository.dart index 55fc8be07..69ee80e16 100644 --- a/lib/datasource/remote/api/transactions_repository.dart +++ b/lib/datasource/remote/api/transactions_repository.dart @@ -1,4 +1,5 @@ import 'package:async/async.dart'; +import 'package:collection/collection.dart'; import 'package:http/http.dart' as http; import 'package:seeds/datasource/remote/api/http_repo/http_repository.dart'; import 'package:seeds/datasource/remote/model/transaction_model.dart'; @@ -13,7 +14,7 @@ class TransactionsListRepository extends HttpRepository { .then((http.Response response) => mapHttpResponse>(response, (dynamic body) { final List transfers = body['actions'].toList(); - return List.of(transfers.map((transfer) => TransactionModel.fromJson(transfer))); + return List.of(transfers.map((transfer) => TransactionModel.fromJson(transfer)).whereNotNull()); })) .catchError((dynamic error) => mapHttpError(error)); } diff --git a/lib/datasource/remote/model/stat_model.dart b/lib/datasource/remote/model/stat_model.dart new file mode 100644 index 000000000..70cf8fbdb --- /dev/null +++ b/lib/datasource/remote/model/stat_model.dart @@ -0,0 +1,20 @@ + +/// Token per USD +class StatModel { + final String supplyString; + final String maxSupplyString; + final String issuer; + + const StatModel(this.supplyString, this.maxSupplyString, this.issuer); + + factory StatModel.fromJson(Map? json) { + if (json != null && json['rows'].isNotEmpty) { + final supplyString = json['rows'][0]['supply'] ?? ''; + final maxSupplyString = json['rows'][0]['max_supply'] ?? ''; + final issuer = json['rows'][0]['issuer'] ?? ''; + return StatModel(supplyString, maxSupplyString, issuer); + } else { + return const StatModel('', '', ''); + } + } +} diff --git a/lib/datasource/remote/model/token_model.dart b/lib/datasource/remote/model/token_model.dart index 155708d23..6d760d18c 100644 --- a/lib/datasource/remote/model/token_model.dart +++ b/lib/datasource/remote/model/token_model.dart @@ -14,6 +14,7 @@ class TokenModel extends Equatable { static const seedsEcosysUsecase = 'seedsecosys'; static List allTokens = [seedsToken]; static JsonSchema? tmastrSchema; + static Map contractPrecisions = {"token.seeds#SEEDS": 4}; final String chainName; final String contract; final String symbol; @@ -21,6 +22,7 @@ class TokenModel extends Equatable { final String backgroundImageUrl; final String logoUrl; final String balanceSubTitle; + final String overdraw; final int precision; final List? usecases; @@ -44,6 +46,7 @@ class TokenModel extends Equatable { required this.backgroundImageUrl, required this.logoUrl, required this.balanceSubTitle, + required this.overdraw, this.precision = 4, this.usecases, }); @@ -93,15 +96,16 @@ class TokenModel extends Equatable { symbol: parsedJson["symbol"]!, name: parsedJson["name"]!, logoUrl: parsedJson["logo"]!, - balanceSubTitle: parsedJson["subtitle"], + balanceSubTitle: parsedJson["subtitle"] ?? CurrencyInfoCard.defaultBalanceSubtitle, backgroundImageUrl: parsedJson["bg_image"] ?? CurrencyInfoCard.defaultBgImage, + overdraw: parsedJson["overdraw"] ?? "allow", precision: parsedJson["precision"] ?? 4, usecases: parsedJson["usecases"], ); } - factory TokenModel.fromId(String tokenId) { - return allTokens.firstWhere((e) => e.id == tokenId); + static TokenModel? fromId(String tokenId) { + return allTokens.firstWhereOrNull((e) => e.id == tokenId); } static TokenModel? fromSymbolOrNull(String symbol) { @@ -111,8 +115,38 @@ class TokenModel extends Equatable { @override List get props => [chainName, contract, symbol]; - String getAssetString(double quantity) { - return "${quantity.toStringAsFixed(precision)} $symbol"; + static String getAssetString(String? id, double quantity) { + if (id != null && TokenModel.fromId(id) != null && contractPrecisions.containsKey(id)) { + final symbol = TokenModel.fromId(id)?.symbol; + return symbol == null ? "" : "${quantity.toStringAsFixed(contractPrecisions[id]!)} $symbol"; + } else { + return ""; + } + } + + void setPrecisionFromString(String s) { + final amount = s.split(' ')[0]; + final ss = amount.split('.'); + if (ss.isEmpty) { + return; + } + contractPrecisions[id] = ss.length == 1 ? 0 : ss[1].length; + } + + // enabling 'send' transfer validity checks, e.g. Mutual Credit, + // membership limitations + bool blockTransfer(double insufficiency, String? toAccount) { + if (overdraw == "block") { + return insufficiency > 0; + } else if (overdraw == "allow") { + return false; + } + print("unexpected overdraw field: $overdraw"); + return false; + } + + String? warnTransfer(double insufficiency, String? toAccount) { + return insufficiency > 0 ? "insufficient balance" : null; } static Future updateModels(List acceptList, [List? infoList]) async { @@ -123,7 +157,10 @@ class TokenModel extends Equatable { } final tokenList = tokenListResult.asValue!.value; for (final newtoken in tokenList) { - allTokens.removeWhere((token) => token.id == newtoken.id); + allTokens.removeWhere((token) => + token.contract == newtoken.contract && + token.chainName == newtoken.chainName && + token.symbol == newtoken.symbol); } allTokens.addAll(tokenList); } @@ -138,6 +175,7 @@ class TokenModel extends Equatable { } } allTokens = _staticTokenList; + contractPrecisions = Map.fromEntries(allTokens.map((t) => MapEntry(t.id, t.precision))); } static void pruneRemoving(List useCaseList) { @@ -157,6 +195,7 @@ const seedsToken = TokenModel( backgroundImageUrl: 'assets/images/wallet/currency_info_cards/seeds/background.jpg', logoUrl: 'assets/images/wallet/currency_info_cards/seeds/logo.jpg', balanceSubTitle: 'Wallet Balance', + overdraw: "block", usecases: ["lightwallet", TokenModel.seedsEcosysUsecase], ); @@ -169,6 +208,7 @@ const _husdToken = TokenModel( backgroundImageUrl: 'assets/images/wallet/currency_info_cards/husd/background.jpg', logoUrl: 'assets/images/wallet/currency_info_cards/husd/logo.jpg', balanceSubTitle: 'Wallet Balance', + overdraw: "block", precision: 2, usecases: ["lightwallet", TokenModel.seedsEcosysUsecase], ); @@ -181,6 +221,7 @@ const _hyphaToken = TokenModel( backgroundImageUrl: 'assets/images/wallet/currency_info_cards/hypha/background.jpg', logoUrl: 'assets/images/wallet/currency_info_cards/hypha/logo.jpg', balanceSubTitle: 'Wallet Balance', + overdraw: "block", precision: 2, usecases: ["lightwallet", TokenModel.seedsEcosysUsecase], ); @@ -193,6 +234,7 @@ const _localScaleToken = TokenModel( backgroundImageUrl: 'assets/images/wallet/currency_info_cards/lscl/background.jpg', logoUrl: 'assets/images/wallet/currency_info_cards/lscl/logo.png', balanceSubTitle: 'Wallet Balance', + overdraw: "block", usecases: ["lightwallet"], ); @@ -204,6 +246,7 @@ const _starsToken = TokenModel( backgroundImageUrl: 'assets/images/wallet/currency_info_cards/stars/background.jpg', logoUrl: 'assets/images/wallet/currency_info_cards/stars/logo.jpg', balanceSubTitle: 'Wallet Balance', + overdraw: "block", usecases: ["lightwallet"], ); @@ -215,5 +258,6 @@ const _telosToken = TokenModel( backgroundImageUrl: 'assets/images/wallet/currency_info_cards/tlos/background.png', logoUrl: 'assets/images/wallet/currency_info_cards/tlos/logo.png', balanceSubTitle: 'Wallet Balance', + overdraw: "block", usecases: ["lightwallet"], ); diff --git a/lib/datasource/remote/model/transaction_model.dart b/lib/datasource/remote/model/transaction_model.dart index 1605d848c..c6aa28030 100644 --- a/lib/datasource/remote/model/transaction_model.dart +++ b/lib/datasource/remote/model/transaction_model.dart @@ -25,15 +25,20 @@ class TransactionModel extends Equatable { @override List get props => [transactionId]; - factory TransactionModel.fromJson(Map json) { - return TransactionModel( - from: json['act']['data']['from'], - to: json['act']['data']['to'], - quantity: json['act']['data']['quantity'], - memo: json['act']['data']['memo'], - timestamp: parseTimestamp(json['@timestamp']), - transactionId: json['trx_id'], - ); + static TransactionModel? fromJson(Map json) { + try { + return TransactionModel( + from: json['act']['data']['from'], + to: json['act']['data']['to'], + quantity: json['act']['data']['quantity'], + memo: json['act']['data']['memo'], + timestamp: parseTimestamp(json['@timestamp']), + transactionId: json['trx_id'], + ); + } + catch (e){ + return null; + } } factory TransactionModel.fromJsonMongo(Map json) { diff --git a/lib/design/app_color_schemes.dart b/lib/design/app_color_schemes.dart index c4e38391c..ca5f76020 100644 --- a/lib/design/app_color_schemes.dart +++ b/lib/design/app_color_schemes.dart @@ -6,8 +6,6 @@ class AppColorSchemes { static const ColorScheme darkColorScheme = ColorScheme( surfaceTint: Colors.brown, primaryContainer: Colors.amber, - background: AppColors.primary, - onBackground: AppColors.white, primary: AppColors.purple, secondary: AppColors.green1, surface: AppColors.primary, @@ -37,7 +35,6 @@ class AppColorSchemes { // TODO(gguij004): not completed, to work on it after the darkScheme. static const lightColorScheme = ColorScheme( - background: Colors.amber, primary: Colors.black, secondary: Colors.brown, surface: Colors.purpleAccent, @@ -46,7 +43,6 @@ class AppColorSchemes { onError: Colors.redAccent, brightness: Brightness.light, onSurface: Colors.redAccent, - onBackground: Colors.redAccent, error: Colors.red, ); } diff --git a/lib/design/app_theme.dart b/lib/design/app_theme.dart index e6dd4a57a..1d50bef46 100644 --- a/lib/design/app_theme.dart +++ b/lib/design/app_theme.dart @@ -11,15 +11,14 @@ class SeedsAppTheme { appBarTheme: const AppBarTheme( elevation: 0.0, titleTextStyle: TextStyle(fontSize: 18, fontWeight: FontWeight.w600) // headline7 ), - scaffoldBackgroundColor: AppColorSchemes.darkColorScheme.background, - bottomNavigationBarTheme: - BottomNavigationBarThemeData(backgroundColor: AppColorSchemes.darkColorScheme.background), + scaffoldBackgroundColor: 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.onBackground), + contentTextStyle: TextStyle(color: AppColorSchemes.darkColorScheme.onSurface), ), indicatorColor: AppColorSchemes.darkColorScheme.secondary, ); @@ -58,7 +57,7 @@ class SeedsAppTheme { static ThemeData get darkTheme { return ThemeData( primaryColor: AppColors.primary, - scaffoldBackgroundColor: AppColorSchemes.darkColorScheme.background, + scaffoldBackgroundColor: AppColorSchemes.darkColorScheme.surface, fontFamily: 'SFProDisplay', textTheme: SeedsTextTheme.darkTheme, brightness: Brightness.dark, @@ -101,19 +100,20 @@ class SeedsTextTheme { return Typography.material2018() .englishLike .copyWith( - headline3: - Typography.material2018().englishLike.headline3!.copyWith(fontSize: 42, fontWeight: FontWeight.w600), - headline4: - Typography.material2018().englishLike.headline4!.copyWith(fontSize: 36, fontWeight: FontWeight.w500), - headline5: - Typography.material2018().englishLike.headline5!.copyWith(fontSize: 28, fontWeight: FontWeight.w600), - headline6: - Typography.material2018().englishLike.headline6!.copyWith(fontSize: 22, fontWeight: FontWeight.w500), - subtitle1: - Typography.material2018().englishLike.subtitle1!.copyWith(fontSize: 18, fontWeight: FontWeight.w500), - subtitle2: - Typography.material2018().englishLike.subtitle2!.copyWith(fontSize: 14, fontWeight: FontWeight.w400), - button: Typography.material2018().englishLike.button!.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); } @@ -122,19 +122,20 @@ class SeedsTextTheme { return Typography.material2018() .englishLike .copyWith( - headline3: - Typography.material2018().englishLike.headline3!.copyWith(fontSize: 42, fontWeight: FontWeight.w600), - headline4: - Typography.material2018().englishLike.headline4!.copyWith(fontSize: 36, fontWeight: FontWeight.w500), - headline5: - Typography.material2018().englishLike.headline5!.copyWith(fontSize: 28, fontWeight: FontWeight.w600), - headline6: - Typography.material2018().englishLike.headline6!.copyWith(fontSize: 22, fontWeight: FontWeight.w500), - subtitle1: - Typography.material2018().englishLike.subtitle1!.copyWith(fontSize: 18, fontWeight: FontWeight.w500), - subtitle2: - Typography.material2018().englishLike.subtitle2!.copyWith(fontSize: 14, fontWeight: FontWeight.w400), - button: Typography.material2018().englishLike.button!.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); } @@ -150,26 +151,26 @@ extension CustomStyles on TextTheme { TextStyle get headline8 => const TextStyle(fontSize: 20, fontWeight: FontWeight.w500); TextStyle get subtitle1HighEmphasis => - Typography.material2018().englishLike.subtitle1!.copyWith(fontSize: 18, fontWeight: FontWeight.w600); + Typography.material2018().englishLike.titleMedium!.copyWith(fontSize: 18, fontWeight: FontWeight.w600); TextStyle get subtitle2HighEmphasis => - Typography.material2018().englishLike.subtitle2!.copyWith(fontSize: 14, fontWeight: FontWeight.w500); + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 14, fontWeight: FontWeight.w500); TextStyle get subtitle2LowEmphasis => - Typography.material2018().englishLike.subtitle2!.copyWith(fontSize: 14, fontWeight: FontWeight.w300); + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 14, fontWeight: FontWeight.w300); TextStyle get subtitle2OpacityEmphasis => Typography.material2018() .englishLike - .subtitle2! + .titleSmall! .copyWith(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white.withOpacity(0.5)); TextStyle get subtitle2OpacityBlack => Typography.material2018() .englishLike - .subtitle2! + .titleSmall! .copyWith(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.black.withOpacity(0.5)); TextStyle get subtitle3 => - Typography.material2018().englishLike.subtitle2!.copyWith(fontSize: 12, fontWeight: FontWeight.w400); + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 12, fontWeight: FontWeight.w400); TextStyle get subtitle2Green3LowEmphasis => subtitle2LowEmphasis.copyWith(color: AppColors.green3); @@ -179,11 +180,11 @@ extension CustomStyles on TextTheme { TextStyle get subtitle2BlackLowEmphasis => subtitle2LowEmphasis.copyWith(color: AppColors.black); - TextStyle get subtitle2Black => subtitle2!.copyWith(color: AppColors.black); + TextStyle get subtitle2Black => titleSmall!.copyWith(color: AppColors.black); - TextStyle get subtitle2Green2 => subtitle2!.copyWith(color: AppColors.green2); + TextStyle get subtitle2Green2 => titleSmall!.copyWith(color: AppColors.green2); - TextStyle get subtitle2Darkgreen1L => subtitle2!.copyWith(color: AppColors.primary); + TextStyle get subtitle2Darkgreen1L => titleSmall!.copyWith(color: AppColors.primary); TextStyle get subtitle2OpacityEmphasisBlack => subtitle2OpacityEmphasis.copyWith(color: AppColors.black); @@ -197,7 +198,7 @@ extension CustomStyles on TextTheme { TextStyle get subtitle3OpacityEmphasis => Typography.material2018() .englishLike - .subtitle2! + .titleSmall! .copyWith(fontSize: 13, fontWeight: FontWeight.w400, color: Colors.white.withOpacity(0.5)); TextStyle get subtitle3OpacityEmphasisGreen => subtitle3.copyWith(color: AppColors.green3); @@ -205,50 +206,50 @@ extension CustomStyles on TextTheme { TextStyle get subtitle3OpacityEmphasisRed => subtitle3.copyWith(color: AppColors.red1); TextStyle get subtitle4 => - Typography.material2018().englishLike.subtitle2!.copyWith(fontSize: 13, fontWeight: FontWeight.w400); + Typography.material2018().englishLike.titleSmall!.copyWith(fontSize: 13, fontWeight: FontWeight.w400); TextStyle get buttonHighEmphasis => Typography.material2018() .englishLike - .button! + .labelLarge! .copyWith(fontSize: 16, fontWeight: FontWeight.w500, letterSpacing: 2); TextStyle get buttonOpacityEmphasis => Typography.material2018() .englishLike - .button! + .labelLarge! .copyWith(fontSize: 16, fontWeight: FontWeight.w400, letterSpacing: 2, color: Colors.white.withOpacity(0.5)); TextStyle get buttonLowEmphasis => - Typography.material2018().englishLike.button!.copyWith(fontSize: 16, fontWeight: FontWeight.w400); + Typography.material2018().englishLike.labelLarge!.copyWith(fontSize: 16, fontWeight: FontWeight.w400); TextStyle get button1 => - Typography.material2018().englishLike.button!.copyWith(fontSize: 25, fontWeight: FontWeight.w400); + Typography.material2018().englishLike.labelLarge!.copyWith(fontSize: 25, fontWeight: FontWeight.w400); TextStyle get button1Black => Typography.material2018().englishLike.button1.copyWith(color: AppColors.darkGreen2); - TextStyle get buttonWhiteL => Typography.material2018().englishLike.button!.copyWith(color: AppColors.white); + TextStyle get buttonWhiteL => Typography.material2018().englishLike.labelLarge!.copyWith(color: AppColors.white); - TextStyle get buttonGreen1 => Typography.material2018().englishLike.button!.copyWith(color: AppColors.green1); + TextStyle get buttonGreen1 => Typography.material2018().englishLike.labelLarge!.copyWith(color: AppColors.green1); TextStyle get buttonBlack => Typography.material2018() .englishLike - .button! + .labelLarge! .copyWith(fontSize: 16, fontWeight: FontWeight.w500, color: AppColors.black); TextStyle get headline4Black => Typography.material2018() .englishLike - .headline4! + .headlineMedium! .copyWith(fontSize: 36, fontWeight: FontWeight.w500, color: AppColors.black); TextStyle get headline6Green => Typography.material2018() .englishLike - .headline6! + .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 subtitle1Green1 => - subtitle1!.copyWith(fontSize: 18, fontWeight: FontWeight.w500, letterSpacing: 2, color: AppColors.green1); + titleMedium!.copyWith(fontSize: 18, fontWeight: FontWeight.w500, letterSpacing: 2, color: AppColors.green1); TextStyle get subtitle1Red2 => subtitle1Green1.copyWith(color: AppColors.red1); } diff --git a/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart b/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart index 8ff00fe05..22d7c8518 100644 --- a/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart +++ b/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart @@ -1,4 +1,6 @@ import 'package:collection/collection.dart'; +import 'package:dynamic_parallel_queue/dynamic_parallel_queue.dart'; +import 'package:seeds/datasource/remote/api/stat_repository.dart'; import 'package:seeds/datasource/remote/api/tokenmodels_repository.dart'; import 'package:seeds/datasource/remote/model/token_model.dart'; import 'package:seeds/domain-shared/base_use_case.dart'; @@ -20,25 +22,24 @@ class GetTokenModelsUseCase extends InputUseCase, TokenModelSel Future>> run(TokenModelSelector input) async { print("[http] importing token models"); final idSet = {}; - final useCaseMap = >{} ; + final useCaseMap = >{}; + /// accumulate accepted token id's in idSet /// record valid usecases (from both acceptList and infoList) for each token in useCaseMap - for(final useCase in input.acceptList + (input.infoList ?? [])) { + for (final useCase in input.acceptList + (input.infoList ?? [])) { bool more = true; int lastRetrieved = -1; fetchOneUseCase: - while(more) { - final acceptedTokenIdsResult = await TokenModelsRepository() - .getAcceptedTokenIds(useCase, lastRetrieved+1); - if(acceptedTokenIdsResult.isError) { + while (more) { + final acceptedTokenIdsResult = await TokenModelsRepository().getAcceptedTokenIds(useCase, lastRetrieved + 1); + if (acceptedTokenIdsResult.isError) { break fetchOneUseCase; } final resultValue = acceptedTokenIdsResult.asValue!.value; more = resultValue['more']; final acceptances = resultValue['rows'].toList(); - final tokenIds = List.from( - acceptances.map((row) => row['token_id']).toList()); - if(tokenIds.isEmpty) { + final tokenIds = List.from(acceptances.map((row) => row['token_id']).toList()); + if (tokenIds.isEmpty) { continue; } for (final id in tokenIds) { @@ -56,9 +57,8 @@ class GetTokenModelsUseCase extends InputUseCase, TokenModelSel remainingIds.sort(); bool more = true; final rv = []; - while(more && remainingIds.isNotEmpty) { - final allTokensResult = await TokenModelsRepository() - .getMasterTokenTable(remainingIds[0]); + while (more && remainingIds.isNotEmpty) { + final allTokensResult = await TokenModelsRepository().getMasterTokenTable(remainingIds[0]); if (allTokensResult.isError) { return Result.error("failed to get master token list"); } @@ -74,16 +74,42 @@ class GetTokenModelsUseCase extends InputUseCase, TokenModelSel return false; } }).toList(); + /// retrieve entire list of tokens from master list, then filter by idSet; paginate by "more" for (final token in tokens) { token['usecases'] = useCaseMap[token['id']]; } - final theseTokens =List.from(tokens.map((token) => - TokenModel.fromJson(token))); + final StatRepository _statRepository = StatRepository(); + List theseTokens = []; + + /// verify token contract on chain and get contract precision + loadData(token) async { + TokenModel? tm = TokenModel.fromJson(token as Map); + if (tm != null) { + await _statRepository.getTokenStat(tokenContract: tm.contract, symbol: tm.symbol).then( + (stats) async { + if (stats.asValue != null) { + final supply = stats.asValue!.value.supplyString; + tm.setPrecisionFromString(supply); + theseTokens.add(tm); + print("supply: $supply"); + } + }, + ).catchError((dynamic error) => _statRepository.mapHttpError(error)); + } + } + + final queue = Queue(parallel: 5); + for (final dynamic token in tokens) { + queue.add(() async { + await loadData(token); + }); + } + await queue.whenComplete(); rv.addAll(theseTokens.whereNotNull()); - /// build a TokenModel from each selected token's metadata + + /// build a TokenModel from each selected token's metadata } return Result.value(rv); } - } diff --git a/lib/main.dart b/lib/main.dart index 4a421e449..0b5a5d8c0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,12 +21,12 @@ Future main() async { // for details: https://docs.flutter.dev/testing/errors await runZonedGuarded(() async { WidgetsFlutterBinding.ensureInitialized(); - await dotenv.load(fileName: '.env'); + await dotenv.load(); await Firebase.initializeApp(); await settingsStorage.initialise(); await PushNotificationService().initialise(); await remoteConfigurations.initialise(); - await TokenModel.installModels(['lightwallet','experimental'], [TokenModel.seedsEcosysUsecase]); + await TokenModel.installModels(['localscale','lightwallet','experimental'], [TokenModel.seedsEcosysUsecase]); await Hive.initFlutter(); Hive.registerAdapter(MemberModelCacheItemAdapter()); Hive.registerAdapter(VoteModelAdapter()); diff --git a/lib/screens/app/app.dart b/lib/screens/app/app.dart index dbf06f040..f2d5ee505 100644 --- a/lib/screens/app/app.dart +++ b/lib/screens/app/app.dart @@ -140,7 +140,7 @@ class _AppState extends State with WidgetsBindingObserver { ), bottomNavigationBar: BlocBuilder( builder: (context, state) { - return Container( + return DecoratedBox( decoration: const BoxDecoration(border: Border(top: BorderSide(color: AppColors.white, width: 0.2))), child: BottomNavigationBar( currentIndex: state.index, @@ -149,7 +149,7 @@ class _AppState extends State with WidgetsBindingObserver { unselectedLabelStyle: Theme.of(context).textTheme.subtitle3, selectedItemColor: AppColors.white, items: [ - for (var i in _appScreenItems) + for (final i in _appScreenItems) BottomNavigationBarItem( activeIcon: Padding(padding: const EdgeInsets.only(bottom: 4.0), child: SvgPicture.asset(i.iconSelected)), diff --git a/lib/screens/app/components/account_under_recovery_screen.dart b/lib/screens/app/components/account_under_recovery_screen.dart index 68d499d1a..e27c64f7f 100644 --- a/lib/screens/app/components/account_under_recovery_screen.dart +++ b/lib/screens/app/components/account_under_recovery_screen.dart @@ -33,7 +33,7 @@ class AccountUnderRecoveryScreen extends StatelessWidget { Text( 'Recovery Mode Initiated'.i18n, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), const SizedBox(height: 30), Padding( 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 4fbda1106..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 @@ -40,7 +40,7 @@ class GuardianApproveOrDenyScreen extends StatelessWidget { Text( 'Account Recovery Request'.i18n, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), const SizedBox(height: 30), Padding( diff --git a/lib/screens/app/interactor/viewmodels/connection_notifier.dart b/lib/screens/app/interactor/viewmodels/connection_notifier.dart index 55a432dc0..b74715ac5 100644 --- a/lib/screens/app/interactor/viewmodels/connection_notifier.dart +++ b/lib/screens/app/interactor/viewmodels/connection_notifier.dart @@ -55,7 +55,7 @@ class ConnectionNotifier extends ChangeNotifier { return Endpoint(endpoint, infinitePing); } } catch (err) { - print('error pinging: ${err.toString()}'); + print('error pinging: $err'); return Endpoint(endpoint, doubleInfinitePing); } } 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 a94ab4e3f..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 @@ -57,7 +57,7 @@ class ImportKeyAccountsWidget extends StatelessWidget { ), title: Text( profile.nickname.isNotEmpty ? profile.nickname : profile.account, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), subtitle: Text( profile.account, 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 8c8554d15..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 @@ -56,7 +56,7 @@ class ImportWordsAccountsWidget extends StatelessWidget { ), title: Text( profile.nickname.isNotEmpty ? profile.nickname : profile.account, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), subtitle: Text( profile.account, diff --git a/lib/screens/authentication/import_key/import_key_screen.dart b/lib/screens/authentication/import_key/import_key_screen.dart index 330ac9824..6b8e3c372 100644 --- a/lib/screens/authentication/import_key/import_key_screen.dart +++ b/lib/screens/authentication/import_key/import_key_screen.dart @@ -100,7 +100,7 @@ class _ImportKeyScreenState extends State { padding: const EdgeInsets.all(16.0), child: RichText( text: TextSpan( - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( text: context.loc.importKeyImportUsingRecoveryPhraseActionLink, diff --git a/lib/screens/authentication/import_key/import_words_screen.dart b/lib/screens/authentication/import_key/import_words_screen.dart index 681bd8cce..2e5d40a43 100644 --- a/lib/screens/authentication/import_key/import_words_screen.dart +++ b/lib/screens/authentication/import_key/import_words_screen.dart @@ -113,7 +113,7 @@ class ImportWordsScreen extends StatelessWidget { if (state.userEnteredWords.isEmpty) RichText( text: TextSpan( - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( text: context.loc.importKeyImportUsingPrivateKeyActionLink, diff --git a/lib/screens/authentication/import_key/interactor/usecases/import_key_use_case.dart b/lib/screens/authentication/import_key/interactor/usecases/import_key_use_case.dart index e54625a70..0dbf91ff4 100644 --- a/lib/screens/authentication/import_key/interactor/usecases/import_key_use_case.dart +++ b/lib/screens/authentication/import_key/interactor/usecases/import_key_use_case.dart @@ -12,7 +12,7 @@ class ImportKeyUseCase { final List items = [accountsResponse]; return items; } else { - final List accounts = accountsResponse.asValue!.value; + final List accounts = accountsResponse.asValue!.value.cast(); final List> futures = accounts.map((String account) => _profileRepository.getProfile(account)).toList(); diff --git a/lib/screens/authentication/login_screen.dart b/lib/screens/authentication/login_screen.dart index 73a63c2cb..39c6ae0db 100644 --- a/lib/screens/authentication/login_screen.dart +++ b/lib/screens/authentication/login_screen.dart @@ -33,10 +33,10 @@ class LoginScreen extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(context.loc.loginRecoverAccountActionSegment1, style: Theme.of(context).textTheme.subtitle2), + 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.subtitle2), + Text(context.loc.loginRecoverAccountActionSegment2, style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -59,14 +59,14 @@ class LoginScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(context.loc.loginFirstTimeHere, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.loginFirstTimeHere, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 10), FlatButtonLong( onPressed: () => NavigationService.of(context).navigateTo(Routes.signup), title: context.loc.loginClaimInviteCodeButtonTitle, ), const SizedBox(height: 40), - Text(context.loc.loginAlreadyHaveAnAccount, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.loginAlreadyHaveAnAccount, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 10), FlatButtonLongOutlined( onPressed: () { diff --git a/lib/screens/authentication/onboarding/components/onboarding_pages.dart b/lib/screens/authentication/onboarding/components/onboarding_pages.dart index b52f0da05..b9603877e 100644 --- a/lib/screens/authentication/onboarding/components/onboarding_pages.dart +++ b/lib/screens/authentication/onboarding/components/onboarding_pages.dart @@ -61,9 +61,9 @@ class OnboardingPage extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, style: Theme.of(context).textTheme.headline3), + Text(title, style: Theme.of(context).textTheme.displaySmall), const SizedBox(height: 30), - Text(subTitle, style: Theme.of(context).textTheme.button), + 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 4d464a337..bbe1201b9 100644 --- a/lib/screens/authentication/onboarding/onboarding_screen.dart +++ b/lib/screens/authentication/onboarding/onboarding_screen.dart @@ -77,7 +77,7 @@ class OnboardingState extends State { context.loc.onboardingJoinButtonTitle, maxLines: 2, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, ), ), ), 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 c2ff54b0e..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 @@ -27,7 +27,7 @@ class GuardianRowWidget extends StatelessWidget { ), title: Text( (!guardianModel.nickname.isNullOrEmpty) ? guardianModel.nickname : guardianModel.account, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), 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 ac9628ebe..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,7 +27,7 @@ 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()), child: BlocConsumer( @@ -206,33 +206,33 @@ class RecoverAccountFoundScreen extends StatelessWidget { Row( children: [ Text(state.currentRemainingTime?.hoursFormatted ?? '00', - style: Theme.of(context).textTheme.headline4), + style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(bottom: 6), - child: Text(':', style: Theme.of(context).textTheme.headline4), + child: Text(':', style: Theme.of(context).textTheme.headlineMedium), ) ], ), Row( children: [ Text(state.currentRemainingTime?.minFormatted ?? '00', - style: Theme.of(context).textTheme.headline4), + style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(bottom: 6), - child: Text(':', style: Theme.of(context).textTheme.headline4), + child: Text(':', style: Theme.of(context).textTheme.headlineMedium), ) ], ), Row( children: [ Text('${state.currentRemainingTime?.secFormatted ?? '00'} ', - style: Theme.of(context).textTheme.headline4), + style: Theme.of(context).textTheme.headlineMedium), ], ), Padding( padding: const EdgeInsets.only(top: 14), child: Text(context.loc.recoverAccountFoundHoursLeft, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ) ], ), diff --git a/lib/screens/authentication/recover/recover_account_search/recover_account_search_screen.dart b/lib/screens/authentication/recover/recover_account_search/recover_account_search_screen.dart index 79c741d59..f857d80d1 100644 --- a/lib/screens/authentication/recover/recover_account_search/recover_account_search_screen.dart +++ b/lib/screens/authentication/recover/recover_account_search/recover_account_search_screen.dart @@ -78,7 +78,7 @@ class _RecoverAccountSearchScreenState extends State }, ), if (state.accountFound) - Container( + DecoratedBox( decoration: BoxDecoration( color: AppColors.darkGreen2, borderRadius: BorderRadius.circular(defaultCardBorderRadius), 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 173f0fdfa..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,12 +12,12 @@ 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.headline6), + Text(context.loc.signUpInviteCodeErrorTitle, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 24.0), Text( context.loc.signUpInviteCodeErrorDescription, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 16.0), ], diff --git a/lib/screens/authentication/verification/components/keyboard.dart b/lib/screens/authentication/verification/components/keyboard.dart index c7aca860a..d0bee3045 100644 --- a/lib/screens/authentication/verification/components/keyboard.dart +++ b/lib/screens/authentication/verification/components/keyboard.dart @@ -27,13 +27,13 @@ class Keyboard extends StatelessWidget { child: InkWell( splashColor: Colors.white.withOpacity(0.4), onTap: () => onDigitTapped(i), - child: Container( + child: DecoratedBox( decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.transparent, border: Border.all(color: Colors.white), ), - child: Container( + child: DecoratedBox( decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.transparent), child: Center( child: Text(i, style: const TextStyle(fontSize: 30, color: Colors.white), semanticsLabel: i), diff --git a/lib/screens/authentication/verification/components/passcode_created_dialog.dart b/lib/screens/authentication/verification/components/passcode_created_dialog.dart index 88f37dcb0..7ab4fe946 100644 --- a/lib/screens/authentication/verification/components/passcode_created_dialog.dart +++ b/lib/screens/authentication/verification/components/passcode_created_dialog.dart @@ -22,7 +22,7 @@ class PasscodeCreatedDialog extends StatelessWidget { Text( context.loc.verificationPasscodeDialogSubTitle, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 30.0), ], diff --git a/lib/screens/authentication/verification/components/passcode_screen.dart b/lib/screens/authentication/verification/components/passcode_screen.dart index 3292f9a3b..6718d460c 100644 --- a/lib/screens/authentication/verification/components/passcode_screen.dart +++ b/lib/screens/authentication/verification/components/passcode_screen.dart @@ -119,7 +119,7 @@ class _PasscodeScreenState extends State with SingleTickerProvid child: enteredPasscode.isEmpty ? const SizedBox.shrink() : Text(context.loc.verificationPasscodeScreenButtonTitle, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ), ), ), diff --git a/lib/screens/authentication/verification/verification_screen.dart b/lib/screens/authentication/verification/verification_screen.dart index f9116af65..80b0d5442 100644 --- a/lib/screens/authentication/verification/verification_screen.dart +++ b/lib/screens/authentication/verification/verification_screen.dart @@ -87,7 +87,7 @@ class VerificationScreen extends StatelessWidget { borderRadius: BorderRadius.circular(16.0), border: Border.all(color: AppColors.white)), child: Text(context.loc.verificationScreenButtonTitle, - style: Theme.of(context).textTheme.subtitle2), + 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 166b9432b..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 @@ -22,13 +22,13 @@ class FlagUserInfoDialog extends StatelessWidget { Text( context.loc.explorerFlagInfoDialogSubTitle, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 36.0), Text( context.loc.explorerFlagInfoDialogSubTitlePartTwo, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 36.0), FlatButtonLong( 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 ef82b7ef3..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 @@ -27,11 +27,11 @@ class FlagUserConfirmationDialog extends StatelessWidget { Navigator.of(context).pop(); }, children: [ - Text('Are you sure?', style: Theme.of(context).textTheme.headline6), + 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!', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center, ), const SizedBox(height: 20.0), @@ -39,12 +39,12 @@ class FlagUserConfirmationDialog extends StatelessWidget { textAlign: TextAlign.center, text: TextSpan( text: 'Are you sure you would like to flag ', - style: Theme.of(context).textTheme.subtitle2, + 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.subtitle2), + 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 b58abcbdd..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 @@ -30,7 +30,7 @@ class RemoveFlagInfoDialog extends StatelessWidget { Text( 'Removing the Flag means you believe the member is now acting in good faith. Penalties will be removed from the member. ', textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 20.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 d1b60277b..ab3b0ea5c 100644 --- a/lib/screens/explore_screens/invite/components/invite_link_dialog.dart +++ b/lib/screens/explore_screens/invite/components/invite_link_dialog.dart @@ -43,22 +43,22 @@ class _InviteLinkDialogState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(state.tokenAmount.amountString(), style: Theme.of(context).textTheme.headline4), + 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.subtitle2), + 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.subtitle2), + Text(state.fiatAmount.asFormattedString(), style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 20.0), QrCodeGeneratorWidget(data: state.dynamicSecretLink!, size: 254), const SizedBox(height: 20.0), Text( context.loc.inviteLinkDialogMessage, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ], ), diff --git a/lib/screens/explore_screens/invite/invite_screen.dart b/lib/screens/explore_screens/invite/invite_screen.dart index 4b1fb258b..9c383047d 100644 --- a/lib/screens/explore_screens/invite/invite_screen.dart +++ b/lib/screens/explore_screens/invite/invite_screen.dart @@ -82,7 +82,7 @@ class InviteScreen extends StatelessWidget { children: [ const SizedBox(height: 16), Text(context.loc.inviteScreenInputAmountTitle, - style: Theme.of(context).textTheme.headline6), + style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 16), AmountEntryWidget( tokenDataModel: TokenDataModel(0), 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 b3cefc625..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 @@ -42,7 +42,7 @@ class ClaimedInviteRow extends StatelessWidget { Text( (name != null && name?.isNotEmpty == true) ? name! : account, textAlign: TextAlign.start, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), const SizedBox(height: 8), 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 82dc95de7..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 @@ -37,25 +37,25 @@ class PlantSeedsSuccessDialog extends StatelessWidget { children: [ Text( BlocProvider.of(context).state.tokenAmount.amountString(), - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), Padding( padding: const EdgeInsets.only(top: 12, left: 4), child: Text(BlocProvider.of(context).state.tokenAmount.symbol, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ), ], ), const SizedBox(height: 4.0), Text( BlocProvider.of(context).state.fiatAmount.asFormattedString(), - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 30.0), Text( context.loc.plantSeedsPlantSuccessMessage, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ], ), 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 7a49a0c8d..ab1657401 100644 --- a/lib/screens/explore_screens/plant_seeds/plant_seeds_screen.dart +++ b/lib/screens/explore_screens/plant_seeds/plant_seeds_screen.dart @@ -56,7 +56,7 @@ class PlantSeedsScreen extends StatelessWidget { child: Column( children: [ const SizedBox(height: 16), - Text(context.loc.plantSeedsPlantAmount, style: Theme.of(context).textTheme.headline6), + Text(context.loc.plantSeedsPlantAmount, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 16), AmountEntryWidget( tokenDataModel: TokenDataModel(0), diff --git a/lib/screens/explore_screens/regions_screens/create_region_event_screens/components/review_and_publish_region_event_bottom.dart b/lib/screens/explore_screens/regions_screens/create_region_event_screens/components/review_and_publish_region_event_bottom.dart index 3d8f72eee..0716ce909 100644 --- a/lib/screens/explore_screens/regions_screens/create_region_event_screens/components/review_and_publish_region_event_bottom.dart +++ b/lib/screens/explore_screens/regions_screens/create_region_event_screens/components/review_and_publish_region_event_bottom.dart @@ -14,7 +14,7 @@ class ReviewAndPublishRegionEventBottom extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Details", style: Theme.of(context).textTheme.headline6), + Text("Details", style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 16), Row( children: [ @@ -23,7 +23,7 @@ class ReviewAndPublishRegionEventBottom extends StatelessWidget { ], ), const SizedBox(height: 16), - Text(state.eventDescription, style: Theme.of(context).textTheme.subtitle2) + Text(state.eventDescription, style: Theme.of(context).textTheme.titleSmall) ], ), ); diff --git a/lib/screens/explore_screens/regions_screens/create_region_event_screens/review_and_publish_region_event.dart b/lib/screens/explore_screens/regions_screens/create_region_event_screens/review_and_publish_region_event.dart index db313421f..3cbdf1f71 100644 --- a/lib/screens/explore_screens/regions_screens/create_region_event_screens/review_and_publish_region_event.dart +++ b/lib/screens/explore_screens/regions_screens/create_region_event_screens/review_and_publish_region_event.dart @@ -26,14 +26,14 @@ class ReviewAndPublishRegionEvent extends StatelessWidget { minimum: const EdgeInsets.only(bottom: 16), child: Stack( children: [ - SingleChildScrollView( + const SingleChildScrollView( child: Column( children: [ - const ReviewAndPublishRegionEventHeader(), - const ReviewAndPublishRegionEventMiddle(), - const DividerJungle(), - const ReviewAndPublishRegionEventBottom(), - const SizedBox(height: 60) + ReviewAndPublishRegionEventHeader(), + ReviewAndPublishRegionEventMiddle(), + DividerJungle(), + ReviewAndPublishRegionEventBottom(), + SizedBox(height: 60) ], ), ), diff --git a/lib/screens/explore_screens/regions_screens/create_region_screens/components/create_region_confirmation_dialog.dart b/lib/screens/explore_screens/regions_screens/create_region_screens/components/create_region_confirmation_dialog.dart index 3129d87c2..cb27ff28a 100644 --- a/lib/screens/explore_screens/regions_screens/create_region_screens/components/create_region_confirmation_dialog.dart +++ b/lib/screens/explore_screens/regions_screens/create_region_screens/components/create_region_confirmation_dialog.dart @@ -25,20 +25,20 @@ class CreateRegionConfirmationDialog extends StatelessWidget { }, children: [ const SizedBox(height: 10.0), - Text("Create Region Confirmation", style: Theme.of(context).textTheme.headline6), + Text("Create Region Confirmation", style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), RichText( textAlign: TextAlign.center, text: TextSpan(children: [ - TextSpan(text: "By selecting “Yes I’m sure”,", style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: "By selecting “Yes I’m sure”,", style: Theme.of(context).textTheme.titleSmall), TextSpan(text: " 1,000 Seeds", style: Theme.of(context).textTheme.subtitle2Green3LowEmphasis), TextSpan( text: " will be staked and your region will be created for others to see and join.", - style: Theme.of(context).textTheme.subtitle2) + style: Theme.of(context).textTheme.titleSmall) ])), const SizedBox(height: 16.0), Text("Please make sure that everything is in order and that you are ready to create your region!", - style: Theme.of(context).textTheme.subtitle2, textAlign: TextAlign.center), + style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center), const SizedBox(height: 20.0), ], ), diff --git a/lib/screens/explore_screens/regions_screens/join_region/components/create_new_region_dialog.dart b/lib/screens/explore_screens/regions_screens/join_region/components/create_new_region_dialog.dart index a7e89b529..7f35edc1b 100644 --- a/lib/screens/explore_screens/regions_screens/join_region/components/create_new_region_dialog.dart +++ b/lib/screens/explore_screens/regions_screens/join_region/components/create_new_region_dialog.dart @@ -31,13 +31,13 @@ class CreateNewRegionDialog extends StatelessWidget { BlocProvider.of(context).add(const OnCreateRegionNextTapped()); }, children: [ - Text(context.loc.createRegionDialogTitle, style: Theme.of(context).textTheme.headline6), + Text(context.loc.createRegionDialogTitle, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), Container(width: iconSize, height: iconSize, child: const CustomPaint(painter: Regions())), const SizedBox(height: 30.0), Text( context.loc.createRegionDialogSubtitle, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center, ), const SizedBox(height: 20.0), diff --git a/lib/screens/explore_screens/regions_screens/join_region/components/introducing_regions_dialog.dart b/lib/screens/explore_screens/regions_screens/join_region/components/introducing_regions_dialog.dart index f8759f831..596d76820 100644 --- a/lib/screens/explore_screens/regions_screens/join_region/components/introducing_regions_dialog.dart +++ b/lib/screens/explore_screens/regions_screens/join_region/components/introducing_regions_dialog.dart @@ -24,7 +24,7 @@ class IntroducingRegionsDialog extends StatelessWidget { Navigator.of(context).pop(true); }, children: [ - Text(context.loc.introducingRegionsDialogTitle, style: Theme.of(context).textTheme.headline6), + Text(context.loc.introducingRegionsDialogTitle, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), const CustomPaint(size: Size(103, 106), painter: Regions()), const SizedBox(height: 40.0), @@ -33,31 +33,31 @@ class IntroducingRegionsDialog extends StatelessWidget { children: [ TextSpan( text: context.loc.introducingRegionsDialogDescription1, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), TextSpan( text: context.loc.introducingRegionsDialogDescription2, style: Theme.of(context).textTheme.subtitle2HighEmphasis), TextSpan( text: context.loc.introducingRegionsDialogDescription3, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), TextSpan( text: context.loc.introducingRegionsDialogDescription4, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), TextSpan( text: context.loc.introducingRegionsDialogDescription5, style: Theme.of(context).textTheme.subtitle2Green2), TextSpan( text: context.loc.introducingRegionsDialogDescription6, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), TextSpan( text: context.loc.introducingRegionsDialogDescription7, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), TextSpan( text: ' ${context.loc.genericNextButtonTitle} ', style: Theme.of(context).textTheme.subtitle2Green2), TextSpan( text: context.loc.introducingRegionsDialogDescription8, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ], ), ), diff --git a/lib/screens/explore_screens/regions_screens/join_region/components/not_enough_seeds_dialog.dart b/lib/screens/explore_screens/regions_screens/join_region/components/not_enough_seeds_dialog.dart index 9fb06c544..61afcdb4d 100644 --- a/lib/screens/explore_screens/regions_screens/join_region/components/not_enough_seeds_dialog.dart +++ b/lib/screens/explore_screens/regions_screens/join_region/components/not_enough_seeds_dialog.dart @@ -27,11 +27,11 @@ class NotEnoughSeedsDialog extends StatelessWidget { onRightButtonPressed: () => launchUrl(Uri.parse('$urlBuySeeds${settingsStorage.accountName}')), children: [ const SizedBox(height: 10.0), - Text(context.loc.createRegionNotEnoughSeedsDialogTitle, style: Theme.of(context).textTheme.headline6), + Text(context.loc.createRegionNotEnoughSeedsDialogTitle, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), Text( context.loc.createRegionNotEnoughSeedsDialogSubtitle, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center, ), const SizedBox(height: 20.0), diff --git a/lib/screens/explore_screens/regions_screens/join_region/interactor/viewmodels/join_region_bloc.dart b/lib/screens/explore_screens/regions_screens/join_region/interactor/viewmodels/join_region_bloc.dart index 72008030b..318ac0d15 100644 --- a/lib/screens/explore_screens/regions_screens/join_region/interactor/viewmodels/join_region_bloc.dart +++ b/lib/screens/explore_screens/regions_screens/join_region/interactor/viewmodels/join_region_bloc.dart @@ -40,7 +40,7 @@ class JoinRegionBloc extends Bloc { Future _onCreateRegionTapped(OnCreateRegionTapped event, Emitter emit) async { emit(state.copyWith(isCreateRegionButtonLoading: true)); - final result = await GetAvailableBalanceUseCase().run(TokenModel.fromId(seedsToken.id)); + final result = await GetAvailableBalanceUseCase().run(seedsToken); emit(CreateRegionBalanceResultStateMapper().mapResultToState(state, result)); } diff --git a/lib/screens/explore_screens/regions_screens/region_event_details/region_event_details_screen.dart b/lib/screens/explore_screens/regions_screens/region_event_details/region_event_details_screen.dart index 79f4da57c..b07fbb64a 100644 --- a/lib/screens/explore_screens/regions_screens/region_event_details/region_event_details_screen.dart +++ b/lib/screens/explore_screens/regions_screens/region_event_details/region_event_details_screen.dart @@ -148,7 +148,7 @@ class RegionEventDetailsScreen extends StatelessWidget { children: [ Text('Details', style: Theme.of(context).textTheme.headline7), const SizedBox(height: 10.0), - Text(event.eventAddress, style: Theme.of(context).textTheme.subtitle2), + Text(event.eventAddress, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 16.0), Row( children: [ diff --git a/lib/screens/explore_screens/regions_screens/regions_main/components/generic_region_dialog.dart b/lib/screens/explore_screens/regions_screens/regions_main/components/generic_region_dialog.dart index 05aa4eabb..23c199772 100644 --- a/lib/screens/explore_screens/regions_screens/regions_main/components/generic_region_dialog.dart +++ b/lib/screens/explore_screens/regions_screens/regions_main/components/generic_region_dialog.dart @@ -21,9 +21,9 @@ class GenericRegionDialog extends StatelessWidget { rightButtonTitle: context.loc.genericRegionConfirmImSureButton, onRightButtonPressed: () => Navigator.of(context).pop(true), children: [ - Text(title, style: Theme.of(context).textTheme.headline6), + Text(title, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 40.0), - Text(description, style: Theme.of(context).textTheme.subtitle2), + Text(description, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 20.0), ], ); diff --git a/lib/screens/explore_screens/regions_screens/regions_main/components/region_event_card/region_event_card.dart b/lib/screens/explore_screens/regions_screens/regions_main/components/region_event_card/region_event_card.dart index 404ca88f2..afa420031 100644 --- a/lib/screens/explore_screens/regions_screens/regions_main/components/region_event_card/region_event_card.dart +++ b/lib/screens/explore_screens/regions_screens/regions_main/components/region_event_card/region_event_card.dart @@ -27,7 +27,7 @@ class RegionEventCard extends StatelessWidget { child: InkWell( onTap: () => NavigationService.of(context).navigateTo(Routes.regionEventDetails, event), borderRadius: BorderRadius.circular(16.0), - child: Container( + child: DecoratedBox( decoration: state.isEventExpired ? BoxDecoration( borderRadius: BorderRadius.circular(16.0), @@ -65,7 +65,7 @@ class RegionEventCard extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6), child: Text( "The event has passed", - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), ), diff --git a/lib/screens/explore_screens/unplant_seeds/components/claim_seeds_succes_dialog.dart b/lib/screens/explore_screens/unplant_seeds/components/claim_seeds_succes_dialog.dart index 09457fd5a..4010a14e3 100644 --- a/lib/screens/explore_screens/unplant_seeds/components/claim_seeds_succes_dialog.dart +++ b/lib/screens/explore_screens/unplant_seeds/components/claim_seeds_succes_dialog.dart @@ -33,22 +33,22 @@ class ClaimSeedsSuccessDialog extends StatelessWidget { children: [ Text( claimSeedsAmount.amountString(), - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), Padding( padding: const EdgeInsets.only(top: 12, left: 4), - child: Text(claimSeedsAmount.symbol, style: Theme.of(context).textTheme.subtitle2), + child: Text(claimSeedsAmount.symbol, style: Theme.of(context).textTheme.titleSmall), ), ], ), const SizedBox(height: 4.0), Text( claimSeedsAmountFiat.asFormattedString(), - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 20.0), Text(context.loc.plantSeedsClaimSuccessMessage, - textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline6), + textAlign: TextAlign.center, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 20.0), ], ), diff --git a/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_amount_entry.dart b/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_amount_entry.dart index dba44129c..ee0acf332 100644 --- a/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_amount_entry.dart +++ b/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_amount_entry.dart @@ -33,7 +33,7 @@ class UnplantSeedsAmountEntry extends StatelessWidget { child: TextFormField( controller: controller, textAlign: TextAlign.end, - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, keyboardType: const TextInputType.numberWithOptions(decimal: true), decoration: const InputDecoration( hintText: "0.0", diff --git a/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_success_dialog.dart b/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_success_dialog.dart index a4648a73e..982b1fb66 100644 --- a/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_success_dialog.dart +++ b/lib/screens/explore_screens/unplant_seeds/components/unplant_seeds_success_dialog.dart @@ -36,27 +36,27 @@ class UnplantSeedsSuccessDialog extends StatelessWidget { children: [ Text( unplantedInputAmount.amountString(), - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), Padding( padding: const EdgeInsets.only(top: 12, left: 4), - child: Text(unplantedInputAmount.symbol, style: Theme.of(context).textTheme.subtitle2), + child: Text(unplantedInputAmount.symbol, style: Theme.of(context).textTheme.titleSmall), ), ], ), const SizedBox(height: 4.0), Text( unplantedInputAmountFiat.asFormattedString(), - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 20.0), Text(context.loc.plantSeedsUnplantSuccessMessage, - textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline6), + textAlign: TextAlign.center, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 20.0), Text( context.loc.plantSeedsUnplantExplanationMessage, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ], ), diff --git a/lib/screens/explore_screens/unplant_seeds/interactor/viewmodels/unplant_seeds_state.dart b/lib/screens/explore_screens/unplant_seeds/interactor/viewmodels/unplant_seeds_state.dart index eaf812e75..c2bcd840c 100644 --- a/lib/screens/explore_screens/unplant_seeds/interactor/viewmodels/unplant_seeds_state.dart +++ b/lib/screens/explore_screens/unplant_seeds/interactor/viewmodels/unplant_seeds_state.dart @@ -96,7 +96,7 @@ class UnplantSeedsState extends Equatable { ); } - factory UnplantSeedsState.initial(RatesState ratesState, bool featureFlagDelegateEnabled) { + factory UnplantSeedsState.initial(RatesState ratesState, bool claimUnplantedSeedsEnabled) { return UnplantSeedsState( pageState: PageState.success, ratesState: ratesState, @@ -106,7 +106,7 @@ class UnplantSeedsState extends Equatable { showMinPlantedBalanceAlert: false, isUnplantSeedsButtonEnabled: false, unplantedInputAmount: TokenDataModel(0), - showUnclaimedBalance: featureFlagDelegateEnabled, + showUnclaimedBalance: claimUnplantedSeedsEnabled, isClaimButtonEnabled: false, ); } diff --git a/lib/screens/explore_screens/unplant_seeds/unplant_seeds_screen.dart b/lib/screens/explore_screens/unplant_seeds/unplant_seeds_screen.dart index ec7e47f5e..aa4590c57 100644 --- a/lib/screens/explore_screens/unplant_seeds/unplant_seeds_screen.dart +++ b/lib/screens/explore_screens/unplant_seeds/unplant_seeds_screen.dart @@ -96,7 +96,7 @@ class _UnplantSeedsScreenState extends State { child: Column( children: [ const SizedBox(height: 26), - Text('Unplant amount', style: Theme.of(context).textTheme.headline6), + Text('Unplant amount', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 16), UnplantSeedsAmountEntry( controller: _amountController, diff --git a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/delegate_card.dart b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/delegate_card.dart index 1259d6649..07ab43761 100644 --- a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/delegate_card.dart +++ b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/delegate_card.dart @@ -40,7 +40,7 @@ class DelegateCard extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6), child: Text( 'Delegate', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), ), diff --git a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/introducing_delegates_dialog.dart b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/introducing_delegates_dialog.dart index 8d7bd25a9..ce64d11eb 100644 --- a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/introducing_delegates_dialog.dart +++ b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/introducing_delegates_dialog.dart @@ -15,7 +15,7 @@ class IntroducingDelegatesDialog extends StatelessWidget { singleLargeButtonTitle: "Dismiss", onSingleLargeButtonPressed: () => Navigator.of(context).pop(), children: [ - Text('Introducing Delegates!', style: Theme.of(context).textTheme.headline6), + Text('Introducing Delegates!', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), Image.asset('assets/images/explore/introducing_delegate.png'), const SizedBox(height: 30.0), diff --git a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/remove_delegate_confirmation_dialog.dart b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/remove_delegate_confirmation_dialog.dart index 120ae10a4..7768ef39d 100644 --- a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/remove_delegate_confirmation_dialog.dart +++ b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/components/remove_delegate_confirmation_dialog.dart @@ -25,10 +25,10 @@ class RemoveDelegateConfirmationDialog extends StatelessWidget { }, children: [ const SizedBox(height: 10.0), - Text('Remove Delegate?', style: Theme.of(context).textTheme.headline6), + Text('Remove Delegate?', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), Text('Are you sure you would like to remove this person as your Delegate?', - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 20.0), ], ), diff --git a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/delegates_tab.dart b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/delegates_tab.dart index 7a6e5502b..c898cf0b6 100644 --- a/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/delegates_tab.dart +++ b/lib/screens/explore_screens/vote_screens/delegate/delegates_tab/delegates_tab.dart @@ -68,7 +68,7 @@ class DelegatesTab extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 10), child: Text( 'Delegating your vote means to entrust the power of your vote to another Citizen. Please choose your delegate carefully!', - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ), const SizedBox(height: 30), DelegateCard( diff --git a/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/components/delegator_row.dart b/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/components/delegator_row.dart index 6ab7a80f1..867cb2ac5 100644 --- a/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/components/delegator_row.dart +++ b/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/components/delegator_row.dart @@ -20,7 +20,7 @@ class DelegatorRow extends StatelessWidget { ), title: Text( (!delegator.nickname.isNullOrEmpty) ? delegator.nickname : delegator.nickname, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), subtitle: Text(delegator.account, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis), ); diff --git a/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/delegators_tab.dart b/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/delegators_tab.dart index 66c5cdf4f..02b52346e 100644 --- a/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/delegators_tab.dart +++ b/lib/screens/explore_screens/vote_screens/delegate/delegators_tab/delegators_tab.dart @@ -31,7 +31,7 @@ class DelegatorsTab extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 10), child: Text( 'Delegators are Citizens that have chosen you to vote on their behalf. All votes already cast this cycle will not change.', - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ), Expanded( child: state.delegators.isEmpty diff --git a/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_confirmation_dialog.dart b/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_confirmation_dialog.dart index eaee14719..ccb72a037 100644 --- a/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_confirmation_dialog.dart +++ b/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_confirmation_dialog.dart @@ -30,22 +30,22 @@ class DelegateAUserConfirmationDialog extends StatelessWidget { Navigator.of(context).pop(); }, children: [ - Text('Delegate Confirmation', style: Theme.of(context).textTheme.headline6), + Text('Delegate Confirmation', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), Text( 'By selecting this Citizen as your delegate you are entrusting your Trust Tokens to them to vote with.', - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 20.0), RichText( textAlign: TextAlign.center, text: TextSpan( text: 'Are you sure you would like ', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( text: '${selectedDelegate.nickname} (${selectedDelegate.account})', style: Theme.of(context).textTheme.subtitle2Green3LowEmphasis), - TextSpan(text: ' to be your delegate?', style: Theme.of(context).textTheme.subtitle2) + TextSpan(text: ' to be your delegate?', style: Theme.of(context).textTheme.titleSmall) ]), ), ], diff --git a/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_success_dialog.dart b/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_success_dialog.dart index e4e8512de..8d3eb9dfb 100644 --- a/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_success_dialog.dart +++ b/lib/screens/explore_screens/vote_screens/delegate_a_user/component/delegate_a_user_success_dialog.dart @@ -27,10 +27,10 @@ class DelegateAUserSuccessDialog extends StatelessWidget { NavigationService.of(context).navigateTo(Routes.delegate); }, children: [ - Text('Delegate Chosen!', style: Theme.of(context).textTheme.headline6), + Text('Delegate Chosen!', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30.0), Text('You have successfully chosen your delegate. They will now vote with the power of your vote.', - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ], ), ); diff --git a/lib/screens/explore_screens/vote_screens/proposal_details/components/confirm_vote_dialog.dart b/lib/screens/explore_screens/vote_screens/proposal_details/components/confirm_vote_dialog.dart index 97e3da141..78adaa235 100644 --- a/lib/screens/explore_screens/vote_screens/proposal_details/components/confirm_vote_dialog.dart +++ b/lib/screens/explore_screens/vote_screens/proposal_details/components/confirm_vote_dialog.dart @@ -20,7 +20,7 @@ class ConfirmVoteDialog extends StatelessWidget { Text( 'Your trust tokens cannot be reallocated afterwards so please be sure of your vote!'.i18n, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 16.0), ], diff --git a/lib/screens/explore_screens/vote_screens/proposal_details/components/current_vote_choice_label.dart b/lib/screens/explore_screens/vote_screens/proposal_details/components/current_vote_choice_label.dart index b0963bfa1..0ebf9cb6d 100644 --- a/lib/screens/explore_screens/vote_screens/proposal_details/components/current_vote_choice_label.dart +++ b/lib/screens/explore_screens/vote_screens/proposal_details/components/current_vote_choice_label.dart @@ -20,9 +20,9 @@ class CurrentVoteChoiceLabel extends StatelessWidget { RichText( text: TextSpan( children: [ - TextSpan(text: "I'm".i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: "I'm".i18n, style: Theme.of(context).textTheme.titleSmall), TextSpan(text: ' in favor '.i18n, style: Theme.of(context).textTheme.subtitle2Green2), - TextSpan(text: 'of this proposal'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'of this proposal'.i18n, style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -37,9 +37,9 @@ class CurrentVoteChoiceLabel extends StatelessWidget { RichText( text: TextSpan( children: [ - TextSpan(text: 'I'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'I'.i18n, style: Theme.of(context).textTheme.titleSmall), TextSpan(text: ' refrain '.i18n, style: Theme.of(context).textTheme.subtitle2Green2), - TextSpan(text: 'from voting'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'from voting'.i18n, style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -54,9 +54,9 @@ class CurrentVoteChoiceLabel extends StatelessWidget { RichText( text: TextSpan( children: [ - TextSpan(text: "I'm".i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: "I'm".i18n, style: Theme.of(context).textTheme.titleSmall), TextSpan(text: ' against '.i18n, style: Theme.of(context).textTheme.subtitle2Green2), - TextSpan(text: 'this proposal'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'this proposal'.i18n, style: Theme.of(context).textTheme.titleSmall), ], ), ), diff --git a/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_header.dart b/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_header.dart index 8b2487156..4051b11a2 100644 --- a/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_header.dart +++ b/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_header.dart @@ -62,7 +62,7 @@ class ProposalDetailsHeader extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6), child: Text( state.proposals[state.currentIndex].proposalCategory.localizedDescription(context).inCaps, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), ), diff --git a/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_middle.dart b/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_middle.dart index 3b47e48b0..23bce01de 100644 --- a/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_middle.dart +++ b/lib/screens/explore_screens/vote_screens/proposal_details/components/proposal_details_middle.dart @@ -47,7 +47,7 @@ class ProposalDetailsMiddle extends StatelessWidget { const SizedBox(height: 30.0), ], ), - Text('Created by'.i18n, style: Theme.of(context).textTheme.subtitle2), + Text('Created by'.i18n, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 10.0), Row( children: [ @@ -67,7 +67,7 @@ class ProposalDetailsMiddle extends StatelessWidget { Expanded( child: Text( state.proposals[state.currentIndex].creator, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ), Text( @@ -78,7 +78,7 @@ class ProposalDetailsMiddle extends StatelessWidget { ), const SizedBox(height: 10.0), Row( - children: [Text(state.creator!.nickname, style: Theme.of(context).textTheme.subtitle2)], + children: [Text(state.creator!.nickname, style: Theme.of(context).textTheme.titleSmall)], ), ], ), @@ -100,12 +100,12 @@ class ProposalDetailsMiddle extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Setting: %s '.i18n.fill([(state.proposals[state.currentIndex].settingName)]), + 'Setting: %s '.i18n.fill([state.proposals[state.currentIndex].settingName]), style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), const SizedBox(height: 8), Text( - 'New Value: %s'.i18n.fill([(state.proposals[state.currentIndex].settingValue)]), + 'New Value: %s'.i18n.fill([state.proposals[state.currentIndex].settingValue]), style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), ], @@ -115,12 +115,12 @@ class ProposalDetailsMiddle extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Recipient: %s '.i18n.fill([(state.proposals[state.currentIndex].recipient)]), + 'Recipient: %s '.i18n.fill([state.proposals[state.currentIndex].recipient]), style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), const SizedBox(height: 8), Text( - 'Requested: %s '.i18n.fill([(state.proposals[state.currentIndex].quantity)]), + 'Requested: %s '.i18n.fill([state.proposals[state.currentIndex].quantity]), style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), const SizedBox(height: 8), @@ -130,12 +130,12 @@ class ProposalDetailsMiddle extends StatelessWidget { ), const SizedBox(height: 8), Text( - 'Status: %s '.i18n.fill([(state.proposals[state.currentIndex].status.inCaps)]), + 'Status: %s '.i18n.fill([state.proposals[state.currentIndex].status.inCaps]), style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), const SizedBox(height: 8), Text( - 'Stage: %s '.i18n.fill([(state.proposals[state.currentIndex].stage.inCaps)]), + 'Stage: %s '.i18n.fill([state.proposals[state.currentIndex].stage.inCaps]), style: Theme.of(context).textTheme.subtitle3OpacityEmphasis, ), ], diff --git a/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_status_label.dart b/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_status_label.dart index a66c5be8d..7e1175f96 100644 --- a/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_status_label.dart +++ b/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_status_label.dart @@ -23,9 +23,9 @@ class VoteStatusLabel extends StatelessWidget { RichText( text: TextSpan( children: [ - TextSpan(text: 'You must be a'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'You must be a'.i18n, style: Theme.of(context).textTheme.titleSmall), TextSpan(text: ' Citizen '.i18n, style: Theme.of(context).textTheme.subtitle2Green2), - TextSpan(text: 'to vote on proposals.'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'to vote on proposals.'.i18n, style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -40,13 +40,13 @@ class VoteStatusLabel extends StatelessWidget { RichText( text: TextSpan( children: [ - TextSpan(text: 'You have already'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'You have already'.i18n, style: Theme.of(context).textTheme.titleSmall), TextSpan(text: ' Voted with '.i18n, style: Theme.of(context).textTheme.subtitle2Green2), TextSpan( text: state.vote!.amount == 1 ? '${state.vote!.amount} ' 'vote '.i18n : '${state.vote!.amount} ' 'votes'.i18n, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -65,12 +65,12 @@ class VoteStatusLabel extends StatelessWidget { children: [ TextSpan( text: 'You have delegated your vote to'.i18n, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), TextSpan( text: ' ${state.proposalDelegate}. ', style: Theme.of(context).textTheme.subtitle2Green2), TextSpan( - text: 'They are voting for you.'.i18n, style: Theme.of(context).textTheme.subtitle2), + text: 'They are voting for you.'.i18n, style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -86,7 +86,7 @@ class VoteStatusLabel extends StatelessWidget { RichText( text: TextSpan( children: [ - TextSpan(text: 'Voting'.i18n, style: Theme.of(context).textTheme.subtitle2), + TextSpan(text: 'Voting'.i18n, style: Theme.of(context).textTheme.titleSmall), TextSpan( text: ' - ${state.proposals[state.currentIndex].proposalCategory.name}: ', style: Theme.of(context).textTheme.subtitle2Green2), @@ -94,7 +94,7 @@ class VoteStatusLabel extends StatelessWidget { text: state.voteAmount == 1 ? '${state.voteAmount} ' 'vote '.i18n : '${state.voteAmount} ' 'votes'.i18n, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ], ), ), @@ -109,7 +109,7 @@ class VoteStatusLabel extends StatelessWidget { padding: const EdgeInsets.only(top: horizontalEdgePadding, left: horizontalEdgePadding), child: Row( children: [ - Text('Voting for this proposal is not open yet.'.i18n, style: Theme.of(context).textTheme.subtitle2), + Text('Voting for this proposal is not open yet.'.i18n, style: Theme.of(context).textTheme.titleSmall), ], ), ); diff --git a/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_success_dialog.dart b/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_success_dialog.dart index 079247acd..cddbfce5e 100644 --- a/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_success_dialog.dart +++ b/lib/screens/explore_screens/vote_screens/proposal_details/components/vote_success_dialog.dart @@ -19,7 +19,7 @@ class VoteSuccessDialog extends StatelessWidget { 'Thank you for coming and contributing your voice to the collective decision making process. Please make sure to come back at the start of the next Voting Cycle to empower more people!' .i18n, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 16.0), ], diff --git a/lib/screens/explore_screens/vote_screens/proposal_details/interactor/usecases/vote_proposal_use_case.dart b/lib/screens/explore_screens/vote_screens/proposal_details/interactor/usecases/vote_proposal_use_case.dart index b7c76878c..65ea64cd3 100644 --- a/lib/screens/explore_screens/vote_screens/proposal_details/interactor/usecases/vote_proposal_use_case.dart +++ b/lib/screens/explore_screens/vote_screens/proposal_details/interactor/usecases/vote_proposal_use_case.dart @@ -5,12 +5,12 @@ import 'package:seeds/screens/explore_screens/vote_screens/proposals/viewmodels/ class VoteProposalUseCase { Future run({required ProposalViewModel proposal, required int amount}) { - final ProposalsRepository _proposalsRepository = ProposalsRepository(); + final ProposalsRepository proposalsRepository = ProposalsRepository(); final String accountName = settingsStorage.accountName; if (proposal.proposalCategory == ProposalCategory.referendum) { - return _proposalsRepository.voteReferendum(id: proposal.id, amount: amount, accountName: accountName); + return proposalsRepository.voteReferendum(id: proposal.id, amount: amount, accountName: accountName); } else { - return _proposalsRepository.voteProposal(id: proposal.id, amount: amount, accountName: accountName); + return proposalsRepository.voteProposal(id: proposal.id, amount: amount, accountName: accountName); } } } diff --git a/lib/screens/explore_screens/vote_screens/proposals/components/proposal_card.dart b/lib/screens/explore_screens/vote_screens/proposals/components/proposal_card.dart index 2259b42b7..b6aa9ba77 100644 --- a/lib/screens/explore_screens/vote_screens/proposals/components/proposal_card.dart +++ b/lib/screens/explore_screens/vote_screens/proposals/components/proposal_card.dart @@ -217,7 +217,7 @@ class _ProposalCardState extends State with AutomaticKeepAliveClie child: Padding( padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 6), child: Text(widget.proposal.proposalCategory.localizedDescription(context).inCaps, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ), ), ], @@ -229,7 +229,7 @@ class _ProposalCardState extends State with AutomaticKeepAliveClie Positioned( top: 10.0, left: 26.0, - child: Container( + child: DecoratedBox( decoration: BoxDecoration(color: AppColors.darkGreen2, borderRadius: BorderRadius.circular(6.0)), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0), diff --git a/lib/screens/explore_screens/vote_screens/proposals/components/vote_amount_label/vote_amount_label.dart b/lib/screens/explore_screens/vote_screens/proposals/components/vote_amount_label/vote_amount_label.dart index ff5bceb16..aee5c5c7b 100644 --- a/lib/screens/explore_screens/vote_screens/proposals/components/vote_amount_label/vote_amount_label.dart +++ b/lib/screens/explore_screens/vote_screens/proposals/components/vote_amount_label/vote_amount_label.dart @@ -31,7 +31,7 @@ class VoteAmountLabel extends StatelessWidget { child: SizedBox(width: 14.0, height: 14.0, child: CircularProgressIndicator(strokeWidth: 2))), ); case PageState.success: - return Container( + return DecoratedBox( decoration: BoxDecoration(color: AppColors.darkGreen3, borderRadius: BorderRadius.circular(6.0)), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0), diff --git a/lib/screens/explore_screens/vote_screens/proposals/components/voting_end_cycle_card.dart b/lib/screens/explore_screens/vote_screens/proposals/components/voting_end_cycle_card.dart index 273face0a..a0ad5d98d 100644 --- a/lib/screens/explore_screens/vote_screens/proposals/components/voting_end_cycle_card.dart +++ b/lib/screens/explore_screens/vote_screens/proposals/components/voting_end_cycle_card.dart @@ -20,7 +20,7 @@ class VotingCycleEndCard implements SliverPersistentHeaderDelegate { Container(color: AppColors.primary), Padding( padding: const EdgeInsets.all(16.0), - child: Container( + child: DecoratedBox( decoration: BoxDecoration(color: AppColors.darkGreen2, borderRadius: BorderRadius.circular(12)), child: SingleChildScrollView( padding: const EdgeInsets.only(top: 16, bottom: 16, right: 14, left: 14), @@ -39,21 +39,21 @@ class VotingCycleEndCard implements SliverPersistentHeaderDelegate { case PageState.initial: return const SizedBox.shrink(); case PageState.loading: - return Row( + return const Row( mainAxisAlignment: MainAxisAlignment.center, - children: [const SizedBox(height: 20, width: 20, child: CircularProgressIndicator())], + children: [SizedBox(height: 20, width: 20, child: CircularProgressIndicator())], ); case PageState.failure: return Row( mainAxisAlignment: MainAxisAlignment.center, - children: [Text(state.errorMessage!, style: Theme.of(context).textTheme.headline5)], + children: [Text(state.errorMessage!, style: Theme.of(context).textTheme.headlineSmall)], ); case PageState.success: return voteCycleEnded ? Row( children: [ Text(context.loc.proposalVoteCycleEndedTimeRemaining, - style: Theme.of(context).textTheme.headline5) + style: Theme.of(context).textTheme.headlineSmall) ], ) : Row( @@ -62,7 +62,7 @@ class VotingCycleEndCard implements SliverPersistentHeaderDelegate { Row( children: [ Text('${state.currentRemainingTime?.days ?? 0} ', - style: Theme.of(context).textTheme.headline5), + style: Theme.of(context).textTheme.headlineSmall), Column( children: [ const SizedBox(height: 12), @@ -75,7 +75,7 @@ class VotingCycleEndCard implements SliverPersistentHeaderDelegate { Row( children: [ Text('${state.currentRemainingTime?.hours ?? 0} ', - style: Theme.of(context).textTheme.headline5), + style: Theme.of(context).textTheme.headlineSmall), Column( children: [ const SizedBox(height: 12), @@ -88,7 +88,7 @@ class VotingCycleEndCard implements SliverPersistentHeaderDelegate { Row( children: [ Text('${state.currentRemainingTime?.min ?? 0} ', - style: Theme.of(context).textTheme.headline5), + style: Theme.of(context).textTheme.headlineSmall), Column( children: [ const SizedBox(height: 12), @@ -103,7 +103,7 @@ class VotingCycleEndCard implements SliverPersistentHeaderDelegate { Row( children: [ Text('${state.currentRemainingTime?.sec ?? 0} ', - style: Theme.of(context).textTheme.headline5), + style: Theme.of(context).textTheme.headlineSmall), Column( children: [ const SizedBox(height: 12), diff --git a/lib/screens/explore_screens/vote_screens/proposals/proposals_list.dart b/lib/screens/explore_screens/vote_screens/proposals/proposals_list.dart index db44203bd..86f698db1 100644 --- a/lib/screens/explore_screens/vote_screens/proposals/proposals_list.dart +++ b/lib/screens/explore_screens/vote_screens/proposals/proposals_list.dart @@ -94,7 +94,7 @@ class _ProposalsListState extends State with AutomaticKeepAliveCl if (state.proposals.isEmpty) SliverFillRemaining( child: Center( - child: Text('No proposals to show, yet', style: Theme.of(context).textTheme.button), + child: Text('No proposals to show, yet', style: Theme.of(context).textTheme.labelLarge), ), ) else diff --git a/lib/screens/explore_screens/vote_screens/vote/vote_screen.dart b/lib/screens/explore_screens/vote_screens/vote/vote_screen.dart index ee4a18a04..7a80e894f 100644 --- a/lib/screens/explore_screens/vote_screens/vote/vote_screen.dart +++ b/lib/screens/explore_screens/vote_screens/vote/vote_screen.dart @@ -51,11 +51,11 @@ class VoteScreen extends StatelessWidget { indicatorSize: TabBarIndicatorSize.label, unselectedLabelStyle: Theme.of(context).textTheme.buttonOpacityEmphasis, labelStyle: Theme.of(context).textTheme.buttonLowEmphasis, - tabs: [for (var i in proposalTypes) Tab(child: FittedBox(child: Text(i.type.i18n)))], + tabs: [for (final i in proposalTypes) Tab(child: FittedBox(child: Text(i.type.i18n)))], ), ), ), - body: SafeArea(child: TabBarView(children: [for (var i in proposalTypes) ProposalsList(i)])), + body: SafeArea(child: TabBarView(children: [for (final i in proposalTypes) ProposalsList(i)])), ); }, ), 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 12b9a2097..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 @@ -27,11 +27,11 @@ class VouchForMemberConfirmationDialog extends StatelessWidget { Navigator.of(context).pop(); }, children: [ - Text('Please read carefully', style: Theme.of(context).textTheme.headline6), + 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!', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center, ), const SizedBox(height: 20.0), @@ -39,12 +39,12 @@ class VouchForMemberConfirmationDialog extends StatelessWidget { textAlign: TextAlign.center, text: TextSpan( text: 'Are you sure you would like to vouch for ', - style: Theme.of(context).textTheme.subtitle2, + 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.subtitle2), + 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 f9e6cffa8..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 @@ -11,11 +11,11 @@ class NotQualifiedToVouchDialog extends StatelessWidget { icon: const CustomPaint(size: Size(60, 60), painter: VouchWhiteBackground()), singleLargeButtonTitle: "Ok, Thank you!", children: [ - Text('Not qualified to Vouch!', style: Theme.of(context).textTheme.headline6), + 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!', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center, ), ], diff --git a/lib/screens/explore_screens/vouch/vouched_tab/components/vouch_success_dialog.dart b/lib/screens/explore_screens/vouch/vouched_tab/components/vouch_success_dialog.dart index 80ac1a956..cdaf322fe 100644 --- a/lib/screens/explore_screens/vouch/vouched_tab/components/vouch_success_dialog.dart +++ b/lib/screens/explore_screens/vouch/vouched_tab/components/vouch_success_dialog.dart @@ -12,7 +12,7 @@ class VouchSuccessDialog extends StatelessWidget { singleLargeButtonTitle: "Close", children: [ const SizedBox(height: 10.0), - Text('Successfully Vouched!', style: Theme.of(context).textTheme.headline6), + Text('Successfully Vouched!', style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 10.0), ], ); diff --git a/lib/screens/profile_screens/citizenship/components/resident_view.dart b/lib/screens/profile_screens/citizenship/components/resident_view.dart index 2a5bf28ef..6b29d419f 100644 --- a/lib/screens/profile_screens/citizenship/components/resident_view.dart +++ b/lib/screens/profile_screens/citizenship/components/resident_view.dart @@ -106,7 +106,7 @@ class _ResidentViewState extends State with TickerProviderStateMix const SizedBox(height: 8.0), Text( state.profile!.nickname, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), const SizedBox(height: 8.0), Text( @@ -118,7 +118,7 @@ class _ResidentViewState extends State with TickerProviderStateMix ], ), const SizedBox(height: 16.0), - Container( + DecoratedBox( decoration: const BoxDecoration( color: AppColors.lightGreen2, borderRadius: BorderRadius.all(Radius.circular(defaultCardBorderRadius)), @@ -130,7 +130,7 @@ class _ResidentViewState extends State with TickerProviderStateMix Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Progress Timeline'.i18n, style: Theme.of(context).textTheme.button), + Text('Progress Timeline'.i18n, style: Theme.of(context).textTheme.labelLarge), Text('$_timeLine%', style: Theme.of(context).textTheme.subtitle2LowEmphasis), ], ), @@ -164,7 +164,7 @@ class _ResidentViewState extends State with TickerProviderStateMix title: 'Citizen Ceremony'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: _citizenCeremony == citizenRequiredCitizenVouched ? 'Passed' : 'Waiting', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( icon: SvgPicture.asset('assets/images/citizenship/reputation.svg'), @@ -174,7 +174,7 @@ class _ResidentViewState extends State with TickerProviderStateMix title: 'Reputation Score'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '$_reputation/$citizenRequiredReputation', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( icon: SvgPicture.asset('assets/images/citizenship/age.svg'), @@ -184,7 +184,7 @@ class _ResidentViewState extends State with TickerProviderStateMix title: 'Account Age'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '$_age/$citizenRequiredAccountAge', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( icon: SvgPicture.asset('assets/images/citizenship/planted.svg'), @@ -194,7 +194,7 @@ class _ResidentViewState extends State with TickerProviderStateMix title: 'Planted Seeds'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '$_seeds/$citizenRequiredPlantedSeeds', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( icon: SvgPicture.asset('assets/images/citizenship/transaction.svg'), @@ -204,7 +204,7 @@ class _ResidentViewState extends State with TickerProviderStateMix title: 'Transactions with Seeds'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '$_transactions/$citizenRequiredSeedsTransactions', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), ], ), diff --git a/lib/screens/profile_screens/citizenship/components/visitor_view.dart b/lib/screens/profile_screens/citizenship/components/visitor_view.dart index 3e2ece98b..6c393b7e8 100644 --- a/lib/screens/profile_screens/citizenship/components/visitor_view.dart +++ b/lib/screens/profile_screens/citizenship/components/visitor_view.dart @@ -100,7 +100,7 @@ class _VisitorViewState extends State with TickerProviderStateMixin const SizedBox(height: 8.0), Text( state.profile!.nickname, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), const SizedBox(height: 8.0), Text( @@ -112,7 +112,7 @@ class _VisitorViewState extends State with TickerProviderStateMixin ], ), const SizedBox(height: 16.0), - Container( + DecoratedBox( decoration: const BoxDecoration( color: AppColors.lightGreen2, borderRadius: BorderRadius.all(Radius.circular(defaultCardBorderRadius)), @@ -124,7 +124,7 @@ class _VisitorViewState extends State with TickerProviderStateMixin Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Progress Timeline'.i18n, style: Theme.of(context).textTheme.button), + Text('Progress Timeline'.i18n, style: Theme.of(context).textTheme.labelLarge), Text('$_timeLine%', style: Theme.of(context).textTheme.subtitle2LowEmphasis), ], ), @@ -158,7 +158,7 @@ class _VisitorViewState extends State with TickerProviderStateMixin title: 'Reputation Points'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '$_reputation/$residentRequiredReputation', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( icon: SvgPicture.asset('assets/images/citizenship/community.svg'), @@ -168,7 +168,7 @@ class _VisitorViewState extends State with TickerProviderStateMixin title: 'Visitors Invited'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '${_visitors ~/ 100}/$residentRequiredVisitorsInvited', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( icon: SvgPicture.asset('assets/images/citizenship/planted.svg'), @@ -178,7 +178,7 @@ class _VisitorViewState extends State with TickerProviderStateMixin title: 'Planted Seeds'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '$_seeds/$residentRequiredPlantedSeeds', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), CircularProgressItem( icon: SvgPicture.asset('assets/images/citizenship/transaction.svg'), @@ -188,7 +188,7 @@ class _VisitorViewState extends State with TickerProviderStateMixin title: 'Transactions with Seeds'.i18n, titleStyle: Theme.of(context).textTheme.subtitle3, rate: '$_transactions/$residentRequiredSeedsTransactions', - rateStyle: Theme.of(context).textTheme.subtitle1!, + rateStyle: Theme.of(context).textTheme.titleMedium!, ), ], ), diff --git a/lib/screens/profile_screens/citizenship/interactor/usecases/get_referred_accounts_use_case.dart b/lib/screens/profile_screens/citizenship/interactor/usecases/get_referred_accounts_use_case.dart index 45089dc13..9df84614d 100644 --- a/lib/screens/profile_screens/citizenship/interactor/usecases/get_referred_accounts_use_case.dart +++ b/lib/screens/profile_screens/citizenship/interactor/usecases/get_referred_accounts_use_case.dart @@ -13,7 +13,7 @@ class GetReferredAccountsUseCase { } else { final ReferredAccounts referredAccounts = result.asValue!.value; //This is an expensive approach we need change it - return Future.wait([for (var i in referredAccounts.accounts) _profileRepository.getProfile(i)]); + return Future.wait([for (final i in referredAccounts.accounts) _profileRepository.getProfile(i)]); } } } diff --git a/lib/screens/profile_screens/contribution/contribution_detail/components/contribution_detail_subtitle.dart b/lib/screens/profile_screens/contribution/contribution_detail/components/contribution_detail_subtitle.dart index ce5352573..b8b616fa1 100644 --- a/lib/screens/profile_screens/contribution/contribution_detail/components/contribution_detail_subtitle.dart +++ b/lib/screens/profile_screens/contribution/contribution_detail/components/contribution_detail_subtitle.dart @@ -13,7 +13,7 @@ class ContributionDetailSubtitle extends StatelessWidget { margin: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding), padding: const EdgeInsets.all(horizontalEdgePadding), decoration: BoxDecoration(color: AppColors.darkGreen2, borderRadius: BorderRadius.circular(8.0)), - child: Text(title, textAlign: TextAlign.center, style: Theme.of(context).textTheme.button), + child: Text(title, textAlign: TextAlign.center, style: Theme.of(context).textTheme.labelLarge), ); } } diff --git a/lib/screens/profile_screens/contribution/contribution_detail/contribution_detail_screen.dart b/lib/screens/profile_screens/contribution/contribution_detail/contribution_detail_screen.dart index 253daac72..db33dd406 100644 --- a/lib/screens/profile_screens/contribution/contribution_detail/contribution_detail_screen.dart +++ b/lib/screens/profile_screens/contribution/contribution_detail/contribution_detail_screen.dart @@ -58,7 +58,7 @@ class ContributionDetailScreen extends StatelessWidget { Text(scoreDetails.scoreType, textAlign: TextAlign.center, maxLines: 2, style: Theme.of(context).textTheme.headline7), const SizedBox(height: 8.0), - Text(scoreDetails.score.toString(), style: Theme.of(context).textTheme.headline3), + Text(scoreDetails.score.toString(), style: Theme.of(context).textTheme.displaySmall), ], ), ), diff --git a/lib/screens/profile_screens/contribution/contribution_screen.dart b/lib/screens/profile_screens/contribution/contribution_screen.dart index 65e974599..5a56d16c0 100644 --- a/lib/screens/profile_screens/contribution/contribution_screen.dart +++ b/lib/screens/profile_screens/contribution/contribution_screen.dart @@ -133,7 +133,7 @@ class _ContributionScreenState extends State with TickerProv maxLines: 2, style: Theme.of(context).textTheme.headline7), const SizedBox(height: 8.0), - Text('$_contribution/99', style: Theme.of(context).textTheme.headline3), + Text('$_contribution/99', style: Theme.of(context).textTheme.displaySmall), ], ), ), @@ -157,7 +157,7 @@ class _ContributionScreenState extends State with TickerProv title: 'Community'.i18n, titleStyle: Theme.of(context).textTheme.buttonLowEmphasis, rate: '$_community', - rateStyle: Theme.of(context).textTheme.headline4!, + rateStyle: Theme.of(context).textTheme.headlineMedium!, onPressed: () => BlocProvider.of(context) .add(const ShowScoreDetails(ScoreType.communityScore)), ), @@ -169,7 +169,7 @@ class _ContributionScreenState extends State with TickerProv title: 'Reputation'.i18n, titleStyle: Theme.of(context).textTheme.buttonLowEmphasis, rate: '$_reputation', - rateStyle: Theme.of(context).textTheme.headline4!, + rateStyle: Theme.of(context).textTheme.headlineMedium!, onPressed: () => BlocProvider.of(context) .add(const ShowScoreDetails(ScoreType.reputationScore)), ), @@ -181,7 +181,7 @@ class _ContributionScreenState extends State with TickerProv title: 'Planted'.i18n, titleStyle: Theme.of(context).textTheme.buttonLowEmphasis, rate: '$_seeds', - rateStyle: Theme.of(context).textTheme.headline4!, + rateStyle: Theme.of(context).textTheme.headlineMedium!, onPressed: () => BlocProvider.of(context) .add(const ShowScoreDetails(ScoreType.plantedScore)), ), @@ -193,7 +193,7 @@ class _ContributionScreenState extends State with TickerProv title: 'Transactions'.i18n, titleStyle: Theme.of(context).textTheme.buttonLowEmphasis, rate: '$_transactions', - rateStyle: Theme.of(context).textTheme.headline4!, + rateStyle: Theme.of(context).textTheme.headlineMedium!, onPressed: () => BlocProvider.of(context) .add(const ShowScoreDetails(ScoreType.transactionScore)), ), diff --git a/lib/screens/profile_screens/edit_name/edit_name_screen.dart b/lib/screens/profile_screens/edit_name/edit_name_screen.dart index 215aa2385..aba3ac93e 100644 --- a/lib/screens/profile_screens/edit_name/edit_name_screen.dart +++ b/lib/screens/profile_screens/edit_name/edit_name_screen.dart @@ -17,12 +17,12 @@ class EditNameScreen extends StatelessWidget { @override Widget build(BuildContext context) { - final _profileModel = ModalRoute.of(context)!.settings.arguments as ProfileModel?; - assert(_profileModel != null); + final profileModel = ModalRoute.of(context)!.settings.arguments as ProfileModel?; + assert(profileModel != null); return Scaffold( appBar: AppBar(title: Text(context.loc.editNameTitle)), body: BlocProvider( - create: (_) => EditNameBloc(_profileModel!), + create: (_) => EditNameBloc(profileModel!), child: BlocConsumer( listenWhen: (_, current) => current.pageCommand != null, listener: (context, state) { diff --git a/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_dialog_single_action.dart b/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_dialog_single_action.dart index ac107b27e..d3fc9df91 100644 --- a/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_dialog_single_action.dart +++ b/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_dialog_single_action.dart @@ -38,7 +38,7 @@ class GuardianDialogSingleAction extends StatelessWidget { Text( title, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), const SizedBox(height: 30), Padding( diff --git a/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_row_widget.dart b/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_row_widget.dart index 9b5af1a6c..589200b25 100644 --- a/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_row_widget.dart +++ b/lib/screens/profile_screens/guardians/guardians_tabs/components/guardian_row_widget.dart @@ -24,7 +24,7 @@ class GuardianRowWidget extends StatelessWidget { ), title: Text( (!guardianModel.nickname.isNullOrEmpty) ? guardianModel.nickname! : guardianModel.uid, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), subtitle: Text(guardianModel.uid, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis), onTap: () { diff --git a/lib/screens/profile_screens/guardians/guardians_tabs/components/my_guardians_tab.dart b/lib/screens/profile_screens/guardians/guardians_tabs/components/my_guardians_tab.dart index 19b16d606..58dc80015 100644 --- a/lib/screens/profile_screens/guardians/guardians_tabs/components/my_guardians_tab.dart +++ b/lib/screens/profile_screens/guardians/guardians_tabs/components/my_guardians_tab.dart @@ -45,9 +45,9 @@ class MyGuardiansTab extends StatelessWidget { onPressed: () { BlocProvider.of(context).add(OnGuardianReadyForActivation(myGuardians)); }, - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, - children: [const Text("Activate "), const Icon(Icons.shield), const Text(" Guardians")], + children: [Text("Activate "), Icon(Icons.shield), Text(" Guardians")], ), ), )); diff --git a/lib/screens/profile_screens/guardians/guardians_tabs/components/remove_guardian_confirmation_dialog.dart b/lib/screens/profile_screens/guardians/guardians_tabs/components/remove_guardian_confirmation_dialog.dart index f0a95c9d5..be3c8fd48 100644 --- a/lib/screens/profile_screens/guardians/guardians_tabs/components/remove_guardian_confirmation_dialog.dart +++ b/lib/screens/profile_screens/guardians/guardians_tabs/components/remove_guardian_confirmation_dialog.dart @@ -37,7 +37,7 @@ class RemoveGuardianConfirmationDialog extends StatelessWidget { onLeftButtonPressed: onDismiss, children: [ const SizedBox(height: 20), - Text("Remove Guardian?".i18n, style: Theme.of(context).textTheme.headline6), + Text("Remove Guardian?".i18n, style: Theme.of(context).textTheme.titleLarge), const SizedBox(height: 30), Padding( padding: const EdgeInsets.symmetric(horizontal: 30), @@ -45,10 +45,10 @@ class RemoveGuardianConfirmationDialog extends StatelessWidget { textAlign: TextAlign.center, text: TextSpan( text: 'Are you sure you want to remove '.i18n, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, children: [ - TextSpan(text: guardian.nickname, style: Theme.of(context).textTheme.subtitle2), - TextSpan(text: ' as your Guardian?'.i18n, style: Theme.of(context).textTheme.subtitle2) + TextSpan(text: guardian.nickname, style: Theme.of(context).textTheme.titleSmall), + TextSpan(text: ' as your Guardian?'.i18n, style: Theme.of(context).textTheme.titleSmall) ]), ), ), diff --git a/lib/screens/profile_screens/guardians/guardians_tabs/guardians_screen.dart b/lib/screens/profile_screens/guardians/guardians_tabs/guardians_screen.dart index f50b453d0..065407531 100644 --- a/lib/screens/profile_screens/guardians/guardians_tabs/guardians_screen.dart +++ b/lib/screens/profile_screens/guardians/guardians_tabs/guardians_screen.dart @@ -115,9 +115,9 @@ void _showRecoveryStartedBottomSheet(BuildContext context, GuardianModel guardia child: RichText( text: TextSpan( text: 'A motion to Recover your Key has been initiated by '.i18n, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, children: [ - TextSpan(text: guardian.nickname, style: Theme.of(context).textTheme.button) + TextSpan(text: guardian.nickname, style: Theme.of(context).textTheme.labelLarge) ]), ), ), diff --git a/lib/screens/profile_screens/guardians/invite_guardians_sent/invite_guardians_sent_screen.dart b/lib/screens/profile_screens/guardians/invite_guardians_sent/invite_guardians_sent_screen.dart index 0024a4815..e05316006 100644 --- a/lib/screens/profile_screens/guardians/invite_guardians_sent/invite_guardians_sent_screen.dart +++ b/lib/screens/profile_screens/guardians/invite_guardians_sent/invite_guardians_sent_screen.dart @@ -27,7 +27,7 @@ class InviteGuardiansSentScreen extends StatelessWidget { padding: const EdgeInsets.all(24.0), child: Text( "Invites Sent!".i18n, - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, textAlign: TextAlign.center, ), ), diff --git a/lib/screens/profile_screens/profile/components/citizenship_card.dart b/lib/screens/profile_screens/profile/components/citizenship_card.dart index 625f35886..d421617e3 100644 --- a/lib/screens/profile_screens/profile/components/citizenship_card.dart +++ b/lib/screens/profile_screens/profile/components/citizenship_card.dart @@ -26,7 +26,7 @@ class CitizenshipCard extends StatelessWidget { case PageState.loading: return const ShimmerRectangle(size: Size(328, 145), radius: defaultCardBorderRadius); case PageState.success: - return Container( + return DecoratedBox( decoration: const BoxDecoration( color: AppColors.lightGreen2, borderRadius: BorderRadius.all(Radius.circular(defaultCardBorderRadius)), @@ -64,7 +64,7 @@ class CitizenshipCard extends StatelessWidget { children: [ Text( 'You are on the way from'.i18n, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ], ), diff --git a/lib/screens/profile_screens/profile/components/citizenship_upgrade_success_dialog.dart b/lib/screens/profile_screens/profile/components/citizenship_upgrade_success_dialog.dart index b63302012..d92d5eb1e 100644 --- a/lib/screens/profile_screens/profile/components/citizenship_upgrade_success_dialog.dart +++ b/lib/screens/profile_screens/profile/components/citizenship_upgrade_success_dialog.dart @@ -28,7 +28,7 @@ class CitizenshipUpgradeSuccessDialog extends StatelessWidget { text: TextSpan( text: 'You have have fulfilled all the requirements and are now officially upgraded to be a ' .i18n, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( text: "Citizen".i18n, @@ -38,7 +38,7 @@ class CitizenshipUpgradeSuccessDialog extends StatelessWidget { text: ' You now have the ability to vote on proposals! Go to the Explore section to see more.' .i18n, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ) ]), textAlign: TextAlign.center, @@ -51,7 +51,7 @@ class CitizenshipUpgradeSuccessDialog extends StatelessWidget { text: TextSpan( text: 'You have have fulfilled all the requirements and are now officially upgraded to be a ' .i18n, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, children: [ TextSpan( text: "Resident", @@ -59,7 +59,7 @@ class CitizenshipUpgradeSuccessDialog extends StatelessWidget { ), TextSpan( text: 'Just one more level until you are a full-fledged Citizen.!'.i18n, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ) ]), textAlign: TextAlign.center, diff --git a/lib/screens/profile_screens/profile/components/logout_dialog.dart b/lib/screens/profile_screens/profile/components/logout_dialog.dart index 4d1b9f38c..9df38d95f 100644 --- a/lib/screens/profile_screens/profile/components/logout_dialog.dart +++ b/lib/screens/profile_screens/profile/components/logout_dialog.dart @@ -28,7 +28,7 @@ class LogoutDialog extends StatelessWidget { Text( 'Save private key in secure place - to be able to restore access to your wallet later'.i18n, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 36.0), FlatButtonLong( diff --git a/lib/screens/profile_screens/profile/components/logout_recovery_phrase_dialog.dart b/lib/screens/profile_screens/profile/components/logout_recovery_phrase_dialog.dart index 8379c8671..cd6f8dae9 100644 --- a/lib/screens/profile_screens/profile/components/logout_recovery_phrase_dialog.dart +++ b/lib/screens/profile_screens/profile/components/logout_recovery_phrase_dialog.dart @@ -29,7 +29,7 @@ class LogoutRecoveryPhraseDialog extends StatelessWidget { 'Save private Recovery Phrase in secure place - to be able to restore access to your wallet later' .i18n, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 36.0), FlatButtonLong( diff --git a/lib/screens/profile_screens/profile/components/profile_list_tile.dart b/lib/screens/profile_screens/profile/components/profile_list_tile.dart index 002e06b68..138daff38 100644 --- a/lib/screens/profile_screens/profile/components/profile_list_tile.dart +++ b/lib/screens/profile_screens/profile/components/profile_list_tile.dart @@ -22,7 +22,7 @@ class ProfileListTile extends StatelessWidget { @override Widget build(BuildContext context) { - final Text titleText = Text(title, style: Theme.of(context).textTheme.button); + final Text titleText = Text(title, style: Theme.of(context).textTheme.labelLarge); final Text trailingText = Text(trailing, style: Theme.of(context).textTheme.headline7LowEmphasis); return SizedBox( height: 60, diff --git a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/mappers/set_private_key_state_mapper.dart b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/mappers/set_private_key_state_mapper.dart index 6786a6360..bd06d1d20 100644 --- a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/mappers/set_private_key_state_mapper.dart +++ b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/mappers/set_private_key_state_mapper.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart'; import 'package:seeds/datasource/local/models/auth_data_model.dart'; import 'package:seeds/domain-shared/page_state.dart'; import 'package:seeds/domain-shared/result_to_state_mapper.dart'; @@ -9,12 +10,19 @@ class SetFoundPrivateKeyStateMapper extends StateMapper { if (result.isError) { return currentState.copyWith(pageState: PageState.failure, error: ImportKeyError.noPublicKeyFound); } else { - ///-------GET PRIVATE KEY - final String publicKey = result.asValue!.value; - // Find the keys pair match the public key - final Keys keys = currentState.keys.singleWhere((i) => i.publicKey == publicKey); - // Set the private key of the match pair - return currentState.copyWith(authDataModel: AuthDataModel.fromKeyAndNoWords(keys.privateKey)); + ///-------GET PRIVATE KEY MATCHING ONE OF THE PUBLIC KEYS + for(final String publicKey in result.asValue!.value) { + // Find the keys pair match the public key + final Keys? keypair = currentState.keys.singleWhereOrNull((i) => + i.publicKey == publicKey); + if(keypair != null) { + // Set the private key of the match pair + return currentState.copyWith( + authDataModel: AuthDataModel.fromKeyAndNoWords( + keypair.privateKey)); + } + } + return currentState.copyWith(pageState: PageState.failure, error: ImportKeyError.noPublicKeyFound); } } } diff --git a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/get_public_key_from_account_use_case copy.dart b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/get_public_key_from_account_use_case copy.dart index a1949f141..0359a4b6f 100644 --- a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/get_public_key_from_account_use_case copy.dart +++ b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/get_public_key_from_account_use_case copy.dart @@ -1,6 +1,6 @@ import 'package:async/async.dart'; import 'package:seeds/datasource/remote/api/profile_repository.dart'; -class GetPublicKeyFromAccountUseCase { - Future run(String account) => ProfileRepository().getAccountPublicKey(account); +class GetPublicKeysFromAccountUseCase { + Future run(String account) => ProfileRepository().getAccountPublicKeys(account); } diff --git a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/import_accounts_use_case.dart b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/import_accounts_use_case.dart index 37a7cc23c..caed4b180 100644 --- a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/import_accounts_use_case.dart +++ b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/usecases/import_accounts_use_case.dart @@ -17,7 +17,7 @@ class ImportAccountsUseCase { return keyAccountsResponse; } else { final List> keyAccountsValues = - keyAccountsResponse.map>((i) => i.asValue!.value).toList(); + keyAccountsResponse.map>((i) => (i.asValue!.value as List).cast()).toList(); final List keyAccounts = keyAccountsValues.expand((i) => i).toList(); final List savedAccounts = settingsStorage.accountsList; // Remove duplicated accounts diff --git a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/viewmodels/switch_account_bloc.dart b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/viewmodels/switch_account_bloc.dart index 89cca2d38..910fe7890 100644 --- a/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/viewmodels/switch_account_bloc.dart +++ b/lib/screens/profile_screens/profile/components/switch_account_bottom_sheet/interactor/viewmodels/switch_account_bloc.dart @@ -41,7 +41,7 @@ class SwitchAccountBloc extends Bloc { Future _onAccountSelected(OnAccountSelected event, Emitter emit) async { emit(state.copyWith(currentAcccout: event.profile)); - final result = await GetPublicKeyFromAccountUseCase().run(event.profile.account); + final result = await GetPublicKeysFromAccountUseCase().run(event.profile.account); emit(SetFoundPrivateKeyStateMapper().mapResultToState(state, result)); // Only refresh the current accountName and the privateKey, then fire auth. _authenticationBloc.add(OnSwitchAccount(event.profile.account, state.authDataModel!)); diff --git a/lib/screens/profile_screens/recovery_phrase/recovery_phrase_screen.dart b/lib/screens/profile_screens/recovery_phrase/recovery_phrase_screen.dart index cb855a96d..cb676871b 100644 --- a/lib/screens/profile_screens/recovery_phrase/recovery_phrase_screen.dart +++ b/lib/screens/profile_screens/recovery_phrase/recovery_phrase_screen.dart @@ -35,7 +35,7 @@ class RecoveryPhraseScreen extends StatelessWidget { children: [ RichText( text: TextSpan( - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, children: [ const TextSpan(text: 'Get a pen and paper before you start. \nWrite down or '), TextSpan( diff --git a/lib/screens/profile_screens/security/components/biometric_enabled_dialog.dart b/lib/screens/profile_screens/security/components/biometric_enabled_dialog.dart index 42b110f9a..d490ffab1 100644 --- a/lib/screens/profile_screens/security/components/biometric_enabled_dialog.dart +++ b/lib/screens/profile_screens/security/components/biometric_enabled_dialog.dart @@ -18,7 +18,7 @@ class BiometricEnabledDialog extends StatelessWidget { Text( context.loc.securityBiometricEnabledDescription, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 16.0), ], diff --git a/lib/screens/profile_screens/security/components/guardian_security_card.dart b/lib/screens/profile_screens/security/components/guardian_security_card.dart index e85fc304e..4ebad03d2 100644 --- a/lib/screens/profile_screens/security/components/guardian_security_card.dart +++ b/lib/screens/profile_screens/security/components/guardian_security_card.dart @@ -73,7 +73,7 @@ class GuardianSecurityCard extends StatelessWidget { Flexible( child: Text( context.loc.securityGuardiansHeader, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ), const SizedBox(width: 10), diff --git a/lib/screens/profile_screens/security/components/security_card.dart b/lib/screens/profile_screens/security/components/security_card.dart index 8fd86d3c0..3fb136d29 100644 --- a/lib/screens/profile_screens/security/components/security_card.dart +++ b/lib/screens/profile_screens/security/components/security_card.dart @@ -72,7 +72,7 @@ class SecurityCard extends StatelessWidget { Flexible( child: Text( title, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), ), const SizedBox(width: 10), diff --git a/lib/screens/profile_screens/set_currency/set_currency_screen.dart b/lib/screens/profile_screens/set_currency/set_currency_screen.dart index de545e139..746826997 100644 --- a/lib/screens/profile_screens/set_currency/set_currency_screen.dart +++ b/lib/screens/profile_screens/set_currency/set_currency_screen.dart @@ -65,10 +65,10 @@ class _SetCurrencyScreenState extends State { itemBuilder: (_, index) => ListTile( key: Key(state.queryCurrenciesResults![index].code), leading: Text(state.queryCurrenciesResults![index].flagEmoji, - style: Theme.of(context).textTheme.headline4), + style: Theme.of(context).textTheme.headlineMedium), title: Text( state.queryCurrenciesResults![index].code, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, ), subtitle: Text(state.queryCurrenciesResults![index].name, style: Theme.of(context).textTheme.subtitle4), diff --git a/lib/screens/transfer/receive/receive_detail_qr_code/components/receive_paid_success_dialog.dart b/lib/screens/transfer/receive/receive_detail_qr_code/components/receive_paid_success_dialog.dart index 8b0b81cb6..ac1216a39 100644 --- a/lib/screens/transfer/receive/receive_detail_qr_code/components/receive_paid_success_dialog.dart +++ b/lib/screens/transfer/receive/receive_detail_qr_code/components/receive_paid_success_dialog.dart @@ -35,21 +35,21 @@ class ReceivePaidSuccessDialog extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(context.loc.transferReceivePaidSuccessHeader, style: Theme.of(context).textTheme.headline6) + Text(context.loc.transferReceivePaidSuccessHeader, style: Theme.of(context).textTheme.titleLarge) ], ), const SizedBox(height: 20), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(args.transaction.doubleQuantity.seedsFormatted, style: Theme.of(context).textTheme.headline4), + Text(args.transaction.doubleQuantity.seedsFormatted, style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(top: 14, left: 4), - child: Text(args.transaction.symbol, style: Theme.of(context).textTheme.subtitle2), + child: Text(args.transaction.symbol, style: Theme.of(context).textTheme.titleSmall), ), ], ), - Text(args.fiatData?.asFormattedString() ?? '', style: Theme.of(context).textTheme.subtitle2), + Text(args.fiatData?.asFormattedString() ?? '', style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 30.0), Row( children: [ @@ -65,20 +65,20 @@ class ReceivePaidSuccessDialog extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(args.from.nickname, textAlign: TextAlign.start, style: Theme.of(context).textTheme.button), + Text(args.from.nickname, textAlign: TextAlign.start, style: Theme.of(context).textTheme.labelLarge), const SizedBox(height: 8), Text(args.transaction.from, style: Theme.of(context).textTheme.subtitle2LowEmphasis) ], ), ), ), - Container( + DecoratedBox( decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.elliptical(4, 4)), color: AppColors.lightGreen6), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0), child: - Text(context.loc.transferReceivePaidSuccessFrom, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferReceivePaidSuccessFrom, style: Theme.of(context).textTheme.titleSmall), ), ), ], @@ -86,20 +86,20 @@ class ReceivePaidSuccessDialog extends StatelessWidget { const SizedBox(height: 30.0), Row( children: [ - Text(context.loc.transferReceivePaidSuccessDate, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferReceivePaidSuccessDate, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), Text( DateFormat('dd MMMM yyyy').format(DateTime.now()), - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ], ), const SizedBox(height: 20.0), Row( children: [ - Text(context.loc.transferReceivePaidSuccessStatus, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferReceivePaidSuccessStatus, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), - Container( + DecoratedBox( decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(20)), color: AppColors.lightGreen6), child: Padding( @@ -107,7 +107,7 @@ class ReceivePaidSuccessDialog extends StatelessWidget { child: Text( context.loc.transferReceivePaidSuccessButtonTitle, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), ), diff --git a/lib/screens/transfer/receive/receive_detail_qr_code/receive_detail_qr_code.dart b/lib/screens/transfer/receive/receive_detail_qr_code/receive_detail_qr_code.dart index 8e676d214..d4e15231c 100644 --- a/lib/screens/transfer/receive/receive_detail_qr_code/receive_detail_qr_code.dart +++ b/lib/screens/transfer/receive/receive_detail_qr_code/receive_detail_qr_code.dart @@ -74,7 +74,7 @@ class ReceiveDetailQrCodeScreen extends StatelessWidget { ), ), const SizedBox(height: 40), - Text(context.loc.transferReceiveWaiting, style: Theme.of(context).textTheme.headline6), + Text(context.loc.transferReceiveWaiting, style: Theme.of(context).textTheme.titleLarge), Padding( padding: const EdgeInsets.fromLTRB(60.0, 40, 60.0, 0), child: FlatButtonLong( 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 f05f9179c..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 @@ -1,7 +1,6 @@ import 'package:seeds/datasource/local/models/token_data_model.dart'; import 'package:seeds/datasource/local/settings_storage.dart'; import 'package:seeds/datasource/remote/api/invoice_repository.dart'; -import 'package:seeds/datasource/remote/model/token_model.dart'; import 'package:seeds/domain-shared/app_constants.dart'; import 'package:seeds/domain-shared/base_use_case.dart'; import 'package:seeds/domain-shared/shared_use_cases/cerate_firebase_dynamic_link_use_case.dart'; @@ -19,7 +18,7 @@ class ReceiveSeedsInvoiceUseCase extends InputUseCase invoice = await _invoiceRepository.createInvoice( tokenAmount: input.tokenAmount, accountName: settingsStorage.accountName, - tokenContract: TokenModel.fromId(input.tokenAmount.id!).contract, + tokenContract: input.tokenAmount.token.contract, memo: input.memo, ); diff --git a/lib/screens/transfer/receive/receive_selection/components/receive_selection_card.dart b/lib/screens/transfer/receive/receive_selection/components/receive_selection_card.dart index c82291655..cb96554a5 100644 --- a/lib/screens/transfer/receive/receive_selection/components/receive_selection_card.dart +++ b/lib/screens/transfer/receive/receive_selection/components/receive_selection_card.dart @@ -33,7 +33,7 @@ class ReceiveSelectionCard extends StatelessWidget { ), Text( title, - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, textAlign: TextAlign.center, ), ], diff --git a/lib/screens/transfer/send/send_confirmation/components/generic_transaction_success_dialog.dart b/lib/screens/transfer/send/send_confirmation/components/generic_transaction_success_dialog.dart index 550085c27..fff8658ef 100644 --- a/lib/screens/transfer/send/send_confirmation/components/generic_transaction_success_dialog.dart +++ b/lib/screens/transfer/send/send_confirmation/components/generic_transaction_success_dialog.dart @@ -31,29 +31,29 @@ class GenericTransactionSuccessDialog extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(context.loc.transferTransactionSuccessHeader, style: Theme.of(context).textTheme.headline4) + Text(context.loc.transferTransactionSuccessHeader, style: Theme.of(context).textTheme.headlineMedium) ], ), const SizedBox(height: 30.0), Row( children: [ - Text(context.loc.transferTransactionSuccessDate, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferTransactionSuccessDate, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), Text( DateFormat('dd MMMM yyyy HH:mm').format(transactionModel.timestamp?.toLocal() ?? DateTime.now()), - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ], ), Row( children: [ - Text(context.loc.transferTransactionSuccessID, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferTransactionSuccessID, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), Expanded( child: Text( transactionModel.transactionId ?? "", overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), IconButton( @@ -69,9 +69,9 @@ class GenericTransactionSuccessDialog extends StatelessWidget { ), Row( children: [ - Text(context.loc.transferTransactionSuccessStatus, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferTransactionSuccessStatus, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), - Container( + DecoratedBox( decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(20)), color: AppColors.lightGreen6), child: Padding( @@ -79,7 +79,7 @@ class GenericTransactionSuccessDialog extends StatelessWidget { child: Text( context.loc.transferTransactionSuccessSuccessful, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), ), diff --git a/lib/screens/transfer/send/send_confirmation/components/send_transaction_success_dialog.dart b/lib/screens/transfer/send/send_confirmation/components/send_transaction_success_dialog.dart index 59ec0173d..af69dba66 100644 --- a/lib/screens/transfer/send/send_confirmation/components/send_transaction_success_dialog.dart +++ b/lib/screens/transfer/send/send_confirmation/components/send_transaction_success_dialog.dart @@ -70,14 +70,14 @@ class SendTransactionSuccessDialog extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(amount, style: Theme.of(context).textTheme.headline4), + Text(amount, style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(top: 14, left: 4), - child: Text(tokenSymbol, style: Theme.of(context).textTheme.subtitle2), + child: Text(tokenSymbol, style: Theme.of(context).textTheme.titleSmall), ), ], ), - Text(fiatAmount?.asFormattedString() ?? "", style: Theme.of(context).textTheme.subtitle2), + Text(fiatAmount?.asFormattedString() ?? "", style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 30.0), DialogRow( imageUrl: toImage, @@ -93,23 +93,23 @@ class SendTransactionSuccessDialog extends StatelessWidget { const SizedBox(height: 30.0), Row( children: [ - Text(context.loc.transferTransactionSuccessDate, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferTransactionSuccessDate, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), Text( DateFormat('dd MMMM yyyy').format(DateTime.now()), - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ], ), Row( children: [ - Text(context.loc.transferTransactionSuccessID, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferTransactionSuccessID, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), Expanded( child: Text( transactionID, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), IconButton( @@ -124,9 +124,9 @@ class SendTransactionSuccessDialog extends StatelessWidget { ), Row( children: [ - Text(context.loc.transferTransactionSuccessStatus, style: Theme.of(context).textTheme.subtitle2), + Text(context.loc.transferTransactionSuccessStatus, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16), - Container( + DecoratedBox( decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(20)), color: AppColors.lightGreen6), child: Padding( @@ -134,7 +134,7 @@ class SendTransactionSuccessDialog extends StatelessWidget { child: Text( context.loc.transferTransactionSuccessSuccessful, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ), ), @@ -166,19 +166,19 @@ class DialogRow extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(name ?? account, textAlign: TextAlign.start, style: Theme.of(context).textTheme.button), + Text(name ?? account, textAlign: TextAlign.start, style: Theme.of(context).textTheme.labelLarge), const SizedBox(height: 8), Text(account, style: Theme.of(context).textTheme.subtitle2LowEmphasis) ], ), ), ), - Container( + DecoratedBox( decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.elliptical(4, 4)), color: AppColors.lightGreen6), child: Padding( padding: const EdgeInsets.only(top: 4, bottom: 4, right: 8, left: 8), - child: Text(toOrFromText!, style: Theme.of(context).textTheme.subtitle2), + child: Text(toOrFromText!, style: Theme.of(context).textTheme.titleSmall), ), ), ], diff --git a/lib/screens/transfer/send/send_confirmation/components/transaction_action_card.dart b/lib/screens/transfer/send/send_confirmation/components/transaction_action_card.dart index 315ea750e..b377b4ab3 100644 --- a/lib/screens/transfer/send/send_confirmation/components/transaction_action_card.dart +++ b/lib/screens/transfer/send/send_confirmation/components/transaction_action_card.dart @@ -13,7 +13,7 @@ class TransactionActionCard extends StatelessWidget { Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(vertical: 6.0), - child: Container( + child: DecoratedBox( decoration: BoxDecoration( border: Border.all(color: AppColors.grey1), borderRadius: const BorderRadius.all(Radius.circular(12)), @@ -26,7 +26,7 @@ class TransactionActionCard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(action.name?.inCaps ?? "", style: Theme.of(context).textTheme.headline7), - Text(action.account ?? "", style: Theme.of(context).textTheme.subtitle2), + Text(action.account ?? "", style: Theme.of(context).textTheme.titleSmall), ], ), const Divider(color: AppColors.grey1), @@ -41,7 +41,7 @@ class TransactionActionCard extends StatelessWidget { children: [ Text(i.key.inCaps, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis), const SizedBox(width: 4), - Flexible(child: Text('${i.value}', style: Theme.of(context).textTheme.subtitle2)), + Flexible(child: Text('${i.value}', style: Theme.of(context).textTheme.titleSmall)), ], ), ), diff --git a/lib/screens/transfer/send/send_confirmation/interactor/mappers/initial_validation_state_mapper.dart b/lib/screens/transfer/send/send_confirmation/interactor/mappers/initial_validation_state_mapper.dart index 2d870da41..addc449dc 100644 --- a/lib/screens/transfer/send/send_confirmation/interactor/mappers/initial_validation_state_mapper.dart +++ b/lib/screens/transfer/send/send_confirmation/interactor/mappers/initial_validation_state_mapper.dart @@ -1,4 +1,5 @@ import 'package:seeds/datasource/remote/model/balance_model.dart'; +import 'package:seeds/datasource/remote/model/token_model.dart'; import 'package:seeds/domain-shared/page_state.dart'; import 'package:seeds/domain-shared/result_to_state_mapper.dart'; import 'package:seeds/screens/transfer/send/send_confirmation/interactor/viewmodels/send_confirmation_bloc.dart'; @@ -11,8 +12,15 @@ class InitialValidationStateMapper extends StateMapper { } else { final BalanceModel balance = result.asValue!.value; final eosAction = currentState.transaction.actions.first; - final amountRequested = (eosAction.data?['quantity'] as String).split(' ').first; - final hasEnoughBalance = (balance.quantity - double.parse(amountRequested)) >= 0; + final contract = eosAction.account; + final quantitySplit = (eosAction.data?['quantity'] as String).split(' '); + final amountRequested = quantitySplit.first; + final symbol = quantitySplit[1]; + final token = TokenModel.fromId("$contract#$symbol"); + final double insufficiency = double.parse(amountRequested) - balance.quantity; + final hasEnoughBalance = (token != null) ? + !token.blockTransfer(insufficiency, eosAction.data?['to']) : + insufficiency <= 0; if (hasEnoughBalance) { return currentState.copyWith(pageState: PageState.success); } else { diff --git a/lib/screens/transfer/send/send_confirmation/interactor/viewmodels/send_confirmation_bloc.dart b/lib/screens/transfer/send/send_confirmation/interactor/viewmodels/send_confirmation_bloc.dart index 08e1494a4..65d6c1adc 100644 --- a/lib/screens/transfer/send/send_confirmation/interactor/viewmodels/send_confirmation_bloc.dart +++ b/lib/screens/transfer/send/send_confirmation/interactor/viewmodels/send_confirmation_bloc.dart @@ -31,13 +31,25 @@ class SendConfirmationBloc extends Bloc i.symbol == symbol); - if (targetToken != null) { - final Result result = await GetAvailableBalanceUseCase().run(targetToken); - emit(InitialValidationStateMapper().mapResultToState(state, result)); - } + final eosAction = state.transaction.actions.first; + final symbol = (eosAction.data?['quantity'] as String).split(' ').last; + final contract = eosAction.account; + var targetToken = TokenModel.allTokens. + singleWhereOrNull((i) => i.symbol == symbol && i.contract == contract); + targetToken ??= TokenModel( + chainName: "Telos", + contract: eosAction.account!, + symbol: symbol, + name: eosAction.name!, + backgroundImageUrl: '', + logoUrl: '', + balanceSubTitle: 'Wallet Balance', + overdraw: '', + precision: 4, + usecases: [], + ); + final Result result = await GetAvailableBalanceUseCase().run(targetToken); + emit(InitialValidationStateMapper().mapResultToState(state, result)); } else { emit(state.copyWith(pageState: PageState.success)); } diff --git a/lib/screens/transfer/send/send_enter_data/components/send_confirmation_dialog.dart b/lib/screens/transfer/send/send_enter_data/components/send_confirmation_dialog.dart index 63379a20c..b508cd6e2 100644 --- a/lib/screens/transfer/send/send_enter_data/components/send_confirmation_dialog.dart +++ b/lib/screens/transfer/send/send_enter_data/components/send_confirmation_dialog.dart @@ -53,14 +53,14 @@ class SendConfirmationDialog extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(tokenAmount.amountString(), style: Theme.of(context).textTheme.headline4), + Text(tokenAmount.amountString(), style: Theme.of(context).textTheme.headlineMedium), Padding( padding: const EdgeInsets.only(top: 14, left: 4), - child: Text(tokenAmount.symbol, style: Theme.of(context).textTheme.subtitle2), + child: Text(tokenAmount.symbol, style: Theme.of(context).textTheme.titleSmall), ), ], ), - Text(fiatAmount?.asFormattedString() ?? "", style: Theme.of(context).textTheme.subtitle2), + Text(fiatAmount?.asFormattedString() ?? "", style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 30.0), DialogRow(imageUrl: toImage, account: toAccount, name: toName, toOrFromText: context.loc.transferSendTo), const SizedBox(height: 24.0), @@ -68,9 +68,9 @@ class SendConfirmationDialog extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(context.loc.transferSendNetworkFee, - textAlign: TextAlign.left, style: Theme.of(context).textTheme.subtitle2), + textAlign: TextAlign.left, style: Theme.of(context).textTheme.titleSmall), Text(context.loc.transferSendFreeAndInstant, - textAlign: TextAlign.right, style: Theme.of(context).textTheme.subtitle2), + textAlign: TextAlign.right, style: Theme.of(context).textTheme.titleSmall), ], ), const SizedBox(height: 40.0), @@ -79,14 +79,14 @@ class SendConfirmationDialog extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(context.loc.transferSendMemo, - textAlign: TextAlign.right, style: Theme.of(context).textTheme.subtitle2), + textAlign: TextAlign.right, style: Theme.of(context).textTheme.titleSmall), const SizedBox(width: 16.0), Flexible( child: Text(memo!, maxLines: 5, overflow: TextOverflow.ellipsis, textAlign: TextAlign.right, - style: Theme.of(context).textTheme.subtitle2), + style: Theme.of(context).textTheme.titleSmall), ), ], ) @@ -116,19 +116,19 @@ class DialogRow extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(name ?? account, textAlign: TextAlign.start, style: Theme.of(context).textTheme.button), + Text(name ?? account, textAlign: TextAlign.start, style: Theme.of(context).textTheme.labelLarge), const SizedBox(height: 8), Text(account, style: Theme.of(context).textTheme.subtitle2LowEmphasis) ], ), ), ), - Container( + DecoratedBox( decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.elliptical(4, 4)), color: AppColors.lightGreen6), child: Padding( padding: const EdgeInsets.only(top: 4, bottom: 4, right: 8, left: 8), - child: Text(toOrFromText!, style: Theme.of(context).textTheme.subtitle2), + child: Text(toOrFromText!, style: Theme.of(context).textTheme.titleSmall), ), ), ], 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 642fa5886..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 @@ -12,17 +12,19 @@ class SendAmountChangeMapper extends StateMapper { 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 bool enoughBalance = parsedQuantity <= currentAvailable || - currentState.availableBalance?.asFormattedString() == tokenAmount.asFormattedString(); + final double insufficiency = currentState.availableBalance?.asFormattedString() == tokenAmount.asFormattedString() + ? 0.0 + : parsedQuantity - currentAvailable; return currentState.copyWith( fiatAmount: fiatAmount, - isNextButtonEnabled: parsedQuantity > 0 && enoughBalance, + isNextButtonEnabled: parsedQuantity > 0 && !settingsStorage.selectedToken.blockTransfer(insufficiency, toAccount), tokenAmount: tokenAmount, - showAlert: !enoughBalance, + showAlert: settingsStorage.selectedToken.warnTransfer(insufficiency, toAccount) != null, ); } } diff --git a/lib/screens/transfer/send/send_enter_data/interactor/viewmodels/send_enter_data_bloc.dart b/lib/screens/transfer/send/send_enter_data/interactor/viewmodels/send_enter_data_bloc.dart index 5a8c054f2..2f7995a0a 100644 --- a/lib/screens/transfer/send/send_enter_data/interactor/viewmodels/send_enter_data_bloc.dart +++ b/lib/screens/transfer/send/send_enter_data/interactor/viewmodels/send_enter_data_bloc.dart @@ -8,6 +8,7 @@ import 'package:seeds/datasource/local/models/token_data_model.dart'; import 'package:seeds/datasource/local/settings_storage.dart'; import 'package:seeds/datasource/remote/model/balance_model.dart'; import 'package:seeds/datasource/remote/model/profile_model.dart'; +import 'package:seeds/datasource/remote/model/token_model.dart'; import 'package:seeds/domain-shared/app_constants.dart'; import 'package:seeds/domain-shared/base_use_case.dart'; import 'package:seeds/domain-shared/page_command.dart'; @@ -67,7 +68,7 @@ class SendEnterDataBloc extends Bloc { data: { 'from': settingsStorage.accountName, 'to': state.sendTo.account, - 'quantity': state.tokenAmount.asFormattedString(), + 'quantity': TokenModel.getAssetString(state.tokenAmount.id, state.tokenAmount.amount), 'memo': state.memo, }, ), diff --git a/lib/screens/transfer/send/send_enter_data/send_enter_data_screen.dart b/lib/screens/transfer/send/send_enter_data/send_enter_data_screen.dart index f6d23ace0..dbec49850 100644 --- a/lib/screens/transfer/send/send_enter_data/send_enter_data_screen.dart +++ b/lib/screens/transfer/send/send_enter_data/send_enter_data_screen.dart @@ -87,7 +87,7 @@ class SendEnterDataScreen extends StatelessWidget { ? const SendLoadingIndicator() : const SafeArea(child: FullPageLoadingIndicator()); case PageState.failure: - return const SafeArea(child: FullPageErrorIndicator()); + return SafeArea(child: FullPageErrorIndicator(errorMessage: state.errorMessage)); case PageState.success: return SafeArea( minimum: const EdgeInsets.all(horizontalEdgePadding), @@ -101,7 +101,7 @@ class SendEnterDataScreen extends StatelessWidget { padding: const EdgeInsets.only(top: 10), child: Text( context.loc.transferSendSendTo, - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, ), ), const SizedBox(height: 8), diff --git a/lib/screens/transfer/send/send_scanner/send_scanner_screen.dart b/lib/screens/transfer/send/send_scanner/send_scanner_screen.dart index f9e13c7e7..958bd7c2e 100644 --- a/lib/screens/transfer/send/send_scanner/send_scanner_screen.dart +++ b/lib/screens/transfer/send/send_scanner/send_scanner_screen.dart @@ -46,7 +46,7 @@ class _SendScannerScreenState extends State { child: Column( children: [ const SizedBox(height: 32), - Text(context.loc.transferSendScanQRCodePrompt, style: Theme.of(context).textTheme.button), + Text(context.loc.transferSendScanQRCodePrompt, style: Theme.of(context).textTheme.labelLarge), const SizedBox(height: 82), _scannerWidget, BlocBuilder( @@ -69,7 +69,7 @@ class _SendScannerScreenState extends State { padding: const EdgeInsets.all(8.0), child: Text( state.errorMessage!, - style: Theme.of(context).textTheme.subtitle2!.copyWith(color: AppColors.orangeYellow), + style: Theme.of(context).textTheme.titleSmall!.copyWith(color: AppColors.orangeYellow), textAlign: TextAlign.center, ), ), diff --git a/lib/screens/wallet/components/receive_send_buttons.dart b/lib/screens/wallet/components/receive_send_buttons.dart index da0ddb030..15b6a064b 100644 --- a/lib/screens/wallet/components/receive_send_buttons.dart +++ b/lib/screens/wallet/components/receive_send_buttons.dart @@ -39,7 +39,7 @@ class ReceiveSendButtons extends StatelessWidget { const Icon(Icons.arrow_upward, color: AppColors.white), Container( padding: const EdgeInsets.only(left: 4, top: 4), - child: Text(context.loc.walletSendButtonTitle, style: Theme.of(context).textTheme.button), + child: Text(context.loc.walletSendButtonTitle, style: Theme.of(context).textTheme.labelLarge), ), ], ), @@ -67,7 +67,7 @@ class ReceiveSendButtons extends StatelessWidget { const Icon(Icons.arrow_downward, color: AppColors.white), Container( padding: const EdgeInsets.only(left: 4, top: 4), - child: Text(context.loc.walletReceiveButtonTitle, style: Theme.of(context).textTheme.button), + child: Text(context.loc.walletReceiveButtonTitle, style: Theme.of(context).textTheme.labelLarge), ), ], ), diff --git a/lib/screens/wallet/components/tokens_cards/components/currency_info_card.dart b/lib/screens/wallet/components/tokens_cards/components/currency_info_card.dart index 700da212c..0778674d8 100644 --- a/lib/screens/wallet/components/tokens_cards/components/currency_info_card.dart +++ b/lib/screens/wallet/components/tokens_cards/components/currency_info_card.dart @@ -5,7 +5,8 @@ import 'package:seeds/utils/build_context_extension.dart'; class CurrencyInfoCard extends StatelessWidget { // TODO(chuck): provide default image - static const defaultBgImage = 'assets/images/wallet/currency_info_cards/tlos/background.jpg'; + static const defaultBgImage = 'assets/images/wallet/currency_info_cards/tlos/background.png'; + static const defaultBalanceSubtitle = 'Balance'; final TokenBalanceViewModel tokenBalance; final String fiatBalance; @@ -33,7 +34,7 @@ class CurrencyInfoCard extends StatelessWidget { ), child: Stack( children: [ - if ((tokenBalance.token.usecases?.contains('experimental')) ?? false) + if (tokenBalance.token.usecases?.contains('experimental') ?? false) Container( width: 128, height: 128, @@ -67,10 +68,10 @@ class CurrencyInfoCard extends StatelessWidget { ), const SizedBox(height: 50), Text(context.loc.walletCurrencyCardBalance, - style: Theme.of(context).textTheme.subtitle2!.copyWith(color: textColor)), + style: Theme.of(context).textTheme.titleSmall!.copyWith(color: textColor)), const SizedBox(height: 6), Text(tokenBalance.displayQuantity, - style: Theme.of(context).textTheme.headline5!.copyWith(color: textColor)), + style: Theme.of(context).textTheme.headlineSmall!.copyWith(color: textColor)), const SizedBox(height: 6), Text(fiatBalance, style: Theme.of(context).textTheme.subtitle3.copyWith(color: textColor)) ], diff --git a/lib/screens/wallet/components/tokens_cards/interactor/mappers/token_balances_state_mapper.dart b/lib/screens/wallet/components/tokens_cards/interactor/mappers/token_balances_state_mapper.dart index b90d1fc88..60131f52b 100644 --- a/lib/screens/wallet/components/tokens_cards/interactor/mappers/token_balances_state_mapper.dart +++ b/lib/screens/wallet/components/tokens_cards/interactor/mappers/token_balances_state_mapper.dart @@ -37,7 +37,7 @@ class TokenBalancesStateMapper { } } else { final BalanceModel balance = result.asValue!.value; - if (whitelisted || balance.quantity > 0) { + if (whitelisted || balance.quantity != 0) { available.add(TokenBalanceViewModel(token, TokenDataModel(balance.quantity, token: token))); newWhitelist.add(token.id); } diff --git a/lib/screens/wallet/components/tokens_cards/tokens_cards.dart b/lib/screens/wallet/components/tokens_cards/tokens_cards.dart index 8f6b9c696..8410e096d 100644 --- a/lib/screens/wallet/components/tokens_cards/tokens_cards.dart +++ b/lib/screens/wallet/components/tokens_cards/tokens_cards.dart @@ -39,7 +39,7 @@ class _TokenCardsState extends State with AutomaticKeepAliveClientMi SingleChildScrollView( child: CarouselSlider( items: [ - for (var tokenBalanceViewModel in state.availableTokens) + for (final tokenBalanceViewModel in state.availableTokens) Container( margin: EdgeInsets.only( left: tokenBalanceViewModel.token == state.availableTokens.first.token ? 0 : 10.0, diff --git a/lib/screens/wallet/components/transaction_details_bottom_sheet.dart b/lib/screens/wallet/components/transaction_details_bottom_sheet.dart index 287d92137..538f235e3 100644 --- a/lib/screens/wallet/components/transaction_details_bottom_sheet.dart +++ b/lib/screens/wallet/components/transaction_details_bottom_sheet.dart @@ -90,7 +90,7 @@ class TransactionDetailsBottomSheet extends StatelessWidget { else Text('-', style: Theme.of(context).textTheme.subtitle1Red2), const SizedBox(width: 4), - Text(transaction.quantity.seedsFormatted, style: Theme.of(context).textTheme.headline5) + Text(transaction.quantity.seedsFormatted, style: Theme.of(context).textTheme.headlineSmall) ], ), Padding( diff --git a/lib/screens/wallet/components/transactions_list/components/transaction_info_row.dart b/lib/screens/wallet/components/transactions_list/components/transaction_info_row.dart index 292e84073..d656a55c9 100644 --- a/lib/screens/wallet/components/transactions_list/components/transaction_info_row.dart +++ b/lib/screens/wallet/components/transactions_list/components/transaction_info_row.dart @@ -55,7 +55,7 @@ class TransactionInfoRow extends StatelessWidget { Expanded( child: Text( state.localizedDisplayName(context), - style: Theme.of(context).textTheme.button, + style: Theme.of(context).textTheme.labelLarge, overflow: TextOverflow.ellipsis, maxLines: 1, ), @@ -66,7 +66,7 @@ class TransactionInfoRow extends StatelessWidget { else Text('-', style: Theme.of(context).textTheme.subtitle1Red2), const SizedBox(width: 4), - Text(amount.seedsFormatted, style: Theme.of(context).textTheme.button), + Text(amount.seedsFormatted, style: Theme.of(context).textTheme.labelLarge), ], ), const SizedBox(height: 10), diff --git a/lib/screens/wallet/components/transactions_list/components/transaction_loading_row.dart b/lib/screens/wallet/components/transactions_list/components/transaction_loading_row.dart index b2eeeb2fe..4d11230ed 100644 --- a/lib/screens/wallet/components/transactions_list/components/transaction_loading_row.dart +++ b/lib/screens/wallet/components/transactions_list/components/transaction_loading_row.dart @@ -7,29 +7,29 @@ class TransactionLoadingRow extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 10, bottom: 10, right: 20, left: 20), + return const Padding( + padding: EdgeInsets.only(top: 10, bottom: 10, right: 20, left: 20), child: Row( children: [ - const ShimmerCircle(60), + ShimmerCircle(60), Expanded( child: Padding( - padding: const EdgeInsets.only(left: 10), + padding: EdgeInsets.only(left: 10), child: Column( children: [ Row( children: [ - const ShimmerRectangle(size: Size(110, 21)), - const Spacer(), - const ShimmerRectangle(size: Size(64, 21)), + ShimmerRectangle(size: Size(110, 21)), + Spacer(), + ShimmerRectangle(size: Size(64, 21)), ], ), - const SizedBox(height: 10), + SizedBox(height: 10), Row( children: [ - const ShimmerRectangle(size: Size(70, 16)), - const Spacer(), - const ShimmerRectangle(size: Size(44, 16)), + ShimmerRectangle(size: Size(70, 16)), + Spacer(), + ShimmerRectangle(size: Size(44, 16)), ], ) ], diff --git a/lib/seeds_app.dart b/lib/seeds_app.dart index 817a6e060..e55f3ce47 100644 --- a/lib/seeds_app.dart +++ b/lib/seeds_app.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:i18n_extension/i18n_widget.dart'; +import 'package:i18n_extension/i18n_extension.dart'; import 'package:seeds/blocs/authentication/viewmodels/authentication_bloc.dart'; import 'package:seeds/blocs/deeplink/viewmodels/deeplink_bloc.dart'; import 'package:seeds/blocs/rates/viewmodels/rates_bloc.dart'; diff --git a/lib/utils/placemark_extension.dart b/lib/utils/placemark_extension.dart index 45a1cb948..5e8dbd55a 100644 --- a/lib/utils/placemark_extension.dart +++ b/lib/utils/placemark_extension.dart @@ -2,12 +2,12 @@ import 'package:geocoding/geocoding.dart'; extension PlacemarkExtension on Placemark { String get toPlaceText { - final String _thoroughfare = thoroughfare ?? ''; - final String _subThoroughfare = subThoroughfare ?? ''; - final String _subLocality = subLocality ?? ''; - final String _postalCode = postalCode ?? ''; - final String _locality = locality ?? ''; - final String _administrativeArea = administrativeArea ?? ''; - return '$_thoroughfare $_subThoroughfare $_subLocality $_postalCode $_locality $_administrativeArea'; + final String thoroughfare = this.thoroughfare ?? ''; + final String subThoroughfare = this.subThoroughfare ?? ''; + final String subLocality = this.subLocality ?? ''; + final String postalCode = this.postalCode ?? ''; + final String locality = this.locality ?? ''; + final String administrativeArea = this.administrativeArea ?? ''; + return '$thoroughfare $subThoroughfare $subLocality $postalCode $locality $administrativeArea'; } } diff --git a/lib/utils/rate_states_extensions.dart b/lib/utils/rate_states_extensions.dart index b407277e8..b6a276b05 100644 --- a/lib/utils/rate_states_extensions.dart +++ b/lib/utils/rate_states_extensions.dart @@ -27,7 +27,7 @@ extension RatesStateExtensions on RatesState { if (rateModel != null) { final double? tokenValue = rateModel.usdToToken(usdValue); if (tokenValue != null) { - return TokenDataModel(tokenValue, token: TokenModel.fromId(tokenId)); + return TokenDataModel(tokenValue, token: TokenModel.fromId(tokenId)!); } } } diff --git a/pubspec.yaml b/pubspec.yaml index 1b7ae9449..857dffe4f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: SEEDS Wallet version: 2.9.4+87 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.17.0 <3.6.0' analyzer: enable-experiment: extension-methods @@ -19,10 +19,10 @@ dependencies: url_launcher: ^6.1.0 step_progress_indicator: ^1.0.1 uni_links: ^0.5.1 - intl: ^0.18.0 + intl: ^0.19.0 flutter_localizations: sdk: flutter - i18n_extension: ^7.0.0 + i18n_extension: ^12.0.1 http: ^0.13.4 shared_preferences: ^2.0.9 flutter_secure_storage: ^5.0.2 @@ -53,9 +53,9 @@ dependencies: geolocator: ^8.2.0 geocoding: ^2.0.2 permission_handler: ^9.2.0 - json_schema2: ^2.0.2 + json_schema: ^5.1.7 local_auth_android: ^1.0.32 - local_auth_ios: ^1.1.3 + local_auth_darwin: ^1.3.1 firebase_dynamic_links: ^5.3.4 firebase_remote_config: ^4.2.4 firebase_storage: ^11.2.5 @@ -65,6 +65,7 @@ dependencies: firebase_app_installations: ^0.2.3+4 package_info_plus: ^4.1.0 flutter_dotenv: ^5.1.0 + dynamic_parallel_queue: ^1.0.3+2 dev_dependencies: flutter_test: diff --git a/test/flows_to_test.md b/test/flows_to_test.md new file mode 100644 index 000000000..b4ac47061 --- /dev/null +++ b/test/flows_to_test.md @@ -0,0 +1,53 @@ +## Flows To Test +We currently don't have any integration tests or widget tests to automatically verify the UI and functionality changes. Therefore, the following flows must be tested manually to ensure that all functionalities are working correctly. + +### Onboarding +- Import account using Seed Phrase +- Import account using Private Key +- Create account by scanning QR Code +- Create account by following the deeplink + +### Wallet +- View transaction details +- Send tokens (search for a user, try changing the denomination) +- Send tokens by scanning QR code +- Receive tokens (share link, check payment status) + +### Explore +- Regions + - Location permission (accept/deny to test) + - Search for a plan in Map + - View a region’s details + - Join a region + - Create a region (requires 1000 seeds tokens) +- Invite a Friend + - Share invite + - Manage invites +- Vouch + - Vouch someone + - View thou vouched for you +- Flag + - View users flagged by you + - Flag a user +- Vote + - View open proposals + - View upcoming proposals + - View past proposals + - View specific proposal details +- Plant Seeds + - Plant specific amount of seeds +- Unplant Seeds + - Unplant specific amount or max seeds +- Get Seeds + +### Profile +- Edit name +- Change currency +- View contribution score +- View progress +- Security + - Export private key + - Add Guardians + - View or copy seed phrase + - Pin security toggle + - Biometric auth toggle \ No newline at end of file diff --git a/test/utils/serialize_test.dart b/test/utils/serialize_test.dart index 87ae5c151..7474eaea1 100644 --- a/test/utils/serialize_test.dart +++ b/test/utils/serialize_test.dart @@ -8,13 +8,13 @@ void main() { group('public keys', () { test('serialize k1 old style', () { final keystring = 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV'; - final sb = new SerialBuffer(new Uint8List(0)); + final sb = SerialBuffer(Uint8List(0)); sb.pushPublicKey(keystring); final serialized = sb.asUint8List(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(serialized, [0, 2, 192, 222, 210, 188, 31, 19, 5, 251, 15, 170, 197, 230, 192, 62, @@ -23,13 +23,13 @@ void main() { }); test('serialize k1 new style', () { final keystring = 'PUB_K1_6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5BoDq63'; - final sb = new SerialBuffer(new Uint8List(0)); + final sb = SerialBuffer(Uint8List(0)); sb.pushPublicKey(keystring); final serialized = sb.asUint8List(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(serialized, [0, 2, 192, 222, 210, 188, 31, 19, 5, 251, 15, 170, 197, 230, 192, 62, @@ -40,24 +40,24 @@ void main() { final serialized = Uint8List.fromList([0, 2, 192, 222, 210, 188, 31, 19, 5, 251, 15, 170, 197, 230, 192, 62, 227, 161, 146, 66, 52, 152, 84, 39, 182, 22, 124, 165, 105, 209, 61, 244, 53, 207]); - final sb = new SerialBuffer(serialized); + final sb = SerialBuffer(serialized); final keystring = sb.getPublicKey(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(keystring, 'PUB_K1_6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5BoDq63'); }); test('serialize r1 new style', () { final keystring = 'PUB_R1_6eMzJfDVWvzMTYAUWQ95JcpoY8vFL62pTFm6spim25n5wqtVWP'; - final sb = new SerialBuffer(new Uint8List(0)); + final sb = SerialBuffer(Uint8List(0)); sb.pushPublicKey(keystring); final serialized = sb.asUint8List(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(serialized, [1, 2, 231, 80, 174, 4, 190, 33, 189, 1, 48, 165, 223, 203, 242, @@ -69,12 +69,12 @@ void main() { [1, 2, 231, 80, 174, 4, 190, 33, 189, 1, 48, 165, 223, 203, 242, 125, 16, 95, 97, 223, 20, 206, 120, 17, 207, 107, 49, 24, 30, 7, 140, 39, 8, 36]); - final sb = new SerialBuffer(serialized); + final sb = SerialBuffer(serialized); final keystring = sb.getPublicKey(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(keystring, 'PUB_R1_6eMzJfDVWvzMTYAUWQ95JcpoY8vFL62pTFm6spim25n5wqtVWP'); }); @@ -84,13 +84,13 @@ void main() { group('private keys', () { test('serialize k1 old style', () { final keystring = '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'; - final sb = new SerialBuffer(new Uint8List(0)); + final sb = SerialBuffer(Uint8List(0)); sb.pushPrivateKey(keystring); final serialized = sb.asUint8List(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(serialized, [0, 210, 101, 63, 247, 203, 178, 216, 255, 18, 154, 194, 126, 245, @@ -99,13 +99,13 @@ void main() { }); test('serialize k1 new style', () { final keystring = 'PVT_K1_2bfGi9rYsXQSXXTvJbDAPhHLQUojjaNLomdm3cEJ1XTzMqUt3V'; - final sb = new SerialBuffer(new Uint8List(0)); + final sb = SerialBuffer(Uint8List(0)); sb.pushPrivateKey(keystring); final serialized = sb.asUint8List(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(serialized, [0, 210, 101, 63, 247, 203, 178, 216, 255, 18, 154, 194, 126, 245, @@ -116,24 +116,24 @@ void main() { final serialized = Uint8List.fromList([0, 210, 101, 63, 247, 203, 178, 216, 255, 18, 154, 194, 126, 245, 120, 28, 230, 139, 37, 88, 196, 26, 116, 175, 31, 45, 220, 166, 53, 203, 238, 240, 125]); - final sb = new SerialBuffer(serialized); + final sb = SerialBuffer(serialized); final keystring = sb.getPrivateKey(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(keystring, 'PVT_K1_2bfGi9rYsXQSXXTvJbDAPhHLQUojjaNLomdm3cEJ1XTzMqUt3V'); }); test('serialize r1 new style', () { final keystring = 'PVT_R1_2JrJRQXEagWobhJbHWtP11muTWi5pgCJ6uXWhGKd2KcFBGF7mT'; - final sb = new SerialBuffer(new Uint8List(0)); + final sb = SerialBuffer(Uint8List(0)); sb.pushPrivateKey(keystring); final serialized = sb.asUint8List(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(serialized, [1, 172, 58, 10, 48, 178, 188, 37, 15, 234, 129, 216, 243, 182, @@ -145,12 +145,12 @@ void main() { [1, 172, 58, 10, 48, 178, 188, 37, 15, 234, 129, 216, 243, 182, 68, 115, 41, 18, 206, 91, 223, 230, 199, 84, 66, 41, 110, 159, 117, 45, 189, 67, 43]); - final sb = new SerialBuffer(serialized); + final sb = SerialBuffer(serialized); final keystring = sb.getPrivateKey(); if(verbose) { print("keystring: $keystring"); - print("serialized: $serialized\n"+" ${arrayToHex(serialized)}"); + print("serialized: $serialized\n"" ${arrayToHex(serialized)}"); } expect(keystring, 'PVT_R1_2JrJRQXEagWobhJbHWtP11muTWi5pgCJ6uXWhGKd2KcFBGF7mT'); });