diff --git a/CHANGELOG.md b/CHANGELOG.md index 401be70b..9b3f39df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +# [3.3.0-beta] - 20220620 +1. flutter upgrade 3.0.1 +2. karura - crab/turing xcm #160 #184 +3. karura/acala runtime 2070 #173 +4. karura/acala node list update - removed patract & added dwellir +5. ui 优化(斜切角、car背景圆角统一、中文字号字体) #189 #190 #191 +6. claim rewards amount under ED #178 +7. Pop up for update #129 +8. acala plugin defi tx history #174 +9. LKSM/LDOT APY update & banner update +10. Search token symbol to navigate the LP pool #149 + +# [3.2.9-beta] - 20220606 +1. 修复 DOT/KSM Staking 发送交易问题 #154 +2. 切换网络操作增加确认弹窗 #131 +3. tDOT 名称修复 #155 +4. assets 列表管理页面 native token 显示 symbol #156 +5. DOT/KSM Staking cross-chain 选择 #158 + destED 修复 + # [3.2.8-beta] - 20220602 - karura new xcm #122 - acala new xcm #121 #143 diff --git a/android/app/build.gradle b/android/app/build.gradle index f9e7135d..e5862a95 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,7 +27,17 @@ apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -42,7 +52,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "io.polkawallet.www.polka_wallet" minSdkVersion 23 - targetSdkVersion 30 + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d39d1cfa..36b426c5 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,13 +6,13 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> 7.7) - PromisesObjC (< 3.0, >= 1.2) - Flutter (1.0.0) + - flutter_aes_ecb_pkcs5 (0.0.1): + - Flutter - flutter_inappwebview (0.0.1): - Flutter - flutter_inappwebview/Core (= 0.0.1) @@ -128,13 +128,13 @@ PODS: - OrderedSet (5.0.0) - package_info (0.0.1): - Flutter - - path_provider (0.0.1): + - path_provider_ios (0.0.1): - Flutter - "permission_handler (5.1.0+2)": - Flutter - PromisesObjC (2.0.0) - - Reachability (3.2) - - shared_preferences (0.0.1): + - ReachabilitySwift (5.0.0) + - shared_preferences_ios (0.0.1): - Flutter - sqflite (0.0.2): - Flutter @@ -143,9 +143,9 @@ PODS: - Flutter - update_app (0.0.1): - Flutter - - url_launcher (0.0.1): + - url_launcher_ios (0.0.1): - Flutter - - video_player (0.0.1): + - video_player_avfoundation (0.0.1): - Flutter - wakelock (0.0.1): - Flutter @@ -153,7 +153,6 @@ PODS: - Flutter DEPENDENCIES: - - aes_ecb_pkcs5_flutter (from `.symlinks/plugins/aes_ecb_pkcs5_flutter/ios`) - biometric_storage (from `.symlinks/plugins/biometric_storage/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) @@ -163,19 +162,20 @@ DEPENDENCIES: - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.5.0`) - Flutter (from `Flutter`) + - flutter_aes_ecb_pkcs5 (from `.symlinks/plugins/flutter_aes_ecb_pkcs5/ios`) - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - flutter_qr_scan (from `.symlinks/plugins/flutter_qr_scan/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`) - jpush_flutter (from `.symlinks/plugins/jpush_flutter/ios`) - package_info (from `.symlinks/plugins/package_info/ios`) - - path_provider (from `.symlinks/plugins/path_provider/ios`) + - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - uni_links (from `.symlinks/plugins/uni_links/ios`) - update_app (from `.symlinks/plugins/update_app/ios`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - - video_player (from `.symlinks/plugins/video_player/ios`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`) - wakelock (from `.symlinks/plugins/wakelock/ios`) - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) @@ -195,11 +195,9 @@ SPEC REPOS: - nanopb - OrderedSet - PromisesObjC - - Reachability + - ReachabilitySwift EXTERNAL SOURCES: - aes_ecb_pkcs5_flutter: - :path: ".symlinks/plugins/aes_ecb_pkcs5_flutter/ios" biometric_storage: :path: ".symlinks/plugins/biometric_storage/ios" connectivity_plus: @@ -215,6 +213,8 @@ EXTERNAL SOURCES: :tag: 8.5.0 Flutter: :path: Flutter + flutter_aes_ecb_pkcs5: + :path: ".symlinks/plugins/flutter_aes_ecb_pkcs5/ios" flutter_inappwebview: :path: ".symlinks/plugins/flutter_inappwebview/ios" flutter_qr_scan: @@ -225,22 +225,22 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/jpush_flutter/ios" package_info: :path: ".symlinks/plugins/package_info/ios" - path_provider: - :path: ".symlinks/plugins/path_provider/ios" + path_provider_ios: + :path: ".symlinks/plugins/path_provider_ios/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" - shared_preferences: - :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_ios: + :path: ".symlinks/plugins/shared_preferences_ios/ios" sqflite: :path: ".symlinks/plugins/sqflite/ios" uni_links: :path: ".symlinks/plugins/uni_links/ios" update_app: :path: ".symlinks/plugins/update_app/ios" - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" - video_player: - :path: ".symlinks/plugins/video_player/ios" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + video_player_avfoundation: + :path: ".symlinks/plugins/video_player_avfoundation/ios" wakelock: :path: ".symlinks/plugins/wakelock/ios" webview_flutter_wkwebview: @@ -252,9 +252,8 @@ CHECKOUT OPTIONS: :tag: 8.5.0 SPEC CHECKSUMS: - aes_ecb_pkcs5_flutter: a82e6ecc47654000805ad9d094a8cd29e4bf9667 biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9 - connectivity_plus: 5f0eb61093bec56935f21a1699dd2758bc895587 + connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Firebase: ff8c73105b90e33e1dc6c8e5445d7adc2ccdc7c1 firebase_analytics: 3b7d92b8d1a3482f557c201e5e46c2f7fa2644ff @@ -265,6 +264,7 @@ SPEC CHECKSUMS: FirebaseFirestore: 69e4f06a375080a56ffd390fb034467b58ddeda0 FirebaseInstallations: 044eede8a049bce71c4541ee68d6e4364fcbe774 Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + flutter_aes_ecb_pkcs5: fb682a7bb13f29cfbb33f88f7e1ed2211eacf5db flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721 flutter_qr_scan: f7c8c497584bbf395efd56ffcc3a60d27ec9de82 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a @@ -278,19 +278,19 @@ SPEC CHECKSUMS: nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 - path_provider: d1e9807085df1f9cc9318206cd649dc0b76be3de + path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 - Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 - shared_preferences: 5033afbb22d372e15aff8ff766df9021b845f273 + ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 uni_links: d97da20c7701486ba192624d99bffaaffcfc298a update_app: 03c24a56ba197e2a036d5230b02e85825b76e045 - url_launcher: b6e016d912f04be9f5bf6e8e82dc599b7ba59649 - video_player: 7e9dad9437c238a97648819f6dd443c8854cf0c7 + url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de + video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f - webview_flutter_wkwebview: 005fbd90c888a42c5690919a1527ecc6649e1162 + webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f PODFILE CHECKSUM: 54d14ef5a14a0b3c64cc6d6bfeff28f02dcce905 -COCOAPODS: 1.11.0 +COCOAPODS: 1.11.3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6cbe007d..53202664 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -147,7 +147,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -367,7 +367,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3282; + CURRENT_PROJECT_VERSION = 3303; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -385,7 +385,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.2.8; + MARKETING_VERSION = 3.3.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -514,7 +514,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3282; + CURRENT_PROJECT_VERSION = 3303; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -532,7 +532,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.2.8; + MARKETING_VERSION = 3.3.0; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -554,7 +554,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3282; + CURRENT_PROJECT_VERSION = 3303; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -572,7 +572,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.2.8; + MARKETING_VERSION = 3.3.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140cf..3db53b6e 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName diff --git a/lib/app.dart b/lib/app.dart index 0f249a19..96c454ad 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -150,63 +150,70 @@ class _WalletAppState extends State with WidgetsBindingObserver { elevation: 0, titleTextStyle: TextStyle( color: Color(0xFF565554), - fontSize: 18, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(18, context, locale: _locale), + fontFamily: + UI.getFontFamily('TitilliumWeb', context, locale: _locale), fontWeight: FontWeight.w600)), primarySwatch: color, hoverColor: secondaryColor, colorScheme: ColorScheme.fromSwatch().copyWith(), textTheme: TextTheme( headline1: TextStyle( - fontSize: 30, + fontSize: UI.getTextSize(30, context, locale: _locale), fontWeight: FontWeight.w600, color: Color(0xFF565554), - fontFamily: "TitilliumWeb"), + fontFamily: + UI.getFontFamily('TitilliumWeb', context, locale: _locale)), headline2: TextStyle( - fontSize: 22, + fontSize: UI.getTextSize(22, context, locale: _locale), ), headline3: TextStyle( - fontSize: 20, + fontSize: UI.getTextSize(20, context, locale: _locale), fontWeight: FontWeight.w600, color: Color(0xFF565554), - fontFamily: "TitilliumWeb"), + fontFamily: + UI.getFontFamily('TitilliumWeb', context, locale: _locale)), headline4: TextStyle( color: Color(0xFF565554), - fontSize: 16, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(16, context, locale: _locale), + fontFamily: + UI.getFontFamily('TitilliumWeb', context, locale: _locale), fontWeight: FontWeight.w400, ), headline5: TextStyle( color: Color(0xFF565554), - fontSize: 14, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(14, context, locale: _locale), + fontFamily: + UI.getFontFamily('TitilliumWeb', context, locale: _locale), fontWeight: FontWeight.w400, ), headline6: TextStyle( color: Color(0xFF565554), - fontSize: 12, - fontFamily: 'SF_Pro', + fontSize: UI.getTextSize(12, context, locale: _locale), + fontFamily: UI.getFontFamily('SF_Pro', context, locale: _locale), fontWeight: FontWeight.w400, ), bodyText1: TextStyle( - fontSize: 16, + fontSize: UI.getTextSize(16, context, locale: _locale), fontWeight: FontWeight.w400, color: Color(0xFF565554), - fontFamily: "SF_Pro"), + fontFamily: UI.getFontFamily('SF_Pro', context, locale: _locale)), bodyText2: TextStyle( - fontSize: 16, + fontSize: UI.getTextSize(16, context, locale: _locale), fontWeight: FontWeight.w300, color: Color(0xFF565554), - fontFamily: "SF_Pro"), + fontFamily: UI.getFontFamily('SF_Pro', context, locale: _locale)), caption: TextStyle( - fontSize: 12, + fontSize: UI.getTextSize(12, context, locale: _locale), fontWeight: FontWeight.w600, - fontFamily: "TitilliumWeb"), + fontFamily: + UI.getFontFamily('TitilliumWeb', context, locale: _locale)), button: TextStyle( - fontSize: 18, + fontSize: UI.getTextSize(18, context, locale: _locale), fontWeight: FontWeight.w600, color: Colors.white, - fontFamily: "TitilliumWeb")), + fontFamily: + UI.getFontFamily('TitilliumWeb', context, locale: _locale))), ); } @@ -226,6 +233,10 @@ class _WalletAppState extends State with WidgetsBindingObserver { } setState(() { _locale = res; + _theme = _getAppTheme( + _service.plugin.basic.primaryColor, + secondaryColor: _service.plugin.basic.gradientColor, + ); if (_locale != null) { _service.store.settings.initMessage((_locale).languageCode); } @@ -403,6 +414,40 @@ class _WalletAppState extends State with WidgetsBindingObserver { final isNetworkChanged = networkName != _service.plugin.basic.name; if (isNetworkChanged) { + final confirmed = await showCupertinoDialog( + context: _homePageContext, + builder: (BuildContext context) { + final dic = I18n.of(context).getDic(i18n_full_dic_app, 'assets'); + return CupertinoAlertDialog( + title: Text(dic['v3.changeNetwork']), + content: Container( + margin: EdgeInsets.only(top: 8), + child: Text( + '${dic['v3.changeNetwork.confirm']} ${networkName.toUpperCase()} ${dic['v3.changeNetwork.confirm.2']}'), + ), + actions: [ + CupertinoButton( + child: Text( + I18n.of(context) + .getDic(i18n_full_dic_ui, 'common')['cancel'], + style: TextStyle( + color: Theme.of(context).unselectedWidgetColor), + ), + onPressed: () => Navigator.of(context).pop(false), + ), + CupertinoButton( + child: Text( + I18n.of(context).getDic(i18n_full_dic_ui, 'common')['ok'], + style: TextStyle( + color: Theme.of(context).toggleableActiveColor), + ), + onPressed: () => Navigator.of(context).pop(true), + ), + ], + ); + }); + if (!confirmed) return; + // display a dialog while changing network showCupertinoDialog( context: _homePageContext, @@ -528,10 +573,6 @@ class _WalletAppState extends State with WidgetsBindingObserver { setState(() { _store = store; _service = service; - _theme = _getAppTheme( - service.plugin.basic.primaryColor, - secondaryColor: service.plugin.basic.gradientColor, - ); }); if (store.settings.localeCode.isNotEmpty) { @@ -709,7 +750,7 @@ class _WalletAppState extends State with WidgetsBindingObserver { //ecosystem TokenStaking.route: (_) => TokenStaking(_service), ConverToPage.route: (_) => ConverToPage(_service), - CrosschainTransferPage.route: (_) => CrosschainTransferPage(_service), + CrossChainTransferPage.route: (_) => CrossChainTransferPage(_service), CompletedPage.route: (_) => CompletedPage(_service), EcosystemPage.route: (_) => EcosystemPage(_service), @@ -857,7 +898,7 @@ class _WalletAppState extends State with WidgetsBindingObserver { }, child: ScreenUtilInit( designSize: Size(390, 844), - builder: () => MaterialApp( + builder: (_, __) => MaterialApp( title: 'Polkawallet', builder: (context, widget) { return MediaQuery( diff --git a/lib/common/components/jumpToLink.dart b/lib/common/components/jumpToLink.dart index 85c213a2..4ca4be70 100644 --- a/lib/common/components/jumpToLink.dart +++ b/lib/common/components/jumpToLink.dart @@ -25,7 +25,7 @@ class _JumpToLinkState extends State { child: Text( widget.text ?? widget.url, style: TextStyle( - fontSize: 12, + fontSize: UI.getTextSize(12, context), color: widget.color ?? Theme.of(context).primaryColor), ), ), diff --git a/lib/pages/account/create/backupAccountPage.dart b/lib/pages/account/create/backupAccountPage.dart index cbbf69c7..01f9ef0c 100644 --- a/lib/pages/account/create/backupAccountPage.dart +++ b/lib/pages/account/create/backupAccountPage.dart @@ -13,6 +13,7 @@ import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/button.dart'; import 'package:polkawallet_ui/components/v3/innerShadow.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class BackupAccountPage extends StatefulWidget { const BackupAccountPage(this.service); @@ -183,7 +184,7 @@ class _BackupAccountPageState extends State { child: Text( dic['backup.reset'], style: TextStyle( - fontSize: 14, + fontSize: UI.getTextSize(14, context), color: Theme.of(context).errorColor), ), ), @@ -281,8 +282,8 @@ class _BackupAccountPageState extends State { e, style: TextStyle( color: Theme.of(context).cardColor, - fontSize: 16, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(16, context), + fontFamily: UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w600, ), ), diff --git a/lib/pages/account/create/createAccountPage.dart b/lib/pages/account/create/createAccountPage.dart index 5872600e..4b9350f5 100644 --- a/lib/pages/account/create/createAccountPage.dart +++ b/lib/pages/account/create/createAccountPage.dart @@ -11,6 +11,7 @@ import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/button.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class CreateAccountPage extends StatefulWidget { CreateAccountPage(this.service); @@ -90,8 +91,8 @@ class _CreateAccountPageState extends State { dic['create.warn9'], style: TextStyle( color: Colors.red, - fontSize: 18, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(18, context), + fontFamily: UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w400, ), ), diff --git a/lib/pages/assets/asset/assetPage.dart b/lib/pages/assets/asset/assetPage.dart index 57239522..8771694d 100644 --- a/lib/pages/assets/asset/assetPage.dart +++ b/lib/pages/assets/asset/assetPage.dart @@ -89,7 +89,8 @@ class _AssetPageState extends State { _isLastPage = false; }); - widget.service.assets.fetchMarketPrices(); + widget.service.assets + .fetchMarketPrices(widget.service.plugin.networkState.tokenSymbol); await _updateData(); } @@ -273,7 +274,8 @@ class _AssetPageState extends State { appBar: AppBar( title: Text( symbol, - style: TextStyle(fontSize: 20, color: Colors.black87), + style: TextStyle( + fontSize: UI.getTextSize(20, context), color: Colors.black87), ), centerTitle: true, backgroundColor: Colors.transparent, @@ -573,10 +575,11 @@ class BalanceCard extends StatelessWidget { Fmt.token(balance, decimals, length: 8), style: TextStyle( color: titleColor, - fontSize: 20, + fontSize: UI.getTextSize(20, context), letterSpacing: -0.8, fontWeight: FontWeight.w600, - fontFamily: "TitilliumWeb"), + fontFamily: + UI.getFontFamily('TitilliumWeb', context)), overflow: TextOverflow.ellipsis, ), Visibility( @@ -610,7 +613,8 @@ class BalanceCard extends StatelessWidget { decimals, lengthMax: 4, ), - titleColor), + titleColor, + context), priceItemBuild( SvgPicture.asset( 'assets/images/locked_icon.svg', @@ -623,7 +627,8 @@ class BalanceCard extends StatelessWidget { decimals, lengthMax: 4, ), - titleColor), + titleColor, + context), priceItemBuild( SvgPicture.asset( 'assets/images/reversed_icon.svg', @@ -636,7 +641,8 @@ class BalanceCard extends StatelessWidget { decimals, lengthMax: 4, ), - titleColor), + titleColor, + context), ], ), flex: 1, @@ -668,7 +674,8 @@ class BalanceCard extends StatelessWidget { return datas; } - Widget priceItemBuild(Widget icon, String title, String price, Color color) { + Widget priceItemBuild(Widget icon, String title, String price, Color color, + BuildContext context) { return Padding( padding: EdgeInsets.symmetric(vertical: 3), child: Row( @@ -683,9 +690,9 @@ class BalanceCard extends StatelessWidget { title, style: TextStyle( color: color, - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w600, - fontFamily: "TitilliumWeb"), + fontFamily: UI.getFontFamily('TitilliumWeb', context)), ), Expanded( child: Text( @@ -693,9 +700,9 @@ class BalanceCard extends StatelessWidget { textAlign: TextAlign.end, style: TextStyle( color: color, - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w400, - fontFamily: "TitilliumWeb"), + fontFamily: UI.getFontFamily('TitilliumWeb', context)), ), ) ], @@ -739,7 +746,7 @@ class TransferListItem extends StatelessWidget { title: Text( '$title${crossChain != null ? ' ($crossChain)' : ''}', style: Theme.of(context).textTheme.headline5.copyWith( - fontFamily: 'SF_Pro', + fontFamily: UI.getFontFamily('SF_Pro', context), ), ), subtitle: Text( diff --git a/lib/pages/assets/asset/locksDetailPage.dart b/lib/pages/assets/asset/locksDetailPage.dart index 12738d0c..e09283eb 100644 --- a/lib/pages/assets/asset/locksDetailPage.dart +++ b/lib/pages/assets/asset/locksDetailPage.dart @@ -2,7 +2,7 @@ import 'package:app/common/consts.dart'; import 'package:app/service/index.dart'; import 'package:app/service/walletApi.dart'; import 'package:app/utils/i18n/index.dart'; -import 'package:flutter/cupertino.dart'; +import 'package:polkawallet_ui/utils/index.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:polkawallet_sdk/api/types/balanceData.dart'; @@ -264,12 +264,15 @@ class LocksDetailPageState extends State { labelStyle: Theme.of(context) .textTheme .headline5 - .copyWith(fontSize: 18), + .copyWith( + fontSize: UI.getTextSize( + 18, context)), contentStyle: Theme.of(context) .textTheme .headline5 .copyWith( - fontSize: 18, + fontSize: + UI.getTextSize(18, context), color: Color(0xFFE46B41), fontWeight: FontWeight.w600), ) @@ -309,7 +312,8 @@ class LocksDetailPageState extends State { .textTheme .headline5 .copyWith( - fontSize: 18, + fontSize: UI.getTextSize( + 18, context), color: Color(0xFFE46B41), fontWeight: FontWeight.w600), @@ -397,8 +401,9 @@ class LocksDetailPageState extends State { 'assets')['lock.vest.claim'], style: TextStyle( color: Theme.of(context).cardColor, - fontSize: 12, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(12, context), + fontFamily: + UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w600, ), ), diff --git a/lib/pages/assets/index.dart b/lib/pages/assets/index.dart index 4653208f..44ce605b 100644 --- a/lib/pages/assets/index.dart +++ b/lib/pages/assets/index.dart @@ -35,9 +35,9 @@ import 'package:polkawallet_ui/pages/qrSignerPage.dart'; import 'package:polkawallet_ui/pages/scanPage.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; import 'package:rive/rive.dart'; import 'package:sticky_headers/sticky_headers.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginButton.dart'; final assetsType = [ "All", @@ -45,7 +45,7 @@ final assetsType = [ "ERC-20", "Cross-chain", "LP Tokens", - "Tiga token" + "Taiga token" ]; class AssetsPage extends StatefulWidget { @@ -115,7 +115,8 @@ class _AssetsState extends State { // } Future _updateMarketPrices() async { - widget.service.assets.fetchMarketPrices(); + widget.service.assets + .fetchMarketPrices(widget.service.plugin.networkState.tokenSymbol); final duration = widget.service.store.assets.marketPrices.keys.length > 0 ? 60 : 6; @@ -536,6 +537,7 @@ class _AssetsState extends State { }, child: Container( color: Colors.transparent, + margin: EdgeInsets.only(top: 2), child: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, @@ -759,7 +761,7 @@ class _AssetsState extends State { var type = "Token"; if (assetsType[_assetsTypeIndex] == "Cross-chain") { type = "ForeignAsset"; - } else if (assetsType[_assetsTypeIndex] == "Tiga token") { + } else if (assetsType[_assetsTypeIndex] == "Taiga token") { type = "TaigaAsset"; } else if (assetsType[_assetsTypeIndex] == "LP Tokens") { type = "DexShare"; @@ -858,7 +860,7 @@ class _AssetsState extends State { I18n.of(context).getDic(i18n_full_dic_app, 'assets')['assets.warn'], color: Colors.deepOrange, - fontSize: 12, + fontSize: UI.getTextSize(12, context), margin: EdgeInsets.all(0), padding: EdgeInsets.all(8), )) @@ -982,7 +984,10 @@ class _AssetsState extends State { .white : Colors .black, - fontSize: 10)), + fontSize: + UI.getTextSize( + 10, + context))), ), ), ); @@ -1066,7 +1071,10 @@ class _AssetsState extends State { .textTheme .headline6 .copyWith( - fontFamily: "TitilliumWeb"), + fontFamily: + UI.getFontFamily( + 'TitilliumWeb', + context)), ), ], ), @@ -1229,10 +1237,9 @@ class TokenItem extends StatelessWidget { isHideBalance ? "******" : '≈ ${Utils.currencySymbol(priceCurrency)}${Fmt.priceFloor(Fmt.bigIntToDouble(balanceTotal, decimals) * marketPrice)}', - style: Theme.of(context) - .textTheme - .headline6 - .copyWith(fontFamily: "TitilliumWeb"), + style: Theme.of(context).textTheme.headline6.copyWith( + fontFamily: + UI.getFontFamily('TitilliumWeb', context)), ) : Container(height: 0, width: 8), ], diff --git a/lib/pages/assets/manage/manageAssetsPage.dart b/lib/pages/assets/manage/manageAssetsPage.dart index 03f1c0fc..f42ad66a 100644 --- a/lib/pages/assets/manage/manageAssetsPage.dart +++ b/lib/pages/assets/manage/manageAssetsPage.dart @@ -14,6 +14,7 @@ import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/index.dart' as v3; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class ManageAssetsPage extends StatefulWidget { const ManageAssetsPage(this.service); @@ -122,7 +123,9 @@ class _ManageAssetsPageState extends State { decimals: widget.service.plugin.networkState.tokenDecimals[0], id: widget.service.plugin.networkState.tokenSymbol[0], symbol: widget.service.plugin.networkState.tokenSymbol[0], - name: '${widget.service.plugin.basic.name} ${dic['manage.native']}') + name: widget.service.plugin.networkState.tokenSymbol[0], + fullName: + '${widget.service.plugin.basic.name} ${dic['manage.native']}') ]; list.addAll(widget.service.plugin.noneNativeTokensAll); @@ -130,7 +133,7 @@ class _ManageAssetsPageState extends State { var type = "Token"; if (assetsType[_assetsTypeIndex] == "Cross-chain") { type = "ForeignAsset"; - } else if (assetsType[_assetsTypeIndex] == "Tiga token") { + } else if (assetsType[_assetsTypeIndex] == "Taiga token") { type = "TaigaAsset"; } else if (assetsType[_assetsTypeIndex] == "LP Tokens") { type = "DexShare"; @@ -173,8 +176,8 @@ class _ManageAssetsPageState extends State { dic['manage.save'], style: TextStyle( color: Theme.of(context).cardColor, - fontSize: 12, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(12, context), + fontFamily: UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w600, ), ), @@ -228,7 +231,8 @@ class _ManageAssetsPageState extends State { .textTheme .headline5 .copyWith( - fontFamily: 'SF_Pro', + fontFamily: + UI.getFontFamily('SF_Pro', context), color: _hide0 ? Theme.of(context).primaryColor : colorGrey), @@ -326,10 +330,12 @@ class _ManageAssetsPageState extends State { ? Text('$id${list[i].fullName}', maxLines: 2, style: TextStyle( - fontSize: 10, + fontSize: + UI.getTextSize(10, context), fontWeight: FontWeight.w300, color: Color(0xFF565554), - fontFamily: "SF_Pro")) + fontFamily: UI.getFontFamily( + 'SF_Pro', context))) : null, trailing: Row( mainAxisSize: MainAxisSize.min, diff --git a/lib/pages/assets/nodeSelectPage.dart b/lib/pages/assets/nodeSelectPage.dart index 8296b257..1e9bb3e8 100644 --- a/lib/pages/assets/nodeSelectPage.dart +++ b/lib/pages/assets/nodeSelectPage.dart @@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:polkawallet_sdk/api/types/networkParams.dart'; import 'package:polkawallet_sdk/plugin/index.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class NodeSelectPage extends StatefulWidget { NodeSelectPage(this.service, this.plugins, this.changeNetwork, {Key key}) @@ -138,7 +139,8 @@ class NodeSelectItem extends StatelessWidget { title: Text( "${plugin.basic.name[0].toUpperCase()}${plugin.basic.name.substring(1)}", style: Theme.of(context).textTheme.headline4.copyWith( - fontWeight: FontWeight.w600, fontFamily: "SF_Pro")), + fontWeight: FontWeight.w600, + fontFamily: UI.getFontFamily('SF_Pro', context))), isSelect: isExpansion, onTap: () { networkOnTap(index); diff --git a/lib/pages/assets/transfer/transferPage.dart b/lib/pages/assets/transfer/transferPage.dart index 25fa726f..bdea2e7e 100644 --- a/lib/pages/assets/transfer/transferPage.dart +++ b/lib/pages/assets/transfer/transferPage.dart @@ -24,6 +24,7 @@ import 'package:polkawallet_ui/components/v3/txButton.dart'; import 'package:polkawallet_ui/pages/scanPage.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart' as polkawallet_ui; class TransferPageParams { TransferPageParams({ @@ -888,9 +889,16 @@ class _TransferPageState extends State { color: Theme.of( context) .cardColor, - fontSize: 12, - fontFamily: - 'TitilliumWeb', + fontSize: polkawallet_ui + .UI + .getTextSize( + 12, + context), + fontFamily: polkawallet_ui + .UI + .getFontFamily( + 'TitilliumWeb', + context), fontWeight: FontWeight .w600, @@ -941,8 +949,15 @@ class _TransferPageState extends State { dic['amount.exist.msg'], style: TextStyle( color: Color(0xBF565554), - fontSize: 12, - fontFamily: 'SF_Pro', + fontSize: polkawallet_ui + .UI + .getTextSize( + 12, context), + fontFamily: polkawallet_ui + .UI + .getFontFamily( + 'SF_Pro', + context), ), ), ], @@ -1008,7 +1023,9 @@ class _TransferPageState extends State { Text( dic['amount.exist.msg'], style: TextStyle( - fontSize: 12, + fontSize: polkawallet_ui.UI + .getTextSize( + 12, context), fontWeight: FontWeight.w200), ), @@ -1073,8 +1090,11 @@ class _TransferPageState extends State { dic['transfer.alive.msg'], style: TextStyle( color: Color(0xBF565554), - fontSize: 12, - fontFamily: 'SF_Pro', + fontSize: polkawallet_ui.UI + .getTextSize(12, context), + fontFamily: polkawallet_ui.UI + .getFontFamily( + 'SF_Pro', context), ), ), ], diff --git a/lib/pages/browser/browserApi.dart b/lib/pages/browser/browserApi.dart index 42755c1e..b52160e1 100644 --- a/lib/pages/browser/browserApi.dart +++ b/lib/pages/browser/browserApi.dart @@ -37,7 +37,11 @@ class BrowserApi { return await Navigator.of(context).pushNamed( DAppWrapperPage.route, - arguments: {"url": dapp['detailUrl'], "isPlugin": true}, + arguments: { + "url": dapp['detailUrl'], + "isPlugin": true, + "icon": dapp["icon"] + }, ); } diff --git a/lib/pages/browser/browserPage.dart b/lib/pages/browser/browserPage.dart index d01fc1d2..a8dfff49 100644 --- a/lib/pages/browser/browserPage.dart +++ b/lib/pages/browser/browserPage.dart @@ -10,6 +10,7 @@ import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTextTag.dart'; import 'package:app/pages/browser/search.dart' as search; +import 'package:polkawallet_ui/utils/index.dart'; class BrowserPage extends StatefulWidget { BrowserPage(this.service, {Key key}) : super(key: key); @@ -69,7 +70,7 @@ class _BrowserPageState extends State { .headline1 ?.copyWith( color: PluginColorsDark.headline1, - fontSize: 26, + fontSize: UI.getTextSize(26, context), fontWeight: FontWeight.bold), ), Padding( @@ -81,7 +82,7 @@ class _BrowserPageState extends State { .headline5 ?.copyWith( color: PluginColorsDark.headline1, - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w600))), GestureDetector( onTap: () async { @@ -118,7 +119,8 @@ class _BrowserPageState extends State { ?.copyWith( color: PluginColorsDark.headline1, - fontSize: 14, + fontSize: + UI.getTextSize(12, context), ))), Icon( Icons.search, @@ -147,7 +149,6 @@ class _BrowserPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ PluginTextTag( - padding: EdgeInsets.zero, title: dic['hub.browser.latest'], backgroundColor: PluginColorsDark.headline1, ), @@ -219,7 +220,9 @@ class _BrowserPageState extends State { color: PluginColorsDark .headline1, - fontSize: 12), + fontSize: + UI.getTextSize( + 12, context)), ) ], ), @@ -227,7 +230,6 @@ class _BrowserPageState extends State { }))) ])), PluginTextTag( - padding: EdgeInsets.zero, title: dic['hub.browser.fastPass'], backgroundColor: PluginColorsDark.headline1, ), @@ -261,7 +263,8 @@ class _BrowserPageState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 10, + fontSize: + UI.getTextSize(12, context), fontWeight: _tag == index ? FontWeight.w600 : FontWeight.w400, @@ -334,7 +337,8 @@ class _BrowserPageState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 10, + fontSize: UI.getTextSize( + 10, context), color: PluginColorsDark .headline1)), ], diff --git a/lib/pages/browser/browserSearch.dart b/lib/pages/browser/browserSearch.dart index 592d9c4c..0f4571d6 100644 --- a/lib/pages/browser/browserSearch.dart +++ b/lib/pages/browser/browserSearch.dart @@ -6,9 +6,10 @@ import 'package:flutter/material.dart' hide SearchDelegate; import 'package:flutter_svg/flutter_svg.dart'; import 'package:polkawallet_plugin_karura/utils/i18n/index.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/components/listTail.dart'; import 'package:polkawallet_ui/pages/dAppWrapperPage.dart'; +import 'package:polkawallet_ui/utils/consts.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class SearchBarDelegate extends SearchDelegate { final AppService service; @@ -62,7 +63,6 @@ class SearchBarDelegate extends SearchDelegate { @override Widget buildResults(BuildContext context) { - print("buildResults===="); BrowserApi.addDappSearchHistory(service, query); var dapps = service.store.settings.dapps; if (query.trim().isNotEmpty) { @@ -182,7 +182,8 @@ class SearchBarDelegate extends SearchDelegate { .textTheme .headline6 ?.copyWith( - fontSize: 10, + fontSize: + UI.getTextSize(10, context), color: PluginColorsDark.green)), TextSpan( text: e["detailUrl"].substring( @@ -196,7 +197,8 @@ class SearchBarDelegate extends SearchDelegate { .textTheme .headline6 ?.copyWith( - fontSize: 10, + fontSize: + UI.getTextSize(10, context), color: PluginColorsDark.primary)), TextSpan( text: e["detailUrl"].substring( @@ -208,7 +210,8 @@ class SearchBarDelegate extends SearchDelegate { .textTheme .headline6 ?.copyWith( - fontSize: 10, + fontSize: + UI.getTextSize(10, context), color: PluginColorsDark.green)) ], )), @@ -269,7 +272,8 @@ class SearchBarDelegate extends SearchDelegate { ), child: Text(dic['hub.browser.clearAll'], style: Theme.of(context).textTheme.headline5?.copyWith( - color: PluginColorsDark.primary, fontSize: 12)), + color: PluginColorsDark.primary, + fontSize: UI.getTextSize(12, context))), )) ], ), @@ -295,7 +299,8 @@ class SearchBarDelegate extends SearchDelegate { text: suggestionList[index].substring( 0, indexStart.length > 0 ? indexStart[index] : 0), style: Theme.of(context).textTheme.headline6?.copyWith( - fontSize: 14, color: PluginColorsDark.headline1)), + fontSize: UI.getTextSize(14, context), + color: PluginColorsDark.headline1)), TextSpan( text: suggestionList[index].substring( indexStart.length > 0 ? indexStart[index] : 0, @@ -303,7 +308,8 @@ class SearchBarDelegate extends SearchDelegate { ? indexStart[index] + query.length : 0), style: Theme.of(context).textTheme.headline6?.copyWith( - fontSize: 14, color: PluginColorsDark.primary)), + fontSize: UI.getTextSize(14, context), + color: PluginColorsDark.primary)), TextSpan( text: suggestionList[index].substring( indexStart.length > 0 @@ -311,7 +317,8 @@ class SearchBarDelegate extends SearchDelegate { : 0, suggestionList[index].length), style: Theme.of(context).textTheme.headline6?.copyWith( - fontSize: 14, color: PluginColorsDark.headline1)) + fontSize: UI.getTextSize(14, context), + color: PluginColorsDark.headline1)) ], )), ), diff --git a/lib/pages/browser/dappLatestPage.dart b/lib/pages/browser/dappLatestPage.dart index 89ea6a3d..013bdc12 100644 --- a/lib/pages/browser/dappLatestPage.dart +++ b/lib/pages/browser/dappLatestPage.dart @@ -10,6 +10,7 @@ import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/plugin/PluginIconButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/consts.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class DappLatestPage extends StatefulWidget { DappLatestPage(this.service, {Key key}) : super(key: key); @@ -102,7 +103,7 @@ class _DappLatestPageState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w600, color: Colors.black), ), @@ -160,7 +161,10 @@ class _DappLatestPageState extends State { .textTheme .headline6 ?.copyWith( - fontSize: 10, + fontSize: + UI.getTextSize( + 10, + context), color: PluginColorsDark .green)) @@ -170,27 +174,40 @@ class _DappLatestPageState extends State { ), ), endActionPane: ActionPane( - extentRatio: 0.15, + extentRatio: 0.12, motion: ScrollMotion(), children: [ - SlidableAction( - onPressed: (context) async { - final bool res = - await _showCupertinoDialog(dic[ - 'hub.browser.clearMessage']); - if (res) { - BrowserApi.deleteLatest( - e, widget.service); - setState(() { - _isdelete = true; - }); - } - }, - backgroundColor: - PluginColorsDark.primary, - foregroundColor: Colors.black, - icon: Icons.delete, - ), + Expanded( + child: GestureDetector( + onTap: () async { + final bool res = + await _showCupertinoDialog( + dic['hub.browser.clearMessage']); + if (res) { + BrowserApi.deleteLatest( + e, widget.service); + setState(() { + _isdelete = true; + }); + } + }, + child: Container( + margin: EdgeInsets.only( + left: 2), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular( + 4)), + color: PluginColorsDark + .primary, + ), + child: Center( + child: Icon( + Icons.delete_outline, + color: Colors.black), + ), + ))), ], )); })) diff --git a/lib/pages/ecosystem/completedPage.dart b/lib/pages/ecosystem/completedPage.dart index a96aa8e7..411fdfc7 100644 --- a/lib/pages/ecosystem/completedPage.dart +++ b/lib/pages/ecosystem/completedPage.dart @@ -1,21 +1,20 @@ -import 'dart:convert'; - import 'package:app/pages/ecosystem/ecosystemPage.dart'; import 'package:app/pages/ecosystem/tokenStakingApi.dart'; import 'package:app/pages/ecosystem/tokenStakingPage.dart'; import 'package:app/service/index.dart'; import 'package:app/utils/i18n/index.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_plugin_karura/utils/i18n/index.dart'; +import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginButton.dart'; import 'package:polkawallet_ui/components/v3/infoItemRow.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginButton.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/consts.dart'; -import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_ui/utils/format.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class CompletedPage extends StatefulWidget { CompletedPage(this.service, {Key key}) : super(key: key); @@ -99,7 +98,7 @@ class _CompletedPageState extends State { .textTheme .headline2 ?.copyWith( - fontSize: 36, + fontSize: UI.getTextSize(36, context), fontWeight: FontWeight.bold, color: PluginColorsDark.headline1), ), @@ -108,13 +107,13 @@ class _CompletedPageState extends State { child: Column( children: [ InfoItemRow( - "${dic['ecosystem.on']} ${widget.service.plugin.basic.name}", + widget.service.plugin.basic.name, "${Fmt.priceFloorBigIntFormatter(Fmt.balanceInt(currentBalance.amount), currentBalance.decimals)} ${currentBalance.symbol}", labelStyle: style, contentStyle: style, ), InfoItemRow( - "${dic['ecosystem.on']} $fromNetwork", + fromNetwork, "${Fmt.priceFloorBigIntFormatter(Fmt.balanceInt(_balances[fromNetwork].amount), balance.decimals)} ${balance.symbol}", labelStyle: style, contentStyle: style, diff --git a/lib/pages/ecosystem/converToPage.dart b/lib/pages/ecosystem/converToPage.dart index 46fb9b75..31737ec8 100644 --- a/lib/pages/ecosystem/converToPage.dart +++ b/lib/pages/ecosystem/converToPage.dart @@ -9,20 +9,20 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:polkawallet_plugin_acala/polkawallet_plugin_acala.dart'; import 'package:polkawallet_plugin_karura/polkawallet_plugin_karura.dart'; import 'package:polkawallet_plugin_karura/utils/i18n/index.dart'; +import 'package:polkawallet_sdk/api/types/txInfoData.dart'; +import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; +import 'package:polkawallet_ui/components/v3/addressIcon.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginButton.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginTextTag.dart'; +import 'package:polkawallet_ui/pages/v3/xcmTxConfirmPage.dart'; import 'package:polkawallet_ui/utils/consts.dart'; -import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_ui/utils/format.dart'; -import 'package:polkawallet_sdk/api/types/txInfoData.dart'; -import 'package:polkawallet_ui/pages/v3/xcmTxConfirmPage.dart'; -import 'package:polkawallet_ui/components/v3/addressIcon.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginTextTag.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; -import 'package:polkawallet_ui/components/v3/infoItemRow.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class ConverToPage extends StatefulWidget { ConverToPage(this.service, {Key key}) : super(key: key); @@ -81,8 +81,11 @@ class _ConverToPageState extends State { final fromIcon = plugin.store.assets.crossChainIcons[fromNetwork] as String; final tokensConfig = plugin.store.setting.remoteConfig['tokens'] ?? {}; - final feeToken = ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? - {})['nativeToken']; + final feeTokenSymbol = + ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? + {})['nativeToken']; + final feeToken = plugin.store.assets.allTokens.firstWhere((e) => + e.symbol.toUpperCase() == feeTokenSymbol.toString().toUpperCase()); return XcmTxConfirmParams( txTitle: "${I18n.of(context)?.getDic(i18n_full_dic_app, 'public')['ecosystem.convertTo']} $convertToKen (1/2)", @@ -241,7 +244,8 @@ class _ConverToPageState extends State { final tokenXcmInfo = (tokensConfig['xcmInfo'] ?? {})[fromNetwork] ?? {}; - final destExistDeposit = Fmt.balanceInt(balance.minBalance); + final destExistDeposit = Fmt.balanceInt( + plugin.store.assets.tokenBalanceMap[balance.tokenNameId].minBalance); final destFee = Fmt.balanceInt((tokenXcmInfo[balance.symbol] ?? {})['receiveFee']); @@ -250,7 +254,7 @@ class _ConverToPageState extends State { .service.plugin.networkState.tokenDecimals[ widget.service.plugin.networkState.tokenSymbol.indexOf(nativeToken)]; - final feeToken = + final feeTokenSymbol = ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? {})['nativeToken']; final labelStyle = Theme.of(context) @@ -394,7 +398,7 @@ class _ConverToPageState extends State { ), ), Text( - '${Fmt.priceCeilBigInt(Fmt.balanceInt(_fee), nativeTokenDecimals, lengthMax: 6)} $feeToken', + '${Fmt.priceCeilBigInt(Fmt.balanceInt(_fee), nativeTokenDecimals, lengthMax: 6)} $feeTokenSymbol', style: infoValueStyle), ], ), @@ -433,7 +437,7 @@ class _ConverToPageState extends State { class ErrorMessage extends StatelessWidget { ErrorMessage(this.error, {this.margin}); final error; - EdgeInsetsGeometry margin; + final EdgeInsetsGeometry margin; @override Widget build(BuildContext context) { return Container( @@ -446,7 +450,8 @@ class ErrorMessage extends StatelessWidget { Expanded( child: Text( error, - style: TextStyle(fontSize: 12, color: Colors.red), + style: TextStyle( + fontSize: UI.getTextSize(12, context), color: Colors.red), )) ]), ); diff --git a/lib/pages/ecosystem/crosschainTransferPage.dart b/lib/pages/ecosystem/crosschainTransferPage.dart index 344430f6..ee7232b3 100644 --- a/lib/pages/ecosystem/crosschainTransferPage.dart +++ b/lib/pages/ecosystem/crosschainTransferPage.dart @@ -5,7 +5,6 @@ import 'package:app/pages/ecosystem/converToPage.dart'; import 'package:app/pages/ecosystem/ecosystemPage.dart'; import 'package:app/service/index.dart'; import 'package:app/utils/i18n/index.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -24,25 +23,26 @@ import 'package:polkawallet_ui/components/v3/bottomSheetContainer.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTagCard.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTextTag.dart'; import 'package:polkawallet_ui/pages/v3/xcmTxConfirmPage.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; +import 'package:polkawallet_ui/utils/index.dart'; -class CrosschainTransferPage extends StatefulWidget { - CrosschainTransferPage(this.service, {Key key}) : super(key: key); - AppService service; +class CrossChainTransferPage extends StatefulWidget { + CrossChainTransferPage(this.service, {Key key}) : super(key: key); + final AppService service; static final String route = '/ecosystem/crosschainTransfer'; @override - State createState() => _CrosschainTransferPageState(); + State createState() => _CrossChainTransferPageState(); } -class _CrosschainTransferPageState extends State { +class _CrossChainTransferPageState extends State { TextEditingController _amountCtrl = TextEditingController(); String _error1; @@ -123,8 +123,18 @@ class _CrosschainTransferPageState extends State { plugin = widget.service.plugin as PluginAcala; } final tokensConfig = plugin.store.setting.remoteConfig['tokens'] ?? {}; - final feeToken = ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? - {})['nativeToken']; + final feeTokenSymbol = + ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? + {})['nativeToken']; + final feeToken = (fromNetwork == para_chain_name_acala || + fromNetwork == para_chain_name_karura) + ? TokenBalanceData( + symbol: plugin.networkState.tokenSymbol[0], + decimals: plugin.networkState.tokenDecimals[0], + ) + : plugin.store.assets.allTokens.firstWhere((e) => + e.symbol.toUpperCase() == + feeTokenSymbol.toString().toUpperCase()); return XcmTxConfirmParams( txTitle: '${dicAcala['transfer']} ${balance.symbol} (${dicAcala['cross.xcm']})', @@ -279,7 +289,8 @@ class _CrosschainTransferPageState extends State { .textTheme .headline4 ?.copyWith(color: PluginColorsDark.headline1); - final subTitleStyle = TextStyle(fontSize: 12, height: 1); + final subTitleStyle = + TextStyle(fontSize: UI.getTextSize(12, context), height: 1); final infoValueStyle = Theme.of(context).textTheme.headline5.copyWith( fontWeight: FontWeight.w600, color: PluginColorsDark.headline1); return PluginScaffold( @@ -318,12 +329,12 @@ class _CrosschainTransferPageState extends State { final isTokenFromStateMine = balance.src != null && balance.src['Parachain'] == '1,000'; + final existDeposit = Fmt.balanceInt(plugin + .store.assets.tokenBalanceMap[balance.tokenNameId].minBalance); final destExistDeposit = isFromKar ? Fmt.balanceInt( (tokenXcmInfo[balance.symbol] ?? {})['existentialDeposit']) - : Fmt.balanceInt(balance.minBalance); - final existDeposit = Fmt.balanceInt(plugin - .store.assets.tokenBalanceMap[balance.tokenNameId].minBalance); + : existDeposit; final destFee = isFromKar ? isTokenFromStateMine ? BigInt.zero @@ -336,8 +347,9 @@ class _CrosschainTransferPageState extends State { final sendFeeAmount = sendFee.length > 0 ? Fmt.balanceInt(sendFee[1]) : BigInt.zero; - final feeToken = ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? - {})['nativeToken']; + final feeTokenSymbol = + ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? + {})['nativeToken']; final nativeToken = widget.service.plugin.networkState.tokenSymbol[0]; final nativeTokenDecimals = @@ -354,59 +366,46 @@ class _CrosschainTransferPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - PluginTextTag( - backgroundColor: PluginColorsDark.headline3, - title: dic['ecosystem.from'], - ), - Container( - width: double.infinity, - padding: EdgeInsets.symmetric( - horizontal: 8, vertical: 16), - decoration: BoxDecoration( - color: Color(0x0FFFFFFF), - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(4), - topRight: Radius.circular(4), - bottomRight: Radius.circular(4))), - child: Text( - fromNetwork, - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith( - color: Color(0xFFFFFFFF) - .withAlpha(102)), - )), - PluginTagCard( - margin: EdgeInsets.only(top: 24), - titleTag: dic['ecosystem.to'], - padding: EdgeInsets.symmetric( - horizontal: 8, vertical: 16), - child: GestureDetector( - onTap: () { - _selectChain(context, 0, crossChainIcons, - _chainToList); - }, - behavior: HitTestBehavior.opaque, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - destChainName, - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith( + ChainSelected(dic['ecosystem.from'], fromNetwork), + isFromKar + ? PluginTagCard( + margin: EdgeInsets.only(top: 24), + titleTag: dic['ecosystem.to'], + padding: EdgeInsets.symmetric( + horizontal: 8, vertical: 16), + child: GestureDetector( + onTap: () { + _selectChain(context, 0, + crossChainIcons, _chainToList); + }, + behavior: HitTestBehavior.opaque, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + destChainName, + style: Theme.of(context) + .textTheme + .headline5 + ?.copyWith( + color: PluginColorsDark + .headline1), + ), + Icon( + Icons + .keyboard_arrow_down_rounded, color: - PluginColorsDark.headline1), + PluginColorsDark.headline1) + ], + ), ), - Icon(Icons.keyboard_arrow_down_rounded, - color: PluginColorsDark.headline1) - ], - ), - ), - ), + ) + : Container( + margin: EdgeInsets.only(top: 24), + child: ChainSelected( + dic['ecosystem.to'], destChainName), + ), PluginInputBalance( margin: EdgeInsets.only( top: 24, bottom: _error1 == null ? 24 : 2), @@ -547,7 +546,7 @@ class _CrosschainTransferPageState extends State { ), ), Text( - '${Fmt.priceCeilBigInt(Fmt.balanceInt(_fee), nativeTokenDecimals, lengthMax: 6)} $feeToken', + '${Fmt.priceCeilBigInt(Fmt.balanceInt(_fee), nativeTokenDecimals, lengthMax: 6)} $feeTokenSymbol', style: infoValueStyle), ], ), @@ -617,3 +616,36 @@ class ChainSelector extends StatelessWidget { ); } } + +class ChainSelected extends StatelessWidget { + ChainSelected(this.title, this.fromNetwork); + final String title; + final String fromNetwork; + @override + Widget build(BuildContext context) { + return Column( + children: [ + PluginTextTag( + backgroundColor: PluginColorsDark.headline3, + title: title, + ), + Container( + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16), + decoration: BoxDecoration( + color: Color(0x0FFFFFFF), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(4), + topRight: Radius.circular(4), + bottomRight: Radius.circular(4))), + child: Text( + fromNetwork, + style: Theme.of(context) + .textTheme + .headline5 + ?.copyWith(color: Color(0xFFFFFFFF).withAlpha(102)), + )), + ], + ); + } +} diff --git a/lib/pages/ecosystem/ecosystemPage.dart b/lib/pages/ecosystem/ecosystemPage.dart index 44dd709b..7f615934 100644 --- a/lib/pages/ecosystem/ecosystemPage.dart +++ b/lib/pages/ecosystem/ecosystemPage.dart @@ -90,7 +90,7 @@ class EcosystemPage extends StatelessWidget { padding: EdgeInsets.symmetric( horizontal: 7, vertical: 2), color: PluginColorsDark.headline1, - fontSize: 16, + fontSize: UI.getTextSize(16, context), minSize: 34, active: true, onPressed: () => Navigator.of(context).popUntil( @@ -113,7 +113,7 @@ class EcosystemPage extends StatelessWidget { horizontal: 7, vertical: 2), margin: EdgeInsets.zero, color: PluginColorsDark.primary, - fontSize: 16, + fontSize: UI.getTextSize(16, context), minSize: 34, active: true, onPressed: () { @@ -130,7 +130,7 @@ class EcosystemPage extends StatelessWidget { Navigator.of(context).pop(); } else { Navigator.of(context).popAndPushNamed( - CrosschainTransferPage.route, + CrossChainTransferPage.route, arguments: { "balance": balance, "fromNetwork": convertNetwork diff --git a/lib/pages/ecosystem/tokenStakingApi.dart b/lib/pages/ecosystem/tokenStakingApi.dart index 37f6d35a..4e2c7151 100644 --- a/lib/pages/ecosystem/tokenStakingApi.dart +++ b/lib/pages/ecosystem/tokenStakingApi.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:app/service/index.dart'; import 'package:polkawallet_plugin_acala/polkawallet_plugin_acala.dart'; import 'package:polkawallet_plugin_karura/polkawallet_plugin_karura.dart'; @@ -14,80 +12,87 @@ class TokenStakingApi { static Future> getBalance( AppService service, List networkNames, String token, {bool isCachaChange = true}) async { - final connected = await service.plugin.sdk.webView - .evalJavascript('xcm.connectFromChain(${json.encode(networkNames)})'); - if (connected != null) { - Map balances = Map(); - var cacheTokenStakingAssets = service.assets - .getTokenStakingAssets(service.keyring.current.pubKey) ?? - Map(); - for (int i = 0; i < networkNames.length; i++) { - final element = networkNames[i]; - final data = await service.plugin.sdk.webView.evalJavascript( - 'xcm.getBalances("$element", "${service.keyring.current.address}", ["$token"])'); - if (data != null) { - final balance = List.of(data)[0]; - if (balance != null) { - final balanceData = TokenBalanceData( - tokenNameId: balance['tokenNameId'], - amount: balance['amount'], - decimals: balance['decimals'], - symbol: token, - name: token, - currencyId: {'Token': token}, - detailPageRoute: "/assets/token/detail", - isCacheChange: cacheTokenStakingAssets == null || - cacheTokenStakingAssets["$element-$token"] == null || - isCachaChange == false - ? false - : cacheTokenStakingAssets["$element-$token"]['amount'] != - balance['amount']); + var plugin; + if (service.plugin is PluginKarura) { + plugin = service.plugin as PluginKarura; + } else if (service.plugin is PluginAcala) { + plugin = service.plugin as PluginAcala; + } - balances[element] = balanceData; - cacheTokenStakingAssets["$element-$token"] = { - "amount": balance['amount'] - }; - } - } - } + final TokenBalanceData currentPluginBalance = + plugin.store.assets.tokenBalanceMap[token]; + if (networkNames.length == 0) { + TokenStakingApi.balances[token] = { + service.plugin.basic.name: currentPluginBalance + }; + return {service.plugin.basic.name: currentPluginBalance}; + } - var plugin; - if (service.plugin is PluginKarura) { - plugin = service.plugin as PluginKarura; - } else if (service.plugin is PluginAcala) { - plugin = service.plugin as PluginAcala; - } + Map balances = Map(); + var cacheTokenStakingAssets = + service.assets.getTokenStakingAssets(service.keyring.current.pubKey) ?? + Map(); + final balanceQuery = networkNames + .map((e) => + 'xcm.getBalances("$e", "${service.keyring.current.address}", ["$token"])') + .join(','); + final fromChainBalances = await service.plugin.sdk.webView + .evalJavascript('Promise.all([$balanceQuery])'); + for (int i = 0; i < networkNames.length; i++) { + final element = networkNames[i]; + final data = fromChainBalances[i]; + if (data != null) { + final balance = List.of(data)[0]; + if (balance != null) { + final balanceData = TokenBalanceData( + tokenNameId: balance['tokenNameId'], + amount: balance['amount'], + decimals: balance['decimals'], + symbol: token, + minBalance: currentPluginBalance.minBalance, + name: token, + currencyId: {'Token': token}, + detailPageRoute: "/assets/token/detail", + isCacheChange: cacheTokenStakingAssets == null || + cacheTokenStakingAssets["$element-$token"] == null || + isCachaChange == false + ? false + : cacheTokenStakingAssets["$element-$token"]['amount'] != + balance['amount']); - final balance = await plugin.service.assets.updateTokenBalances(service - .plugin.noneNativeTokensAll - .firstWhere((element) => element.symbol == token)); - if (cacheTokenStakingAssets["${service.plugin.basic.name}-$token"] != - null && - cacheTokenStakingAssets["${service.plugin.basic.name}-$token"] != - balance.amount && - isCachaChange) { - balance.isCacheChange = true; + balances[element] = balanceData; + cacheTokenStakingAssets["$element-$token"] = { + "amount": balance['amount'] + }; + } } - cacheTokenStakingAssets["${service.plugin.basic.name}-$token"] = - balance.amount; + } - service.assets.setTokenStakingAssets( - service.keyring.current.pubKey, cacheTokenStakingAssets); + if (cacheTokenStakingAssets["${service.plugin.basic.name}-$token"] != + null && + cacheTokenStakingAssets["${service.plugin.basic.name}-$token"] != + currentPluginBalance.amount && + isCachaChange) { + currentPluginBalance.isCacheChange = true; + } + cacheTokenStakingAssets["${service.plugin.basic.name}-$token"] = + currentPluginBalance.amount; - final datas = Map() - ..addAll({service.plugin.basic.name: balance}) - ..addAll(balances); + service.assets.setTokenStakingAssets( + service.keyring.current.pubKey, cacheTokenStakingAssets); - if (TokenStakingApi.balances[token] == null) { - TokenStakingApi.balances[token] = datas; - } else { - TokenStakingApi.balances[token].addAll(datas); - } - if (!isCachaChange && TokenStakingApi.refresh != null) { - TokenStakingApi.refresh(); - } - return datas; + final datas = Map() + ..addAll({service.plugin.basic.name: currentPluginBalance}) + ..addAll(balances); + + if (TokenStakingApi.balances[token] == null) { + TokenStakingApi.balances[token] = datas; + } else { + TokenStakingApi.balances[token].addAll(datas); + } + if (!isCachaChange && TokenStakingApi.refresh != null) { + TokenStakingApi.refresh(); } - return null; + return datas; } } diff --git a/lib/pages/ecosystem/tokenStakingPage.dart b/lib/pages/ecosystem/tokenStakingPage.dart index c17c81d7..38ac3474 100644 --- a/lib/pages/ecosystem/tokenStakingPage.dart +++ b/lib/pages/ecosystem/tokenStakingPage.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:app/pages/ecosystem/converToPage.dart'; import 'package:app/pages/ecosystem/crosschainTransferPage.dart'; import 'package:app/pages/ecosystem/ecosystemPage.dart'; @@ -10,16 +12,18 @@ import 'package:polkawallet_plugin_acala/polkawallet_plugin_acala.dart'; import 'package:polkawallet_plugin_karura/polkawallet_plugin_karura.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; +import 'package:polkawallet_ui/components/connectionChecker.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginOutlinedButtonSmall.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginPageTitleTaps.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class TokenStaking extends StatefulWidget { TokenStaking(this.service, {Key key}) : super(key: key); - AppService service; + final AppService service; static final String route = '/ecosystem/tokenStaking'; @@ -30,34 +34,67 @@ class TokenStaking extends StatefulWidget { class _TokenStakingState extends State { int _tab = 0; - bool _connecting = false; + List _fromChains = []; + bool _connected = false; + bool _dataLoaded = false; + + Future _connectFromChains() async { + final data = ModalRoute.of(context).settings.arguments as Map; + final String token = data["token"]; + final fromChains = + List.of(widget.service.store.settings.tokenStakingConfig[token]); + fromChains.addAll( + List.of(widget.service.store.settings.tokenStakingConfig["L$token"])); + final connected = await widget.service.plugin.sdk.webView.evalJavascript( + 'xcm.connectFromChain(${json.encode(fromChains.toSet().toList())})'); + + _fromChains = fromChains; + _connected = true; + + return connected != null; + } _getBalance() async { final data = ModalRoute.of(context).settings.arguments as Map; final String token = data["token"]; - await TokenStakingApi.getBalance(widget.service, - widget.service.store.settings.tokenStakingConfig[token], token); + final connected = await _connectFromChains(); - await TokenStakingApi.getBalance(widget.service, - widget.service.store.settings.tokenStakingConfig["L$token"], "L$token"); + if (connected) { + await Future.wait([ + TokenStakingApi.getBalance(widget.service, + widget.service.store.settings.tokenStakingConfig[token], token), + TokenStakingApi.getBalance( + widget.service, + widget.service.store.settings.tokenStakingConfig["L$token"], + "L$token"), + ]); + } setState(() { - _connecting = true; + _dataLoaded = true; }); } + @override + void dispose() { + widget.service.plugin.sdk.webView + .evalJavascript('xcm.disconnectFromChain(${json.encode(_fromChains)})'); + super.dispose(); + } + @override void initState() { - WidgetsBinding.instance.addPostFrameCallback((_) { - _getBalance(); - }); TokenStakingApi.refresh = () { if (mounted) { setState(() {}); } }; super.initState(); + + WidgetsBinding.instance.addPostFrameCallback((_) { + _connectFromChains(); + }); } @override @@ -68,6 +105,8 @@ class _TokenStakingState extends State { final _balances = TokenStakingApi.balances[token]; final _lBalances = TokenStakingApi.balances["L$token"]; + + final isReady = _connected && _dataLoaded; return PluginScaffold( appBar: PluginAppBar( title: Text("$token ${dic['hub.staking']}"), @@ -76,6 +115,8 @@ class _TokenStakingState extends State { body: SafeArea( child: Column( children: [ + ConnectionChecker(widget.service.plugin, + onConnected: _getBalance), Container( margin: EdgeInsets.fromLTRB(16, 16, 0, 16), child: PluginPageTitleTaps( @@ -100,7 +141,7 @@ class _TokenStakingState extends State { }, ), ), - _connecting == false + isReady == false ? Column( children: [ Container( @@ -164,11 +205,11 @@ class TokenItemView extends StatefulWidget { this.name, this.icon, this.balance, this.convertToKen, this.service, {Key key}) : super(key: key); - String name; - String convertToKen; - Widget icon; - TokenBalanceData balance; - AppService service; + final String name; + final String convertToKen; + final Widget icon; + final TokenBalanceData balance; + final AppService service; @override State createState() => _TokenItemViewState(); @@ -217,32 +258,37 @@ class _TokenItemViewState extends State { children: [ Padding( child: SizedBox( - child: widget.icon, height: 32, width: 32), + child: ClipRRect( + borderRadius: BorderRadius.circular(32), + child: widget.icon), + height: 32, + width: 32), padding: EdgeInsets.only(right: 10), ), Text( - "${dic['ecosystem.on']} ${widget.name}", + widget.name, style: style, ) ], ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, + Stack( + alignment: Alignment.topRight, children: [ - Text( - "${Fmt.priceFloorBigIntFormatter(Fmt.balanceInt(widget.balance.amount), widget.balance.decimals)} ${widget.balance.symbol}", - style: style), + Padding( + padding: EdgeInsets.only(right: 3), + child: Text( + "${Fmt.priceFloorBigIntFormatter(Fmt.balanceInt(widget.balance.amount), widget.balance.decimals)} ${widget.balance.symbol}", + style: style)), Visibility( - visible: widget.balance.isCacheChange, - child: Container( - width: 9, - height: 9, - margin: - EdgeInsets.only(right: 1, top: 1, left: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.5), - color: Theme.of(context).errorColor), - )) + visible: widget.balance.isCacheChange, + child: Container( + width: 9, + height: 9, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.5), + color: Theme.of(context).errorColor), + ), + ) ], ) ], @@ -267,12 +313,12 @@ class _TokenItemViewState extends State { padding: EdgeInsets.symmetric( horizontal: 7, vertical: 2), color: PluginColorsDark.primary, - fontSize: 12, + fontSize: UI.getTextSize(12, context), minSize: 25, active: true, onPressed: () { Navigator.of(context).pushNamed( - CrosschainTransferPage.route, + CrossChainTransferPage.route, arguments: { "balance": widget.balance, "fromNetwork": widget.name @@ -292,7 +338,7 @@ class _TokenItemViewState extends State { horizontal: 7, vertical: 2), margin: EdgeInsets.zero, color: PluginColorsDark.headline1, - fontSize: 12, + fontSize: UI.getTextSize(12, context), minSize: 25, active: true, onPressed: () async { diff --git a/lib/pages/ecosystem/transitingWidget.dart b/lib/pages/ecosystem/transitingWidget.dart index f474fac9..966aed85 100644 --- a/lib/pages/ecosystem/transitingWidget.dart +++ b/lib/pages/ecosystem/transitingWidget.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:rive/rive.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class TransitingWidget extends StatefulWidget { TransitingWidget(this.fromNetwork, this.toNetwork, this.token, {Key key}) @@ -32,7 +33,7 @@ class _TransitingWidgetState extends State { Text( "${I18n.of(context)?.getDic(i18n_full_dic_app, 'public')['ecosystem.inTransiting']} ...", style: Theme.of(context).textTheme.headline1?.copyWith( - fontSize: 36, + fontSize: UI.getTextSize(36, context), fontWeight: FontWeight.bold, color: PluginColorsDark.headline1), ), @@ -52,7 +53,7 @@ class _TransitingWidgetState extends State { .textTheme .headline3 ?.copyWith( - fontSize: 20, + fontSize: UI.getTextSize(20, context), fontWeight: FontWeight.w600, color: PluginColorsDark.primary), ))), @@ -76,7 +77,7 @@ class _TransitingWidgetState extends State { child: Text( "${widget.token} on ${widget.toNetwork}", style: Theme.of(context).textTheme.headline3?.copyWith( - fontSize: 20, + fontSize: UI.getTextSize(20, context), fontWeight: FontWeight.w600, color: PluginColorsDark.headline1), )), diff --git a/lib/pages/homePage.dart b/lib/pages/homePage.dart index 3023836e..eaee9bfb 100644 --- a/lib/pages/homePage.dart +++ b/lib/pages/homePage.dart @@ -24,6 +24,7 @@ import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/plugin/metaHubPage.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginItemCard.dart'; import 'package:polkawallet_ui/ui.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class HomePage extends StatefulWidget { HomePage(this.service, this.plugins, this.connectedNode, @@ -142,7 +143,14 @@ class _HomePageState extends State { @override void initState() { super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + final args = ModalRoute.of(context).settings.arguments as Map; + if (args != null && args['tab'] != null) { + setState(() { + _tabIndex = args['tab']; + }); + } _setupJPush(); _setupWssNotifyTimer(); widget.service.store.settings.initDapps(); @@ -184,10 +192,9 @@ class _HomePageState extends State { child: Text( dic['hub.cover.browser'], textAlign: TextAlign.justify, - style: Theme.of(context) - .textTheme - .headline4 - .copyWith(fontSize: 14, color: Colors.white), + style: Theme.of(context).textTheme.headline4.copyWith( + fontSize: UI.getTextSize(14, context), + color: Colors.white), ), ) ], @@ -203,7 +210,8 @@ class _HomePageState extends State { child: Text( dic['hub.enter'], style: Theme.of(context).textTheme.headline1.copyWith( - fontSize: 20, color: Theme.of(context).errorColor), + fontSize: UI.getTextSize(20, context), + color: Theme.of(context).errorColor), )) ]), onTap: () { @@ -239,10 +247,9 @@ class _HomePageState extends State { child: Text( dic['hub.cover.tokenStaking'], textAlign: TextAlign.justify, - style: Theme.of(context) - .textTheme - .headline4 - .copyWith(fontSize: 14, color: Colors.white), + style: Theme.of(context).textTheme.headline4.copyWith( + fontSize: UI.getTextSize(14, context), + color: Colors.white), ), ) ], @@ -258,7 +265,8 @@ class _HomePageState extends State { child: Text( dic['hub.enter'], style: Theme.of(context).textTheme.headline1.copyWith( - fontSize: 20, color: Theme.of(context).errorColor), + fontSize: UI.getTextSize(20, context), + color: Theme.of(context).errorColor), )) ]), onTap: () { @@ -357,7 +365,9 @@ class _HomePageState extends State { .textTheme .headline4 .copyWith( - fontSize: 14, color: Colors.white), + fontSize: + UI.getTextSize(14, context), + color: Colors.white), ), ) ], @@ -377,7 +387,7 @@ class _HomePageState extends State { .textTheme .headline1 .copyWith( - fontSize: 20, + fontSize: UI.getTextSize(20, context), color: Theme.of(context).errorColor), )) ] diff --git a/lib/pages/networkSelectPage.dart b/lib/pages/networkSelectPage.dart index 4c74fb6c..350a58cd 100644 --- a/lib/pages/networkSelectPage.dart +++ b/lib/pages/networkSelectPage.dart @@ -209,10 +209,10 @@ class _NetworkSelectPageState extends State { subtitle: Text('$accIndex${Fmt.address(address)}', maxLines: 2, style: TextStyle( - fontSize: 10, + fontSize: UI.getTextSize(10, context), fontWeight: FontWeight.w300, color: Color(0xFF565554), - fontFamily: "SF_Pro")), + fontFamily: UI.getFontFamily('SF_Pro', context))), trailing: Image.asset( "assets/images/${isCurrent ? "icon_circle_select.png" : "icon_circle_unselect.png"}", fit: BoxFit.contain, @@ -470,7 +470,7 @@ class _CommunityPluginNote extends StatelessWidget { dic['plugin.note'] + pluginName.toUpperCase() + dic['plugin.team'], - style: TextStyle(fontSize: 12), + style: TextStyle(fontSize: UI.getTextSize(12, context)), )), SvgPicture.asset('assets/images/public/github_logo.svg', width: 16), diff --git a/lib/pages/profile/aboutPage.dart b/lib/pages/profile/aboutPage.dart index cb27e2d8..a3641e84 100644 --- a/lib/pages/profile/aboutPage.dart +++ b/lib/pages/profile/aboutPage.dart @@ -64,8 +64,8 @@ class _AboutPage extends State { widget.service.plugin.basic.name, widget.service.plugin.basic.jsCodeVersion); final colorGray = Theme.of(context).unselectedWidgetColor; - final labelStyle = TextStyle(fontSize: 16); - final contentStyle = TextStyle(fontSize: 14, color: colorGray); + final contentStyle = + TextStyle(fontSize: UI.getTextSize(14, context), color: colorGray); final pagePadding = 16.w; return Scaffold( diff --git a/lib/pages/profile/account/accountManagePage.dart b/lib/pages/profile/account/accountManagePage.dart index b64c3333..0565682f 100644 --- a/lib/pages/profile/account/accountManagePage.dart +++ b/lib/pages/profile/account/accountManagePage.dart @@ -156,8 +156,9 @@ class _AccountManagePageState extends State { Text(UI.accountName(context, acc), style: TextStyle( color: Color(0xFF565554), - fontSize: 20, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(20, context), + fontFamily: + UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w600)), Row( mainAxisAlignment: MainAxisAlignment.center, @@ -166,7 +167,7 @@ class _AccountManagePageState extends State { Text( Fmt.address(acc.address) ?? '', style: TextStyle( - fontSize: 16, + fontSize: UI.getTextSize(16, context), color: Theme.of(context).unselectedWidgetColor), ), GestureDetector( @@ -251,7 +252,8 @@ class _AccountManagePageState extends State { dic['delete'], style: TextStyle( color: Colors.red, - fontFamily: 'TitilliumWeb', + fontFamily: + UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w400, ), textAlign: TextAlign.center, diff --git a/lib/pages/profile/account/exportResultPage.dart b/lib/pages/profile/account/exportResultPage.dart index 2057c945..f5df5f6f 100644 --- a/lib/pages/profile/account/exportResultPage.dart +++ b/lib/pages/profile/account/exportResultPage.dart @@ -48,8 +48,9 @@ class ExportResultPage extends StatelessWidget { I18n.of(context) .getDic(i18n_full_dic_ui, 'common')['copy'], style: TextStyle( - fontSize: 14, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(14, context), + fontFamily: + UI.getFontFamily('TitilliumWeb', context), color: Theme.of(context).toggleableActiveColor), ), ), @@ -92,8 +93,9 @@ class ExportResultPage extends StatelessWidget { I18n.of(context).getDic( i18n_full_dic_ui, 'common')['copy'], style: TextStyle( - fontSize: 14, - fontFamily: 'TitilliumWeb', + fontSize: UI.getTextSize(14, context), + fontFamily: UI.getFontFamily( + 'TitilliumWeb', context), color: Theme.of(context) .toggleableActiveColor), ), diff --git a/lib/pages/profile/communityPage.dart b/lib/pages/profile/communityPage.dart index 3b250f73..aa860ed7 100644 --- a/lib/pages/profile/communityPage.dart +++ b/lib/pages/profile/communityPage.dart @@ -46,8 +46,6 @@ class _CommunityPage extends State { Widget build(BuildContext context) { final dic = I18n.of(context).getDic(i18n_full_dic_app, 'profile'); final colorGray = Theme.of(context).unselectedWidgetColor; - final labelStyle = TextStyle(fontSize: 16); - final contentStyle = TextStyle(fontSize: 14, color: colorGray); final pagePadding = 16.w; return Scaffold( appBar: AppBar( diff --git a/lib/pages/profile/contacts/contactsPage.dart b/lib/pages/profile/contacts/contactsPage.dart index ad4882b5..741405d3 100644 --- a/lib/pages/profile/contacts/contactsPage.dart +++ b/lib/pages/profile/contacts/contactsPage.dart @@ -170,11 +170,11 @@ class _ContactsPageState extends State { leading: AddressIcon(i.address, svg: i.icon, size: 36.w), title: Text( UI.accountName(context, i), - style: TextStyle(fontSize: 16), + style: TextStyle(fontSize: UI.getTextSize(16, context)), ), subtitle: Text( Fmt.address(i.address), - style: TextStyle(fontSize: 12), + style: TextStyle(fontSize: UI.getTextSize(12, context)), ), onTap: () => _showActions(context, i), ), diff --git a/lib/pages/profile/index.dart b/lib/pages/profile/index.dart index 9470fd96..5a79e463 100644 --- a/lib/pages/profile/index.dart +++ b/lib/pages/profile/index.dart @@ -186,8 +186,10 @@ class _ProfilePageState extends State { child: Text(UI.accountName(context, acc), style: TextStyle( color: Color(0xFF565554), - fontSize: 20, - fontFamily: 'TitilliumWeb', + fontSize: + UI.getTextSize(20, context), + fontFamily: UI.getFontFamily( + 'TitilliumWeb', context), fontWeight: FontWeight.w600)), onTap: _manageAccount, ), @@ -197,7 +199,9 @@ class _ProfilePageState extends State { Text( Fmt.address(acc.address) ?? '', style: TextStyle( - fontSize: 16, color: grey), + fontSize: + UI.getTextSize(16, context), + color: grey), ), GestureDetector( child: Container( diff --git a/lib/pages/profile/message/messagePage.dart b/lib/pages/profile/message/messagePage.dart index 6eff669a..990a9dea 100644 --- a/lib/pages/profile/message/messagePage.dart +++ b/lib/pages/profile/message/messagePage.dart @@ -13,6 +13,7 @@ import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/mainTabBar.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; import 'package:polkawallet_ui/components/v3/roundedCard.dart'; +import 'package:polkawallet_ui/utils/index.dart' as polkawallet_ui; class MessagePage extends StatefulWidget { MessagePage(this.service, {Key key}) : super(key: key); @@ -65,8 +66,9 @@ class _MessagePageState extends State { dic['message.readAll'], style: TextStyle( color: Theme.of(context).cardColor, - fontSize: 12, - fontFamily: 'TitilliumWeb', + fontSize: polkawallet_ui.UI.getTextSize(12, context), + fontFamily: polkawallet_ui.UI + .getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w600, ), ), @@ -153,7 +155,8 @@ class _MessagePageState extends State { .textTheme .headline6 ?.copyWith( - fontSize: 10, + fontSize: polkawallet_ui.UI + .getTextSize(10, context), color: Theme.of(context) .textSelectionTheme .selectionColor @@ -191,7 +194,9 @@ class _MessagePageState extends State { .textTheme .headline6 ?.copyWith( - fontSize: 14, + fontSize: polkawallet_ui.UI + .getTextSize( + 14, context), fontWeight: FontWeight.w500), ), @@ -214,7 +219,8 @@ class _MessagePageState extends State { .textTheme .headline6 ?.copyWith( - fontSize: 10, + fontSize: polkawallet_ui.UI + .getTextSize(10, context), color: Theme.of(context) .textSelectionTheme .selectionColor @@ -244,7 +250,9 @@ class _MessagePageState extends State { style: Theme.of(context) .textTheme .bodyText1 - .copyWith(fontSize: 14), + .copyWith( + fontSize: polkawallet_ui.UI + .getTextSize(14, context)), ), Container( decoration: BoxDecoration( diff --git a/lib/pages/profile/recovery/createRecoveryPage.dart b/lib/pages/profile/recovery/createRecoveryPage.dart index 922454fc..ed2a5e1c 100644 --- a/lib/pages/profile/recovery/createRecoveryPage.dart +++ b/lib/pages/profile/recovery/createRecoveryPage.dart @@ -211,12 +211,13 @@ ${dic['recovery.deposit.factor']} = ${Fmt.doubleFormat(_friendDepositFactor)} $s children: [ Text( dic['recovery.threshold'], - style: TextStyle(fontSize: 16), + style: TextStyle( + fontSize: UI.getTextSize(16, context)), ), Text( '${_threshold.toInt()} / ${_friends.length}', style: TextStyle( - fontSize: 16, + fontSize: UI.getTextSize(16, context), fontWeight: FontWeight.bold, color: Theme.of(context).primaryColor, ), @@ -239,7 +240,7 @@ ${dic['recovery.deposit.factor']} = ${Fmt.doubleFormat(_friendDepositFactor)} $s padding: EdgeInsets.only(left: 16, top: 16), child: Text( dic['recovery.delay'], - style: TextStyle(fontSize: 16), + style: TextStyle(fontSize: UI.getTextSize(16, context)), ), ), Padding( @@ -303,7 +304,9 @@ ${dic['recovery.deposit.factor']} = ${Fmt.doubleFormat(_friendDepositFactor)} $s child: Text( _delayError ?? "", style: TextStyle( - color: Colors.red, fontSize: 12), + color: Colors.red, + fontSize: + UI.getTextSize(12, context)), )) ], ), diff --git a/lib/pages/profile/recovery/recoverySettingPage.dart b/lib/pages/profile/recovery/recoverySettingPage.dart index a609ab1f..172be0de 100644 --- a/lib/pages/profile/recovery/recoverySettingPage.dart +++ b/lib/pages/profile/recovery/recoverySettingPage.dart @@ -25,6 +25,7 @@ import 'package:polkawallet_ui/pages/txConfirmPage.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/back.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class RecoverySettingPage extends StatefulWidget { RecoverySettingPage(this.service); @@ -322,7 +323,7 @@ class _RecoveryInfo extends StatelessWidget { @override Widget build(BuildContext context) { final dic = I18n.of(context).getDic(i18n_full_dic_app, 'profile'); - TextStyle titleStyle = TextStyle(fontSize: 16); + TextStyle titleStyle = TextStyle(fontSize: UI.getTextSize(16, context)); TextStyle valueStyle = Theme.of(context).textTheme.headline4; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -407,7 +408,7 @@ class RecoveryFriendList extends StatelessWidget { Fmt.address(e.address), style: TextStyle( color: Theme.of(context).unselectedWidgetColor, - fontSize: 13, + fontSize: UI.getTextSize(13, context), ), ), ], diff --git a/lib/pages/profile/settings/settingsPage.dart b/lib/pages/profile/settings/settingsPage.dart index d1a4d166..4f999672 100644 --- a/lib/pages/profile/settings/settingsPage.dart +++ b/lib/pages/profile/settings/settingsPage.dart @@ -1,3 +1,4 @@ +import 'package:app/pages/homePage.dart'; import 'package:app/pages/profile/index.dart'; import 'package:app/service/index.dart'; import 'package:app/utils/i18n/index.dart'; @@ -8,8 +9,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:polkawallet_sdk/api/types/networkParams.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/back.dart'; -import 'package:polkawallet_ui/components/v3/roundedCard.dart'; import 'package:polkawallet_ui/components/v3/index.dart' as v3; +import 'package:polkawallet_ui/components/v3/roundedCard.dart'; +import 'package:rive/src/widgets/rive_animation.dart'; class SettingsPage extends StatefulWidget { SettingsPage(this.service, this.changeLang, this.changeNode); @@ -25,8 +27,7 @@ class SettingsPage extends StatefulWidget { class _Settings extends State { final _langOptions = ['', 'en', 'zh']; final _priceCurrencyOptions = ['USD', 'CNY']; - - int _selectedPriceCurrency = 0; + bool _isLoading = false; String _getLang(String code) { var dic = I18n.of(context).getDic(i18n_full_dic_app, 'profile'); @@ -76,6 +77,14 @@ class _Settings extends State { widget.changeLang(code == '' ? Localizations.localeOf(context).toString() : code); + setState(() { + _isLoading = true; + }); + Future.delayed(Duration(milliseconds: 1500), () { + Navigator.of(context).pushNamedAndRemoveUntil( + HomePage.route, (route) => false, + arguments: {"tab": 0}); + }); } return true; }, @@ -109,9 +118,6 @@ class _Settings extends State { onWillPop: () async { final currency = _priceCurrencyOptions[selected]; if (currency != cached) { - setState(() { - _selectedPriceCurrency = selected; - }); widget.service.store.settings.setPriceCurrency(currency); } return true; @@ -124,58 +130,77 @@ class _Settings extends State { @override Widget build(BuildContext context) { var dic = I18n.of(context).getDic(i18n_full_dic_app, 'profile'); - - return Scaffold( - appBar: AppBar( - title: Text(dic['setting']), centerTitle: true, leading: BackBtn()), - body: Observer( - builder: (_) { - final hideBalanceTip = widget.service.store.settings.isHideBalance - ? dic['setting.currency.tip'] - : ''; - final currencyTip = - widget.service.store.settings.priceCurrency == 'CNY' - ? ' (${dic['setting.currency.tip']})' - : ''; - return SafeArea( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: RoundedCard( - margin: EdgeInsets.fromLTRB(16.w, 4.h, 16.w, 16.h), - padding: EdgeInsets.fromLTRB(8.w, 16.h, 8.w, 16.h), - child: Column( - children: [ - SettingsPageListItem( - label: dic['setting.balance.hide'], - subtitle: hideBalanceTip.isEmpty ? null : hideBalanceTip, - content: v3.CupertinoSwitch( - value: widget.service.store.settings.isHideBalance, - onChanged: (v) => - widget.service.store.settings.setIsHideBalance(v), + return _isLoading + ? Container( + width: double.infinity, + height: double.infinity, + color: Theme.of(context).scaffoldBackgroundColor, + child: Center( + child: Container( + margin: EdgeInsets.only(bottom: 100), + width: 150, + child: RiveAnimation.asset( + 'assets/images/public/switchLanguage.riv', + fit: BoxFit.contain, + )), + ), + ) + : Scaffold( + appBar: AppBar( + title: Text(dic['setting']), + centerTitle: true, + leading: BackBtn()), + body: Observer( + builder: (_) { + final hideBalanceTip = + widget.service.store.settings.isHideBalance + ? dic['setting.currency.tip'] + : ''; + final currencyTip = + widget.service.store.settings.priceCurrency == 'CNY' + ? ' (${dic['setting.currency.tip']})' + : ''; + return SafeArea( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: RoundedCard( + margin: EdgeInsets.fromLTRB(16.w, 4.h, 16.w, 16.h), + padding: EdgeInsets.fromLTRB(8.w, 16.h, 8.w, 16.h), + child: Column( + children: [ + SettingsPageListItem( + label: dic['setting.balance.hide'], + subtitle: + hideBalanceTip.isEmpty ? null : hideBalanceTip, + content: v3.CupertinoSwitch( + value: + widget.service.store.settings.isHideBalance, + onChanged: (v) => widget.service.store.settings + .setIsHideBalance(v), + ), + ), + Divider(height: 24.h), + SettingsPageListItem( + label: dic['setting.currency'], + subtitle: _getPriceCurrency(widget + .service.store.settings.priceCurrency) + + currencyTip, + onTap: _onCurrencyTap, + ), + Divider(height: 24.h), + SettingsPageListItem( + label: dic['setting.lang'], + subtitle: _getLang( + widget.service.store.settings.localeCode), + onTap: _onLanguageTap, + ), + ], ), ), - Divider(height: 24.h), - SettingsPageListItem( - label: dic['setting.currency'], - subtitle: _getPriceCurrency( - widget.service.store.settings.priceCurrency) + - currencyTip, - onTap: _onCurrencyTap, - ), - Divider(height: 24.h), - SettingsPageListItem( - label: dic['setting.lang'], - subtitle: - _getLang(widget.service.store.settings.localeCode), - onTap: _onLanguageTap, - ), - ], - ), - ), + ), + ); + }, ), ); - }, - ), - ); } } diff --git a/lib/pages/public/AdBanner.dart b/lib/pages/public/AdBanner.dart index 9c172ab7..f88c7ac1 100644 --- a/lib/pages/public/AdBanner.dart +++ b/lib/pages/public/AdBanner.dart @@ -190,7 +190,10 @@ class _AdBannerState extends State { itemBuilder: (BuildContext context, int index) { return widgets[index]; }, - pagination: SwiperPagination(margin: EdgeInsets.zero), + pagination: SwiperPagination( + margin: EdgeInsets.zero, + builder: DotSwiperPaginationBuilder( + activeColor: Theme.of(context).toggleableActiveColor)), ), ); // }); diff --git a/lib/pages/public/guidePage.dart b/lib/pages/public/guidePage.dart index 206b3ca0..cc5f0631 100644 --- a/lib/pages/public/guidePage.dart +++ b/lib/pages/public/guidePage.dart @@ -1,6 +1,6 @@ import 'package:app/pages/homePage.dart'; import 'package:app/utils/i18n/index.dart'; -import 'package:flutter/cupertino.dart'; +import 'package:polkawallet_ui/utils/index.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/button.dart'; @@ -51,10 +51,8 @@ class _GuidePageState extends State { child: Text( dic['guide.$_pageIndex'], textAlign: TextAlign.start, - style: Theme.of(context) - .textTheme - .headline1 - .copyWith(fontSize: 28, height: 1.15), + style: Theme.of(context).textTheme.headline1.copyWith( + fontSize: UI.getTextSize(28, context), height: 1.15), )), Padding( padding: EdgeInsets.only(left: 27), diff --git a/lib/pages/public/stakingDotGuide.dart b/lib/pages/public/stakingDotGuide.dart index 17509410..391c06ed 100644 --- a/lib/pages/public/stakingDotGuide.dart +++ b/lib/pages/public/stakingDotGuide.dart @@ -1,11 +1,11 @@ import 'package:app/service/index.dart'; import 'package:app/utils/i18n/index.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/button.dart'; import 'package:polkawallet_ui/components/v3/roundedCard.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class StakingDOTGuide extends StatelessWidget { StakingDOTGuide(this.service); @@ -37,12 +37,8 @@ class StakingDOTGuide extends StatelessWidget { decoration: BoxDecoration( color: Color.fromARGB(16, 0, 0, 0), borderRadius: BorderRadius.all(Radius.circular(8))), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(dic['event.0515.1'], style: greyStyle), - Text(dic['event.0515.2'], style: greyStyle) - ], + child: Row( + children: [Text(dic['event.0515.2'], style: greyStyle)], ), ), RoundedCard( @@ -126,7 +122,10 @@ class _InfoItem extends StatelessWidget { title: button, onPressed: onClick, height: 40, - style: Theme.of(context).textTheme.button.copyWith(fontSize: 14), + style: Theme.of(context) + .textTheme + .button + .copyWith(fontSize: UI.getTextSize(14, context)), ), ) ], diff --git a/lib/pages/public/stakingKSMGuide.dart b/lib/pages/public/stakingKSMGuide.dart index 6987b256..f707f1b5 100644 --- a/lib/pages/public/stakingKSMGuide.dart +++ b/lib/pages/public/stakingKSMGuide.dart @@ -1,11 +1,11 @@ import 'package:app/service/index.dart'; import 'package:app/utils/i18n/index.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/button.dart'; import 'package:polkawallet_ui/components/v3/roundedCard.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class StakingKSMGuide extends StatelessWidget { StakingKSMGuide(this.service); @@ -37,12 +37,8 @@ class StakingKSMGuide extends StatelessWidget { decoration: BoxDecoration( color: Color.fromARGB(16, 0, 0, 0), borderRadius: BorderRadius.all(Radius.circular(8))), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(dic['event.0415.1'], style: greyStyle), - Text(dic['event.0415.2'], style: greyStyle) - ], + child: Row( + children: [Text(dic['event.0415.2'], style: greyStyle)], ), ), RoundedCard( @@ -126,7 +122,10 @@ class _InfoItem extends StatelessWidget { title: button, onPressed: onClick, height: 40, - style: Theme.of(context).textTheme.button.copyWith(fontSize: 14), + style: Theme.of(context) + .textTheme + .button + .copyWith(fontSize: UI.getTextSize(14, context)), ), ) ], diff --git a/lib/service/apiAccount.dart b/lib/service/apiAccount.dart index 203ccc2f..2bbbbf64 100644 --- a/lib/service/apiAccount.dart +++ b/lib/service/apiAccount.dart @@ -115,12 +115,12 @@ class ApiAccount { '$_biometricPasswordKey$pubKey', options: StorageFileInitOptions(authenticationValidityDurationSeconds: 30), - androidPromptInfo: AndroidPromptInfo( - title: - I18n.of(context).getDic(i18n_full_dic_app, 'account')['unlock.bio'], - negativeButton: - I18n.of(context).getDic(i18n_full_dic_ui, 'common')['cancel'], - ), + // androidPromptInfo: AndroidPromptInfo( + // title: + // I18n.of(context).getDic(i18n_full_dic_app, 'account')['unlock.bio'], + // negativeButton: + // I18n.of(context).getDic(i18n_full_dic_ui, 'common')['cancel'], + // ), ); } diff --git a/lib/service/apiAssets.dart b/lib/service/apiAssets.dart index e76442b6..12effaa7 100644 --- a/lib/service/apiAssets.dart +++ b/lib/service/apiAssets.dart @@ -26,7 +26,9 @@ class ApiAssets { Map res = await apiRoot.subScan.fetchTransfersAsync( acc.address, page, - network: apiRoot.plugin.basic.name, + network: apiRoot.plugin.basic.name == 'bifrost' + ? 'bifrost-kusama' + : apiRoot.plugin.basic.name, ); if (page == 0) { @@ -43,9 +45,9 @@ class ApiAssets { return res; } - Future fetchMarketPrices() async { + Future fetchMarketPrices(List tokens) async { final res = await Future.wait([ - WalletApi.getTokenPrices(), + WalletApi.getTokenPrices(tokens), WalletApi.getTokenPriceFromSubScan(apiRoot.plugin.basic.name) ]); final Map prices = { @@ -53,15 +55,18 @@ class ApiAssets { 'AUSD': 1.0, 'USDT': 1.0, }; - if (res[1]['data'] != null) { + if ((res[1] ?? {})['data'] != null) { final tokenData = res[1]['data']['detail'] as Map; prices.addAll({ tokenData.keys.toList()[0]: double.tryParse(tokenData.values.toList()[0]['price'].toString()) }); } - if (res[0]['prices'] != null) { - prices.addAll(Map.from(res[0]['prices'])); + + final serverPrice = Map.from(res[0] ?? {}); + serverPrice.removeWhere((_, value) => value == 0); + if (serverPrice.values.length > 0) { + prices.addAll(serverPrice); } apiRoot.store.assets.setMarketPrices(prices); diff --git a/lib/service/walletApi.dart b/lib/service/walletApi.dart index e76eaeec..c5d3c1fe 100644 --- a/lib/service/walletApi.dart +++ b/lib/service/walletApi.dart @@ -159,29 +159,18 @@ class WalletApi { '$_jsCodeStorageVersionKey$networkName', version.toString()); } - // static Future getAnnouncements() async { - // try { - // Response res = await get(getUrl(_endpoint, '/announce.json')); - // if (res == null) { - // return null; - // } else { - // return jsonDecode(utf8.decode(res.bodyBytes)); - // } - // } catch (err) { - // print(err); - // return null; - // } - // } - - static Future getTokenPrices() async { - final url = - '$_cdnEndpoint/lastPrice.json?t=${DateTime.now().millisecondsSinceEpoch}'; + static Future getTokenPrices(List tokens) async { + final url = '$_endpoint/price-server?from=market&token=${tokens.join(',')}'; try { Response res = await get(Uri.parse(url)); if (res == null) { return null; } else { - return jsonDecode(utf8.decode(res.bodyBytes)); + final data = + jsonDecode(utf8.decode(res.bodyBytes))['data']['price'] as List; + return data + .asMap() + .map((k, v) => MapEntry(tokens[k], double.parse(v.toString()))); } } catch (err) { print(err); diff --git a/lib/store/settings.dart b/lib/store/settings.dart index 874a718a..b9d01b50 100644 --- a/lib/store/settings.dart +++ b/lib/store/settings.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'package:app/common/consts.dart'; import 'package:app/service/walletApi.dart'; -import 'package:app/store/types/dappData.dart'; import 'package:app/store/types/messageData.dart'; import 'package:get_storage/get_storage.dart'; import 'package:mobx/mobx.dart'; @@ -66,10 +65,10 @@ abstract class _SettingsStore with Store { Map tokenStakingConfig = { "onStart": {"KSM": true, "DOT": false}, - "KSM": ["kusama", "bifrost", "parallel heiko"], - "LKSM": ["parallel heiko"], + "KSM": ["kusama", "bifrost", "calamari"], + "LKSM": ["parallel heiko", "calamari", "turing"], "DOT": ["polkadot"], - "LDOT": [] + "LDOT": ["parallel"] }; Future initDapps() async { @@ -217,9 +216,9 @@ abstract class _SettingsStore with Store { Future getRate() async { if (_rate < 0) { - final data = await WalletApi.getTokenPrices(); - if (data != null && data['rate'] != null) { - _rate = (data['rate'] as num).toDouble(); + final data = await WalletApi.getRate(); + if (data != null && data['data'] != null) { + _rate = (data['data']['rate'] as num).toDouble(); } else { _rate = 1; } diff --git a/lib/utils/InstrumentWidget.dart b/lib/utils/InstrumentWidget.dart index e81ea7e6..fc8dcb49 100644 --- a/lib/utils/InstrumentWidget.dart +++ b/lib/utils/InstrumentWidget.dart @@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:polkawallet_ui/components/SkaletonList.dart'; import 'package:polkawallet_ui/components/v3/roundedCard.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; export 'package:app/utils/InstrumentItemWidget.dart'; @@ -92,8 +93,9 @@ class _InstrumentWidgetState extends State { ? "${widget.datas[getIndex()].title}:" : "", style: TextStyle( - fontFamily: "TitilliumWeb", - fontSize: 14, + fontFamily: + UI.getFontFamily('TitilliumWeb', context), + fontSize: UI.getTextSize(14, context), fontWeight: FontWeight.w400, color: Theme.of(context) .textSelectionTheme @@ -108,8 +110,8 @@ class _InstrumentWidgetState extends State { ? "******" : "${Utils.currencySymbol(widget.priceCurrency)}${Fmt.priceFloorFormatter(widget.datas[getIndex()].sumValue, lengthMax: widget.datas[getIndex()].lengthMax)}", style: TextStyle( - fontFamily: "SF_Pro", - fontSize: 18, + fontFamily: UI.getFontFamily('SF_Pro', context), + fontSize: UI.getTextSize(18, context), fontWeight: FontWeight.w600, color: Theme.of(context) .textSelectionTheme @@ -255,8 +257,9 @@ class _InstrumentWidgetState extends State { Text( e.name, style: TextStyle( - fontFamily: "TitilliumWeb", - fontSize: 12, + fontFamily: + UI.getFontFamily('TitilliumWeb', context), + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w400, color: Theme.of(context) .textSelectionTheme @@ -269,8 +272,9 @@ class _InstrumentWidgetState extends State { ? "******" : "${Utils.currencySymbol(widget.priceCurrency)}${Fmt.priceFloorFormatter(e.value, lengthMax: widget.datas[getIndex()].lengthMax)}", style: TextStyle( - fontFamily: "TitilliumWeb", - fontSize: 12, + fontFamily: + UI.getFontFamily('TitilliumWeb', context), + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w400, color: Theme.of(context) .textSelectionTheme diff --git a/lib/utils/ShowCustomAlterWidget.dart b/lib/utils/ShowCustomAlterWidget.dart index f0d7019d..7b75ff26 100644 --- a/lib/utils/ShowCustomAlterWidget.dart +++ b/lib/utils/ShowCustomAlterWidget.dart @@ -1,5 +1,5 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class ShowCustomAlterWidget extends StatefulWidget { final Function(String) confirmCallback; @@ -32,9 +32,9 @@ class _ShowCustomAlterWidgetState extends State { child: Text(e, style: TextStyle( color: Color(0xFF007AFE), - fontSize: 17, + fontSize: UI.getTextSize(17, context), fontWeight: FontWeight.w400, - fontFamily: "SF_Pro")), + fontFamily: UI.getFontFamily('SF_Pro', context))), )) .toList(), ], @@ -45,9 +45,9 @@ class _ShowCustomAlterWidgetState extends State { child: Text(widget.cancel, style: TextStyle( color: Color(0xFF007AFE), - fontSize: 17, + fontSize: UI.getTextSize(17, context), fontWeight: FontWeight.w500, - fontFamily: "SF_Pro")), + fontFamily: UI.getFontFamily('SF_Pro', context))), ), ); } diff --git a/lib/utils/UI.dart b/lib/utils/UI.dart index 28e7cd4f..e7469b4e 100644 --- a/lib/utils/UI.dart +++ b/lib/utils/UI.dart @@ -83,82 +83,251 @@ class AppUI { builder: (BuildContext context) { List versionInfo = versions[platform]['info'] [I18n.of(context).locale.toString().contains('zh') ? 'zh' : 'en']; - return CupertinoAlertDialog( - title: Text('v$showLatestBeta'), - content: Column( - children: [ - Padding( - padding: EdgeInsets.only(top: 12, bottom: 8), - child: - Text(needUpdate ? dic['update.up'] : dic['update.latest']), - ), - Visibility( - visible: needUpdate, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: versionInfo - .map((e) => Text('- $e', textAlign: TextAlign.left)) - .toList(), - )) - ], - ), - actions: [ - CupertinoButton( - child: Text(I18n.of(context) - .getDic(i18n_full_dic_ui, 'common')['cancel']), - onPressed: () async { - Navigator.of(context).pop(); - if (needUpdate && - versionCodeMin > await Utils.getBuildNumber()) { - exit(0); - } - }, - ), - CupertinoButton( - child: Text( - I18n.of(context).getDic(i18n_full_dic_ui, 'common')['ok']), - onPressed: () async { - Navigator.of(context).pop(); - if (!needUpdate) { - return; - } - if (Platform.isIOS) { - // go to ios download page - UI.launchURL(versions[platform]['store-url']); - } else if (Platform.isAndroid) { - if (buildTarget == BuildTargets.playStore) { - // go to google play page - UI.launchURL(versions[platform]['store-url']); - return; - } - // download apk - // START LISTENING FOR DOWNLOAD PROGRESS REPORTING EVENTS - try { - UpdateApp.updateApp( - url: versions['android']['url'], appleId: "1520301768"); - showCupertinoDialog( - context: context, - builder: (BuildContext ctx) { - return CupertinoAlertDialog( - title: Text(dic['update.download']), - content: Text(dic['update.download.check']), - actions: [ - CupertinoButton( - child: Text(I18n.of(context) - .getDic(i18n_full_dic_ui, 'common')['ok']), - onPressed: () => Navigator.of(ctx).pop(), + return WillPopScope( + onWillPop: () async { + if (needUpdate && versionCodeMin > await Utils.getBuildNumber()) { + exit(0); + } + return true; + }, + child: Container( + margin: EdgeInsets.only(left: 48, right: 48), + padding: EdgeInsets.only(bottom: 50), + child: Center( + child: Stack( + alignment: AlignmentDirectional.topCenter, + children: [ + Container( + margin: EdgeInsets.only(top: needUpdate ? 105 : 106), + padding: EdgeInsets.only( + top: needUpdate ? 92 : 69, + bottom: 20, + left: 19, + right: 19), + width: double.infinity, + height: (MediaQuery.of(context).size.width - 96) / + 294 * + (needUpdate ? 421 : 298), + decoration: BoxDecoration( + color: needUpdate ? Colors.transparent : Colors.white, + gradient: needUpdate + ? null + : LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + stops: [0.03, 0.3], + colors: [ + Color(0xFFFDF1EB), + Color(0xFFFFFFFF), + ], ), - ], - ); - }); - } catch (e) { - print('Failed to make OTA update. Details: $e'); - } - } - }, - ), - ], - ); + borderRadius: needUpdate + ? null + : const BorderRadius.only( + topLeft: Radius.circular(60), + topRight: Radius.circular(60), + bottomLeft: Radius.circular(20), + bottomRight: Radius.circular(20)), + image: needUpdate + ? DecorationImage( + image: AssetImage( + "assets/images/update_app_bg.png")) + : null, + ), + child: Column( + children: [ + Text( + 'V ${showLatestBeta.split("-")[0]}', + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .headline3 + ?.copyWith( + fontSize: UI.getTextSize(28, context)), + ), + Padding( + padding: EdgeInsets.only(bottom: 24), + child: Text( + '- ${showLatestBeta.split("-")[1]}', + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .headline4 + ?.copyWith( + fontSize: UI.getTextSize(18, context)), + )), + Expanded( + child: needUpdate + ? SingleChildScrollView( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: versionInfo + .map((e) => Padding( + padding: EdgeInsets.only( + bottom: 12, left: 14), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + width: 10, + height: 10, + margin: + EdgeInsets.only(top: 5), + decoration: BoxDecoration( + color: Theme.of(context) + .toggleableActiveColor, + borderRadius: + BorderRadius + .circular(5)), + ), + Expanded( + child: Padding( + padding: + EdgeInsets.only( + left: 9), + child: Text( + e, + textAlign: + TextAlign.left, + style: Theme.of( + context) + .textTheme + .headline4, + ))), + ], + ))) + .toList(), + )) + : Padding( + padding: + EdgeInsets.only(bottom: 12, left: 14), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + width: 10, + height: 10, + margin: EdgeInsets.only(top: 5), + decoration: BoxDecoration( + color: Theme.of(context) + .toggleableActiveColor, + borderRadius: + BorderRadius.circular(5)), + ), + Expanded( + child: Padding( + padding: + EdgeInsets.only(left: 9), + child: Text( + dic['update.latest'], + textAlign: TextAlign.left, + style: Theme.of(context) + .textTheme + .headline4, + ))), + ], + ))), + Visibility( + visible: needUpdate, + child: Padding( + padding: EdgeInsets.only(bottom: 8), + child: Text( + dic['update.up'], + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .headline6 + ?.copyWith( + fontSize: + UI.getTextSize(14, context)), + ))), + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + if (!needUpdate) { + return; + } + if (Platform.isIOS) { + // go to ios download page + UI.launchURL(versions[platform]['store-url']); + } else if (Platform.isAndroid) { + if (buildTarget == BuildTargets.playStore) { + // go to google play page + UI.launchURL( + versions[platform]['store-url']); + return; + } + // download apk + // START LISTENING FOR DOWNLOAD PROGRESS REPORTING EVENTS + try { + UpdateApp.updateApp( + url: versions['android']['url'], + appleId: "1520301768"); + showCupertinoDialog( + context: context, + builder: (BuildContext ctx) { + return CupertinoAlertDialog( + title: Text(dic['update.download']), + content: Text( + dic['update.download.check']), + actions: [ + CupertinoButton( + child: Text(I18n.of(context) + .getDic(i18n_full_dic_ui, + 'common')['ok']), + onPressed: () => + Navigator.of(ctx).pop(), + ), + ], + ); + }); + } catch (e) { + print( + 'Failed to make OTA update. Details: $e'); + } + } + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 45, vertical: 7), + decoration: BoxDecoration( + color: + Theme.of(context).toggleableActiveColor, + borderRadius: BorderRadius.circular(4)), + child: Text( + needUpdate + ? dic['update.now'] + : I18n.of(context).getDic( + i18n_full_dic_ui, 'common')['ok'], + style: Theme.of(context).textTheme.button, + ), + )) + ], + ), + ), + Image.asset( + "assets/images/update_app_icon${needUpdate ? '' : '2'}.png", + width: needUpdate ? 116 : 200, + ), + GestureDetector( + onTap: () async { + Navigator.of(context).pop(); + if (needUpdate && + versionCodeMin > await Utils.getBuildNumber()) { + exit(0); + } + }, + child: Container( + margin: EdgeInsets.only( + top: 134, left: needUpdate ? 212 : 230), + child: Image.asset( + "assets/images/update_app_delete.png", + width: 24))), + ], + )))); }, ); } diff --git a/lib/utils/i18n/en/assets.dart b/lib/utils/i18n/en/assets.dart index 9b233903..346a5afe 100644 --- a/lib/utils/i18n/en/assets.dart +++ b/lib/utils/i18n/en/assets.dart @@ -108,6 +108,9 @@ const Map enAssets = { 'v3.myDefi': 'My DeFi', 'v3.send': 'Send', 'v3.changeNetwork': 'Change Network', + 'v3.changeNetwork.confirm': 'You will switch to the', + 'v3.changeNetwork.confirm.2': + 'network for the next move, it will take a few seconds.', 'v3.changeNetwork.ing': 'Changing to', 'v3.my': 'My', 'v3.tap': 'TAP', diff --git a/lib/utils/i18n/en/profile.dart b/lib/utils/i18n/en/profile.dart index 8e2c5a83..08759ec0 100644 --- a/lib/utils/i18n/en/profile.dart +++ b/lib/utils/i18n/en/profile.dart @@ -64,6 +64,7 @@ const Map enProfile = { 'update': 'Check Update', 'update.latest': 'Your App is the newest version.', 'update.up': 'New version found, update now?', + 'update.now': 'Update Now', 'update.start': 'Connecting...', 'update.download': 'Downloading...', 'update.download.check': diff --git a/lib/utils/i18n/en/public.dart b/lib/utils/i18n/en/public.dart index 8f636333..9624b313 100644 --- a/lib/utils/i18n/en/public.dart +++ b/lib/utils/i18n/en/public.dart @@ -65,7 +65,6 @@ const Map enPublic = { 'hub.staking': 'Staking', 'hub.cover.tokenStaking': 'Provide your assets allocated on different networks in the ecosystem. You can send your assets through cross-chain transfer, or endow the liquidity to your assets through HOMA, so as to participate in more ecological projects.', - 'ecosystem.on': 'On', 'ecosystem.convertTo': 'Convert to', 'ecosystem.crosschainTransfer': 'Crosschain Transfer', 'ecosystem.from': 'From', @@ -90,10 +89,9 @@ const Map enPublic = { 'event.0415.2': 'Following the steps to participate:', 'event.0415.3': 'Send KSM to Karura\'s parachain.', 'event.0415.4': 'Join the liquid staking and mint LKSM.', - 'event.0415.5': 'Currently 19.92% LKSM Staking APY (rewards in KSM)', + 'event.0415.5': 'Currently 22.44% LKSM Staking APY (rewards in KSM)', 'event.0415.6': 'Stake your LKSM and earn rewards!', - 'event.0415.7': - 'Earn another potential 10% APY on your KSM staking in aUSD rewards', + 'event.0415.7': 'Earn another potential 10% APY on your KSM staking', 'event.0415.8': 'Cross-Chain Transfer', 'event.0415.9': 'Go Liquid Staking', 'event.0415.10': 'Join Collateral Staking', @@ -102,10 +100,9 @@ const Map enPublic = { 'event.0515.2': 'Following the steps to participate:', 'event.0515.3': 'Send DOT to Acala\'s parachain.', 'event.0515.4': 'Join the liquid staking and mint LDOT.', - 'event.0515.5': 'Currently 14.5% LDOT Staking APY (rewards in DOT)', + 'event.0515.5': 'Currently 14.78% LDOT Staking APY (rewards in DOT)', 'event.0515.6': 'Stake your LDOT and earn rewards!', - 'event.0515.7': - 'Earn another potential 10% APY on your DOT staking in aUSD rewards', + 'event.0515.7': 'Earn another potential 10% APY on your DOT staking', 'event.0515.8': 'Cross-Chain Transfer', 'event.0515.9': 'Go Liquid Staking', 'event.0515.10': 'Join Collateral Staking', diff --git a/lib/utils/i18n/zh/assets.dart b/lib/utils/i18n/zh/assets.dart index 23752684..8c20fcb8 100644 --- a/lib/utils/i18n/zh/assets.dart +++ b/lib/utils/i18n/zh/assets.dart @@ -100,6 +100,8 @@ const Map zhAssets = { 'v3.myDefi': '我的DeFi', 'v3.send': '发送', 'v3.changeNetwork': '切换网络', + 'v3.changeNetwork.confirm': '您将切换至', + 'v3.changeNetwork.confirm.2': '网络进行下一步动作,这将花费一些时间。', 'v3.changeNetwork.ing': '正在切换至', 'v3.my': '我的', 'v3.tap': '切换', diff --git a/lib/utils/i18n/zh/profile.dart b/lib/utils/i18n/zh/profile.dart index 2dd45a3f..d3661e00 100644 --- a/lib/utils/i18n/zh/profile.dart +++ b/lib/utils/i18n/zh/profile.dart @@ -62,6 +62,7 @@ const Map zhProfile = { 'update': '检查更新', 'update.latest': '您的应用已是最新版本。', 'update.up': '发现新版本,立即更新吗?', + 'update.now': '立即更新', 'update.start': '等待连接...', 'update.download': '正在下载...', 'update.download.check': '请在后台任务中查看下载进度', diff --git a/lib/utils/i18n/zh/public.dart b/lib/utils/i18n/zh/public.dart index 9675f134..b986497d 100644 --- a/lib/utils/i18n/zh/public.dart +++ b/lib/utils/i18n/zh/public.dart @@ -60,7 +60,6 @@ const Map zhPublic = { 'hub.staking': '质押', 'hub.cover.tokenStaking': '提供您在当前生态中所有网络上分布的资产显示,您可以选择进行跨链转账,或是通过HOMA赋予其流动性,从而参加更多生态项目。', - 'ecosystem.on': '在', 'ecosystem.convertTo': '转换为', 'ecosystem.crosschainTransfer': '跨链转账', 'ecosystem.from': '付款网络', @@ -84,9 +83,9 @@ const Map zhPublic = { 'event.0415.2': '参与步骤如下:', 'event.0415.3': '将 KSM 发送至 Karura 平行链.', 'event.0415.4': '参与 Liquid Staking 生成 LKSM.', - 'event.0415.5': '当前 19.92% LKSM Staking APY (以 KSM 计算)', + 'event.0415.5': '当前 22.44% LKSM Staking APY (以 KSM 计算)', 'event.0415.6': '质押 LKSM 获取受益吧!', - 'event.0415.7': '为你的 KSM Staking 赚取额外 10% APY(以 aUSD 计算)', + 'event.0415.7': '为你的 KSM Staking 赚取额外 10% APY', 'event.0415.8': '跨链转帐', 'event.0415.9': '参与 Liquid Staking', 'event.0415.10': '参与债仓挖矿', @@ -94,9 +93,9 @@ const Map zhPublic = { 'event.0515.2': '参与步骤如下:', 'event.0515.3': '将 DOT 发送至 Acala 平行链.', 'event.0515.4': '参与 Liquid Staking 生成 LDOT.', - 'event.0515.5': '当前 14.5% LDOT Staking APY (以 DOT 计算)', + 'event.0515.5': '当前 14.78% LDOT Staking APY (以 DOT 计算)', 'event.0515.6': '质押 LDOT 获取受益吧!', - 'event.0515.7': '为你的 DOT Staking 赚取额外 10% APY(以 aUSD 计算)', + 'event.0515.7': '为你的 DOT Staking 赚取额外 10% APY', 'event.0515.8': '跨链转帐', 'event.0515.9': '参与 Liquid Staking', 'event.0515.10': '参与债仓挖矿', diff --git a/pubspec.lock b/pubspec.lock index 31061546..53f4d12b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,13 +8,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "22.0.0" - aes_ecb_pkcs5_flutter: - dependency: transitive - description: - name: aes_ecb_pkcs5_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.2" analyzer: dependency: transitive description: @@ -28,21 +21,21 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.6" + version: "3.3.0" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.3.1" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" auth_header: dependency: transitive description: @@ -56,7 +49,7 @@ packages: name: biometric_storage url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "4.1.2" boolean_selector: dependency: transitive description: @@ -70,7 +63,7 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.3.0" build_config: dependency: transitive description: @@ -84,7 +77,7 @@ packages: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.1.0" build_resolvers: dependency: transitive description: @@ -98,7 +91,7 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.11" build_runner_core: dependency: transitive description: @@ -119,14 +112,14 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.1.2" + version: "8.3.2" cached_network_image: dependency: "direct overridden" description: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "3.2.0" + version: "3.2.1" cached_network_image_platform_interface: dependency: transitive description: @@ -147,14 +140,14 @@ packages: name: card_swiper url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -168,16 +161,16 @@ packages: name: charts_common url: "https://pub.dartlang.org" source: hosted - version: "0.11.0" + version: "0.12.0" charts_flutter: dependency: "direct overridden" description: path: charts_flutter ref: HEAD - resolved-ref: "30477090290b348ed3101bc13017aae465f59017" + resolved-ref: d6adb193ff91d2042941bad388845cbc8c5cd964 url: "https://github.com/google/charts" source: git - version: "0.11.0" + version: "0.12.0" checked_yaml: dependency: transitive description: @@ -191,7 +184,7 @@ packages: name: chewie url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.3" chewie_audio: dependency: transitive description: @@ -226,84 +219,84 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" connectivity_plus: dependency: transitive description: name: connectivity_plus url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "2.3.3" connectivity_plus_linux: dependency: transitive description: name: connectivity_plus_linux url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.3.1" connectivity_plus_macos: dependency: transitive description: name: connectivity_plus_macos url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.3" connectivity_plus_platform_interface: dependency: transitive description: name: connectivity_plus_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.1" connectivity_plus_web: dependency: transitive description: name: connectivity_plus_web url: "https://pub.dartlang.org" source: hosted - version: "1.1.0+1" + version: "1.2.1" connectivity_plus_windows: dependency: transitive description: name: connectivity_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.2" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" cross_file: dependency: transitive description: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.1+5" + version: "0.3.3+1" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" csslib: dependency: transitive description: name: csslib url: "https://pub.dartlang.org" source: hosted - version: "0.17.1" + version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.0.5" dart_style: dependency: transitive description: @@ -317,14 +310,14 @@ packages: name: dbus url: "https://pub.dartlang.org" source: hosted - version: "0.5.6" + version: "0.7.5" device_info: dependency: transitive description: name: device_info url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" device_info_platform_interface: dependency: transitive description: @@ -359,14 +352,14 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "2.0.0" file: dependency: transitive description: @@ -380,7 +373,7 @@ packages: name: firebase url: "https://pub.dartlang.org" source: hosted - version: "9.0.2" + version: "9.0.3" firebase_analytics: dependency: "direct main" description: @@ -415,40 +408,47 @@ packages: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "4.4.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.6.4" fixnum: dependency: transitive description: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" fl_chart: dependency: transitive description: name: fl_chart url: "https://pub.dartlang.org" source: hosted - version: "0.40.5" + version: "0.40.6" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_aes_ecb_pkcs5: + dependency: transitive + description: + name: flutter_aes_ecb_pkcs5 + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" flutter_blurhash: dependency: transitive description: name: flutter_blurhash url: "https://pub.dartlang.org" source: hosted - version: "0.6.4" + version: "0.7.0" flutter_cache_manager: dependency: transitive description: @@ -456,6 +456,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.3.0" + flutter_hooks: + dependency: transitive + description: + name: flutter_hooks + url: "https://pub.dartlang.org" + source: hosted + version: "0.18.4" flutter_html: dependency: "direct overridden" description: @@ -476,7 +483,7 @@ packages: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.9.2" + version: "0.9.3" flutter_layout_grid: dependency: transitive description: @@ -495,14 +502,14 @@ packages: name: flutter_math_fork url: "https://pub.dartlang.org" source: hosted - version: "0.6.1" + version: "0.6.3" flutter_mobx: dependency: "direct main" description: name: flutter_mobx url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.6+1" flutter_page_indicator: dependency: transitive description: @@ -516,7 +523,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.6" flutter_qr_scan: dependency: transitive description: @@ -530,14 +537,14 @@ packages: name: flutter_screenutil url: "https://pub.dartlang.org" source: hosted - version: "5.0.0+2" + version: "5.5.3+2" flutter_slidable: dependency: "direct overridden" description: name: flutter_slidable url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" flutter_staggered_grid_view: dependency: transitive description: @@ -551,7 +558,7 @@ packages: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.1.0" flutter_swiper: dependency: transitive description: @@ -575,14 +582,14 @@ packages: name: frontend_server_client url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" get: dependency: transitive description: name: get url: "https://pub.dartlang.org" source: hosted - version: "4.3.8" + version: "4.6.5" get_storage: dependency: "direct main" description: @@ -603,63 +610,63 @@ packages: name: gql url: "https://pub.dartlang.org" source: hosted - version: "0.13.0" + version: "0.13.1" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.2" gql_error_link: dependency: transitive description: name: gql_error_link url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.2" gql_exec: dependency: transitive description: name: gql_exec url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.0" gql_http_link: dependency: transitive description: name: gql_http_link url: "https://pub.dartlang.org" source: hosted - version: "0.4.0" + version: "0.4.2" gql_link: dependency: transitive description: name: gql_link url: "https://pub.dartlang.org" source: hosted - version: "0.4.0" + version: "0.4.2" gql_transform_link: dependency: transitive description: name: gql_transform_link url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.2" graphql: dependency: transitive description: name: graphql url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "5.1.1" graphql_flutter: dependency: transitive description: name: graphql_flutter url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "5.1.0" graphs: dependency: transitive description: @@ -673,7 +680,7 @@ packages: name: hive url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.2.1" html: dependency: transitive description: @@ -694,14 +701,14 @@ packages: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.2.0" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" http_server: dependency: transitive description: @@ -715,7 +722,7 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.0.8" + version: "3.2.0" image_picker: dependency: transitive description: @@ -729,14 +736,14 @@ packages: name: image_picker_for_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.8" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0" intl: dependency: transitive description: @@ -757,7 +764,7 @@ packages: name: jaguar url: "https://pub.dartlang.org" source: hosted - version: "3.0.12" + version: "3.1.3" jaguar_common: dependency: transitive description: @@ -776,8 +783,8 @@ packages: dependency: "direct main" description: path: "." - ref: a2ee9893ec9115a15bb25d4a59c7cbaa447e14b6 - resolved-ref: a2ee9893ec9115a15bb25d4a59c7cbaa447e14b6 + ref: "23e6265cb2de247e3b8fc3a225b71d1e8c02fcf9" + resolved-ref: "23e6265cb2de247e3b8fc3a225b71d1e8c02fcf9" url: "https://github.com/polkawallet-io/jpush-flutter-plugin.git" source: git version: "2.1.4" @@ -787,7 +794,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: "direct main" description: @@ -822,7 +829,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: @@ -836,14 +850,14 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.2" mobx: dependency: transitive description: name: mobx url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.7+2" mobx_codegen: dependency: "direct dev" description: @@ -864,14 +878,14 @@ packages: name: nm url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.5.0" normalize: dependency: transitive description: name: normalize url: "https://pub.dartlang.org" source: hosted - version: "0.5.5" + version: "0.6.0+1" numerus: dependency: transitive description: @@ -885,7 +899,7 @@ packages: name: octo_image url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.2" package_config: dependency: transitive description: @@ -906,7 +920,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_drawing: dependency: transitive description: @@ -927,35 +941,49 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.11" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.14" + path_provider_ios: + dependency: transitive + description: + name: path_provider_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.9" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.1.0" path_tree: dependency: transitive description: @@ -990,35 +1018,35 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "5.0.0" platform: - dependency: transitive + dependency: "direct overridden" description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.2" pointycastle: dependency: transitive description: name: pointycastle url: "https://pub.dartlang.org" source: hosted - version: "3.5.2" + version: "3.6.0" polkawallet_plugin_acala: dependency: "direct main" description: path: "../../coding/polkawallet/polkawallet_plugin_acala" relative: true source: path - version: "0.4.6" + version: "0.4.7" polkawallet_plugin_bifrost: dependency: "direct main" description: @@ -1061,7 +1089,7 @@ packages: path: "../../coding/polkawallet/polkawallet_plugin_karura" relative: true source: path - version: "0.4.6" + version: "0.4.7" polkawallet_plugin_kusama: dependency: "direct main" description: @@ -1100,14 +1128,14 @@ packages: path: "../../coding/polkawallet/sdk" relative: true source: path - version: "0.4.6" + version: "0.4.7" polkawallet_ui: dependency: "direct overridden" description: path: "../../coding/polkawallet/ui" relative: true source: path - version: "0.4.6" + version: "0.4.7" pool: dependency: transitive description: @@ -1128,14 +1156,14 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "6.0.2" + version: "6.0.3" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" pubspec_parse: dependency: transitive description: @@ -1163,21 +1191,21 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "3.0.1+1" + version: "3.1.0" rive: dependency: "direct dev" description: name: rive url: "https://pub.dartlang.org" source: hosted - version: "0.7.33" + version: "0.9.0" rxdart: dependency: transitive description: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.26.0" + version: "0.27.4" scrollable_positioned_list: dependency: transitive description: @@ -1191,21 +1219,35 @@ packages: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.0.15" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.12" + shared_preferences_ios: + dependency: transitive + description: + name: shared_preferences_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.1" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.4" shared_preferences_platform_interface: dependency: transitive description: @@ -1219,21 +1261,21 @@ packages: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.4" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.1" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" shelf_web_socket: dependency: transitive description: @@ -1280,21 +1322,21 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" sqflite: dependency: transitive description: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.2+1" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "2.0.1+1" + version: "2.2.1+1" stack_trace: dependency: transitive description: @@ -1350,7 +1392,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.9" timing: dependency: transitive description: @@ -1387,7 +1429,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" uni_links: dependency: "direct main" description: @@ -1412,9 +1454,11 @@ packages: update_app: dependency: "direct main" description: - name: update_app - url: "https://pub.dartlang.org" - source: hosted + path: "." + ref: c9e0f9ba9a7fe35aec0312847a4e481e4923cce1 + resolved-ref: c9e0f9ba9a7fe35aec0312847a4e481e4923cce1 + url: "https://github.com/mofada/flutter_update_app.git" + source: git version: "0.1.7" url_launcher: dependency: transitive @@ -1422,84 +1466,105 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.0.12" + version: "6.1.3" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.17" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.11" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "3.0.1" uuid: dependency: transitive description: name: uuid url: "https://pub.dartlang.org" source: hosted - version: "3.0.5" + version: "3.0.6" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" - very_good_analysis: + version: "2.1.2" + video_player: dependency: transitive description: - name: very_good_analysis + name: video_player url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" - video_player: + version: "2.4.4" + video_player_android: dependency: transitive description: - name: video_player + name: video_player_android url: "https://pub.dartlang.org" source: hosted - version: "2.2.17" + version: "2.3.6" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.5" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "5.1.3" video_player_web: dependency: transitive description: name: video_player_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.0.10" wakelock: dependency: transitive description: @@ -1555,7 +1620,7 @@ packages: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.2.0" webview_flutter: dependency: "direct overridden" description: @@ -1569,49 +1634,49 @@ packages: name: webview_flutter_android url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.8.11" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.9.1" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview url: "https://pub.dartlang.org" source: hosted - version: "2.7.1" + version: "2.8.1" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.2.10" + version: "2.7.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.0+1" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.3.1" + version: "6.1.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.1.1" sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index a22b75a2..81f2bea7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.2.8+3282 +version: 3.3.0+3303 environment: sdk: ">=2.10.0 <3.0.0" @@ -29,8 +29,7 @@ dependencies: json_annotation: ^4.0.1 # json_annotation: ^3.1.1 get_storage: ^2.0.2 - biometric_storage: ^2.0.2 - update_app: ^0.1.7 + biometric_storage: ^4.1.1 # device_info: ^2.0.1 package_info: ^2.0.2 uni_links: ^0.5.1 @@ -38,10 +37,14 @@ dependencies: firebase_analytics: 8.3.0 flutter_screenutil: ^5.0.0+2 # firebase_messaging: 10.0.5 + update_app: + git: + url: https://github.com/mofada/flutter_update_app.git + ref: c9e0f9ba9a7fe35aec0312847a4e481e4923cce1 jpush_flutter: git: url: https://github.com/polkawallet-io/jpush-flutter-plugin.git - ref: a2ee9893ec9115a15bb25d4a59c7cbaa447e14b6 + ref: 23e6265cb2de247e3b8fc3a225b71d1e8c02fcf9 polkawallet_plugin_kusama: git: url: https://github.com/polkawallet-io/polkawallet_plugin_kusama.git @@ -98,20 +101,20 @@ dependencies: sticky_headers: ^0.2.0 dependency_overrides: -# polkawallet_plugin_kusama: -# path: ../../coding/polkawallet/polkawallet_plugin_kusama -# polkawallet_plugin_acala: -# path: ../../coding/polkawallet/polkawallet_plugin_acala -# polkawallet_plugin_karura: -# path: ../../coding/polkawallet/polkawallet_plugin_karura -# polkawallet_plugin_statemine: -# path: ../../coding/polkawallet/polkawallet_plugin_statemine - polkawallet_ui: ^0.4.7 - polkawallet_sdk: ^0.4.7 -# polkawallet_ui: -# path: ../../coding/polkawallet/ui -# polkawallet_sdk: -# path: ../../coding/polkawallet/sdk + polkawallet_plugin_kusama: + path: ../../coding/polkawallet/polkawallet_plugin_kusama + polkawallet_plugin_acala: + path: ../../coding/polkawallet/polkawallet_plugin_acala + polkawallet_plugin_karura: + path: ../../coding/polkawallet/polkawallet_plugin_karura + polkawallet_plugin_statemine: + path: ../../coding/polkawallet/polkawallet_plugin_statemine +# polkawallet_ui: ^0.4.7 +# polkawallet_sdk: ^0.4.7 + polkawallet_ui: + path: ../../coding/polkawallet/ui + polkawallet_sdk: + path: ../../coding/polkawallet/sdk transformer_page_view: git: url: https://github.com/polkawallet-io/transformer_page_view.git @@ -125,6 +128,7 @@ dependency_overrides: cached_network_image: ^3.2.0 flutter_html: ^2.2.1 flutter_slidable: ^1.2.0 + platform: ^3.1.0 dev_dependencies: @@ -137,7 +141,7 @@ dev_dependencies: # mobx_codegen: ^1.1.1 # json_serializable: ^3.5.1 flutter_launcher_icons: ^0.9.0 - rive: ^0.7.33 + rive: ^0.9.0 flutter_icons: android: "launcher_icon"