diff --git a/.github/workflows/cache_dependencies.yml b/.github/workflows/cache_dependencies.yml index 4d2dc136c..d57281447 100644 --- a/.github/workflows/cache_dependencies.yml +++ b/.github/workflows/cache_dependencies.yml @@ -18,7 +18,7 @@ jobs: - name: Flutter action uses: subosito/flutter-action@v1 with: - flutter-version: '3.3.x' + flutter-version: '3.10.x' channel: stable - name: Install package dependencies diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 47378eef5..7f70ce755 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -28,7 +28,7 @@ jobs: - name: Flutter action uses: subosito/flutter-action@v1 with: - flutter-version: '3.7.x' + flutter-version: '3.10.x' channel: stable - name: Install package dependencies diff --git a/android/build.gradle b/android/build.gradle index 692e8dfb1..bd4ebd770 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -27,6 +27,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/cw_bitcoin/pubspec.yaml b/cw_bitcoin/pubspec.yaml index 481a41ac5..dae0af39b 100644 --- a/cw_bitcoin/pubspec.yaml +++ b/cw_bitcoin/pubspec.yaml @@ -13,16 +13,16 @@ dependencies: flutter: sdk: flutter path_provider: ^2.0.11 - http: ^0.13.4 + http: ^1.1.0 mobx: ^2.0.7+4 flutter_mobx: ^2.0.6+1 - intl: ^0.17.0 + intl: ^0.18.0 cw_core: path: ../cw_core bitcoin_flutter: git: url: https://github.com/cake-tech/bitcoin_flutter.git - ref: cake-update-v2 + ref: cake-update-v3 rxdart: ^0.27.5 unorm_dart: ^0.2.0 cryptography: ^2.0.5 diff --git a/cw_core/pubspec.yaml b/cw_core/pubspec.yaml index e33aeb803..9dcb7eaba 100644 --- a/cw_core/pubspec.yaml +++ b/cw_core/pubspec.yaml @@ -12,12 +12,12 @@ environment: dependencies: flutter: sdk: flutter - http: ^0.13.4 + http: ^1.1.0 file: ^6.1.4 path_provider: ^2.0.11 mobx: ^2.0.7+4 flutter_mobx: ^2.0.6+1 - intl: ^0.17.0 + intl: ^0.18.0 encrypt: ^5.0.1 dev_dependencies: diff --git a/cw_ethereum/lib/ethereum_client.dart b/cw_ethereum/lib/ethereum_client.dart index f00e2ef7b..7eba43aa7 100644 --- a/cw_ethereum/lib/ethereum_client.dart +++ b/cw_ethereum/lib/ethereum_client.dart @@ -9,7 +9,7 @@ import 'package:cw_ethereum/pending_ethereum_transaction.dart'; import 'package:flutter/services.dart'; import 'package:http/http.dart'; import 'package:web3dart/web3dart.dart'; -import 'package:web3dart/contracts/erc20.dart'; +import 'package:erc20/erc20.dart'; import 'package:cw_core/node.dart'; import 'package:cw_ethereum/ethereum_transaction_priority.dart'; import 'package:cw_ethereum/.secrets.g.dart' as secrets; @@ -72,7 +72,7 @@ class EthereumClient { to: EthereumAddress.fromHex(toAddress), maxGas: gas, gasPrice: price, - maxPriorityFeePerGas: EtherAmount.fromUnitAndValue(EtherUnit.gwei, priority.tip), + maxPriorityFeePerGas: EtherAmount.fromInt(EtherUnit.gwei, priority.tip), value: _isEthereum ? EtherAmount.inWei(BigInt.parse(amount)) : EtherAmount.zero(), ); @@ -83,7 +83,7 @@ class EthereumClient { if (_isEthereum) { _sendTransaction = () async => await sendTransaction(signedTransaction); } else { - final erc20 = Erc20( + final erc20 = ERC20( client: _client!, address: EthereumAddress.fromHex(contractAddress!), ); @@ -153,7 +153,7 @@ I/flutter ( 4474): Gas Used: 53000 Future fetchERC20Balances( EthereumAddress userAddress, String contractAddress) async { - final erc20 = Erc20(address: EthereumAddress.fromHex(contractAddress), client: _client!); + final erc20 = ERC20(address: EthereumAddress.fromHex(contractAddress), client: _client!); final balance = await erc20.balanceOf(userAddress); int exponent = (await erc20.decimals()).toInt(); @@ -163,7 +163,7 @@ I/flutter ( 4474): Gas Used: 53000 Future getErc20Token(String contractAddress) async { try { - final erc20 = Erc20(address: EthereumAddress.fromHex(contractAddress), client: _client!); + final erc20 = ERC20(address: EthereumAddress.fromHex(contractAddress), client: _client!); final name = await erc20.name(); final symbol = await erc20.symbol(); final decimal = await erc20.decimals(); diff --git a/cw_ethereum/pubspec.yaml b/cw_ethereum/pubspec.yaml index cb1046d5a..5d19589f3 100644 --- a/cw_ethereum/pubspec.yaml +++ b/cw_ethereum/pubspec.yaml @@ -12,13 +12,14 @@ environment: dependencies: flutter: sdk: flutter - web3dart: 2.3.5 + web3dart: ^2.7.1 + erc20: ^1.0.1 mobx: ^2.0.7+4 bip39: ^1.0.6 bip32: ^2.0.0 ed25519_hd_key: ^2.2.0 hex: ^0.2.0 - http: ^0.13.4 + http: ^1.1.0 shared_preferences: ^2.0.15 cw_core: path: ../cw_core diff --git a/cw_haven/pubspec.yaml b/cw_haven/pubspec.yaml index 7a5ac6aa4..c215ab779 100644 --- a/cw_haven/pubspec.yaml +++ b/cw_haven/pubspec.yaml @@ -13,11 +13,11 @@ dependencies: flutter: sdk: flutter ffi: ^2.0.1 - http: ^0.13.4 + http: ^1.1.0 path_provider: ^2.0.11 mobx: ^2.0.7+4 flutter_mobx: ^2.0.6+1 - intl: ^0.17.0 + intl: ^0.18.0 cw_core: path: ../cw_core diff --git a/cw_monero/pubspec.yaml b/cw_monero/pubspec.yaml index 066a0d4c3..cf2993ef3 100644 --- a/cw_monero/pubspec.yaml +++ b/cw_monero/pubspec.yaml @@ -13,11 +13,11 @@ dependencies: flutter: sdk: flutter ffi: ^2.0.1 - http: ^0.13.4 + http: ^1.1.0 path_provider: ^2.0.11 mobx: ^2.0.7+4 flutter_mobx: ^2.0.6+1 - intl: ^0.17.0 + intl: ^0.18.0 encrypt: ^5.0.1 cw_core: path: ../cw_core diff --git a/cw_shared_external/pubspec.yaml b/cw_shared_external/pubspec.yaml index b9a8ca1e0..71d5fcd5a 100644 --- a/cw_shared_external/pubspec.yaml +++ b/cw_shared_external/pubspec.yaml @@ -5,7 +5,7 @@ author: Cake Walelt homepage: https://cakewallet.com environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" flutter: ">=1.20.0" dependencies: diff --git a/howto-build-android.md b/howto-build-android.md index d37f1b417..a2a4e4d9f 100644 --- a/howto-build-android.md +++ b/howto-build-android.md @@ -5,10 +5,10 @@ The following are the system requirements to build CakeWallet for your Android device. ``` -Ubuntu >= 16.04 +Ubuntu >= 20.04 Android SDK 29 or higher (better to have the latest one 33) Android NDK 17c -Flutter 3.7.x +Flutter 3.10.x or earlier ``` ## Building CakeWallet on Android @@ -66,7 +66,7 @@ Verify that the Android toolchain, Flutter, and Android Studio have been correct The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. ``` Doctor summary (to see all details, run flutter doctor -v): -[✓] Flutter (Channel stable, 3.7.x, on Linux, locale en_US.UTF-8) +[✓] Flutter (Channel stable, 3.10.x, on Linux, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 29 or higher) [✓] Android Studio (version 4.0 or higher) ``` diff --git a/lib/core/generate_wallet_password.dart b/lib/core/generate_wallet_password.dart index c9a9fac57..93803dd9d 100644 --- a/lib/core/generate_wallet_password.dart +++ b/lib/core/generate_wallet_password.dart @@ -1,4 +1,3 @@ -import 'package:uuid/uuid.dart'; import 'package:cw_core/key.dart'; String generateWalletPassword() { diff --git a/lib/locales/hausa_intl.dart b/lib/locales/hausa_intl.dart index 35a13cdea..749d39a4d 100644 --- a/lib/locales/hausa_intl.dart +++ b/lib/locales/hausa_intl.dart @@ -736,6 +736,21 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations { @override String get keyboardKeySpace => 'Space'; + + @override + String get bottomSheetLabel => "Bottom Sheet"; + + @override + String get currentDateLabel => "Current Date"; + + @override + String get keyboardKeyShift => "Shift"; + + @override + String get scrimLabel => "Scrim"; + + @override + String get scrimOnTapHintRaw => "Scrip on Tap"; } /// Cupertino Support @@ -937,4 +952,7 @@ class HaCupertinoLocalizations extends GlobalCupertinoLocalizations { static const LocalizationsDelegate delegate = _HaCupertinoLocalizationsDelegate(); + + @override + String get noSpellCheckReplacementsLabel => ""; } diff --git a/lib/locales/yoruba_intl.dart b/lib/locales/yoruba_intl.dart index 974a3d22c..889c21cb7 100644 --- a/lib/locales/yoruba_intl.dart +++ b/lib/locales/yoruba_intl.dart @@ -736,6 +736,21 @@ String get keyboardKeyMetaWindows => 'Windows'; @override String get keyboardKeySpace => 'Space'; + + @override + String get bottomSheetLabel => "Bottom Sheet"; + + @override + String get currentDateLabel => "Current Date"; + + @override + String get keyboardKeyShift => "Shift"; + + @override + String get scrimLabel => "Scrim"; + + @override + String get scrimOnTapHintRaw => "Scrip on Tap"; } /// Cupertino Support @@ -937,4 +952,7 @@ String get todayLabel => 'Oyọ'; static const LocalizationsDelegate delegate = _YoCupertinoLocalizationsDelegate(); + + @override + String get noSpellCheckReplacementsLabel => ""; } diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index a1db0860b..68f5ca9aa 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -13,7 +13,6 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/yat_emoji_id.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; -import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; @@ -109,7 +108,7 @@ class _DashboardPageView extends BasePage { Widget trailing(BuildContext context) { final menuButton = Image.asset( 'assets/images/menu.png', - color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor, + color: Theme.of(context).extension()!.pageTitleTextColor, ); return Container( @@ -128,6 +127,7 @@ class _DashboardPageView extends BasePage { final DashboardViewModel dashboardViewModel; final WalletAddressListViewModel addressListViewModel; + int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0; ObservableList pages = ObservableList(); bool _isEffectsInstalled = false; diff --git a/lib/src/screens/dashboard/widgets/address_page.dart b/lib/src/screens/dashboard/widgets/address_page.dart index 9d97c4e4f..45ac3982e 100644 --- a/lib/src/screens/dashboard/widgets/address_page.dart +++ b/lib/src/screens/dashboard/widgets/address_page.dart @@ -1,5 +1,4 @@ import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; -import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/anonpay/anonpay_donation_link_info.dart'; import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/entities/receive_page_option.dart'; @@ -64,14 +63,6 @@ class AddressPage extends BasePage { @override Widget? leading(BuildContext context) { - final _backButton = Icon( - Icons.arrow_back_ios, - color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor!, - size: 16, - ); - final _closeButton = - currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage; - bool isMobileView = ResponsiveLayoutUtil.instance.isMobile; return MergeSemantics( @@ -119,11 +110,7 @@ class AddressPage extends BasePage { context: context, ); }, - icon: Icon( - Icons.share, - size: 20, - color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor!, - ), + icon: Icon(Icons.share, size: 20, color: pageIconColor(context)), ), ); } @@ -160,10 +147,10 @@ class AddressPage extends BasePage { return KeyboardActions( autoScroll: false, disableScroll: true, - tapOutsideToDismiss: true, + tapOutsideBehavior: TapOutsideBehavior.translucentDismiss, config: KeyboardActionsConfig( keyboardActionsPlatform: KeyboardActionsPlatform.IOS, - keyboardBarColor: Theme.of(context).accentTextTheme.bodyLarge!.backgroundColor!, + keyboardBarColor: Theme.of(context).extension()!.keyboardBarColor, nextFocus: false, actions: [ KeyboardActionsItem( diff --git a/lib/src/screens/exchange/exchange_page.dart b/lib/src/screens/exchange/exchange_page.dart index 98929a692..972fa0399 100644 --- a/lib/src/screens/exchange/exchange_page.dart +++ b/lib/src/screens/exchange/exchange_page.dart @@ -5,7 +5,6 @@ import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/desktop_exchange_cards_section.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/mobile_exchange_cards_section.dart'; import 'package:cake_wallet/src/widgets/add_template_button.dart'; -import 'package:cake_wallet/themes/extensions/send_page_theme.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/utils/debounce.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart'; @@ -250,7 +249,7 @@ class ExchangePage extends BasePage { } } }, - color: Theme.of(context).accentTextTheme.bodyLarge!.color!, + color: Theme.of(context).primaryColor, textColor: Colors.white, isDisabled: exchangeViewModel.selectedProviders.isEmpty, isLoading: exchangeViewModel.tradeState is TradeIsCreating)), diff --git a/lib/src/screens/restore/widgets/restore_button.dart b/lib/src/screens/restore/widgets/restore_button.dart index 221dc37a2..c196de059 100644 --- a/lib/src/screens/restore/widgets/restore_button.dart +++ b/lib/src/screens/restore/widgets/restore_button.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart'; @@ -24,7 +25,7 @@ class RestoreButton extends StatelessWidget { alignment: Alignment.topLeft, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(12)), - color: Theme.of(context).accentTextTheme.bodySmall!.color!, + color: Theme.of(context).cardColor, ), child: Row( mainAxisSize: MainAxisSize.max, @@ -43,24 +44,22 @@ class RestoreButton extends StatelessWidget { Text( title, style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .primaryTextTheme - .titleLarge! - .color!), + fontSize: 16, + fontWeight: FontWeight.w500, + color: Theme.of(context).extension()!.titleColor, + ), ), Padding( padding: EdgeInsets.only(top: 5), child: Text( description, style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - color: Theme.of(context) - .primaryTextTheme - .labelSmall! - .color!), + fontSize: 14, + fontWeight: FontWeight.normal, + color: Theme.of(context) + .extension()! + .detailsTitlesColor, + ), ), ) ], diff --git a/lib/src/screens/seed/pre_seed_page.dart b/lib/src/screens/seed/pre_seed_page.dart index a2916d642..a73e7bbff 100644 --- a/lib/src/screens/seed/pre_seed_page.dart +++ b/lib/src/screens/seed/pre_seed_page.dart @@ -6,8 +6,6 @@ import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/themes/theme_base.dart'; -import 'package:cake_wallet/utils/responsive_layout_util.dart'; -import 'package:cw_core/wallet_type.dart'; import 'package:flutter/material.dart'; class PreSeedPage extends BasePage { @@ -62,7 +60,7 @@ class PreSeedPage extends BasePage { onPressed: () => Navigator.of(context).popAndPushNamed(Routes.seed, arguments: true), text: S.of(context).pre_seed_button_text, - color: Theme.of(context).accentTextTheme.bodyLarge!.color!, + color: Theme.of(context).primaryColor, textColor: Colors.white) ], ), diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index dab78f3ef..4a2559902 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -208,14 +208,8 @@ class SendPage extends BasePage { radius: 6.0, dotWidth: 6.0, dotHeight: 6.0, - dotColor: Theme.of(context) - .primaryTextTheme! - .displaySmall! - .backgroundColor!, - activeDotColor: Theme.of(context) - .primaryTextTheme! - .displayMedium! - .backgroundColor!), + dotColor: Theme.of(context).extension()!.indicatorDotColor, + activeDotColor: Theme.of(context).extension()!.templateBackgroundColor), ) : Offstage(); }, @@ -340,10 +334,7 @@ class SendPage extends BasePage { text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})', color: Colors.transparent, - textColor: Theme.of(context) - .accentTextTheme! - .displaySmall! - .decorationColor!, + textColor: Theme.of(context).extension()!.hintTextColor, ))), if (sendViewModel.sendTemplateViewModel.hasMultiRecipient) Padding( @@ -358,15 +349,9 @@ class SendPage extends BasePage { }, text: S.of(context).add_receiver, color: Colors.transparent, - textColor: Theme.of(context) - .accentTextTheme! - .displaySmall! - .decorationColor!, + textColor: Theme.of(context).extension()!.hintTextColor, isDottedBorder: true, - borderColor: Theme.of(context) - .primaryTextTheme! - .displaySmall! - .decorationColor!, + borderColor: Theme.of(context).extension()!.templateDottedBorderColor, )), Observer( builder: (_) { @@ -387,7 +372,7 @@ class SendPage extends BasePage { item.cryptoAmount.isEmpty) .toList(); - if (notValidItems.isNotEmpty ?? false) { + if (notValidItems.isNotEmpty) { showErrorValidationAlert(context); return; } diff --git a/lib/src/screens/send/widgets/send_card.dart b/lib/src/screens/send/widgets/send_card.dart index 5e5bf44d3..4b2cddeb7 100644 --- a/lib/src/screens/send/widgets/send_card.dart +++ b/lib/src/screens/send/widgets/send_card.dart @@ -167,8 +167,8 @@ class SendCardState extends State with AutomaticKeepAliveClientMixin()!.textFieldButtonColor, + borderColor: Theme.of(context).extension()!.textFieldBorderColor, textStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), hintStyle: TextStyle( @@ -403,14 +403,11 @@ class SendCardState extends State with AutomaticKeepAliveClientMixin()!.textFieldBorderColor, textStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), placeholderTextStyle: TextStyle( - color: Theme.of(context) - .primaryTextTheme - .headlineSmall! - .decorationColor!, + color: Theme.of(context).extension()!.textFieldHintColor, fontWeight: FontWeight.w500, fontSize: 14), ), @@ -421,7 +418,7 @@ class SendCardState extends State with AutomaticKeepAliveClientMixin()!.textFieldBorderColor, textStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), hintText: S.of(context).note_optional, diff --git a/lib/src/screens/settings/widgets/settings_choices_cell.dart b/lib/src/screens/settings/widgets/settings_choices_cell.dart index 4d4addb99..aea5ecbb9 100644 --- a/lib/src/screens/settings/widgets/settings_choices_cell.dart +++ b/lib/src/screens/settings/widgets/settings_choices_cell.dart @@ -59,7 +59,7 @@ class SettingsChoicesCell extends StatelessWidget { style: TextStyle( color: isSelected ? Colors.white - : Theme.of(context).primaryTextTheme.bodySmall!.color!, + : Theme.of(context).extension()!.secondaryTextColor, fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal, ), ), diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index 2fcc491f0..fd7952628 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -1,10 +1,8 @@ import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/core/auth_service.dart'; -import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/themes/extensions/receive_page_theme.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/show_bar.dart'; -import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart'; import 'package:another_flushbar/flushbar.dart'; import 'package:flutter/material.dart'; @@ -66,106 +64,110 @@ class WalletListBodyState extends State { return Container( padding: EdgeInsets.only(top: 16), child: ScrollableWithBottomSection( - contentPadding: EdgeInsets.only(bottom: 20), - content: Container( - child: Observer( - builder: (_) => ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - separatorBuilder: (_, index) => - Divider(color: Theme.of(context).colorScheme.background, height: 32), - itemCount: widget.walletListViewModel.wallets.length, - itemBuilder: (__, index) { - final wallet = widget.walletListViewModel.wallets[index]; - final currentColor = wallet.isCurrent - ? Theme.of(context) - .extension()! - .createNewWalletButtonBackgroundColor - : Theme.of(context).colorScheme.background; - final row = GestureDetector( - onTap: () => wallet.isCurrent ? null : _loadWallet(wallet), - child: Container( + contentPadding: EdgeInsets.only(bottom: 20), + content: Container( + child: Observer( + builder: (_) => ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + separatorBuilder: (_, index) => + Divider(color: Theme.of(context).colorScheme.background, height: 32), + itemCount: widget.walletListViewModel.wallets.length, + itemBuilder: (__, index) { + final wallet = widget.walletListViewModel.wallets[index]; + final currentColor = wallet.isCurrent + ? Theme.of(context) + .extension()! + .createNewWalletButtonBackgroundColor + : Theme.of(context).colorScheme.background; + final row = GestureDetector( + onTap: () => wallet.isCurrent ? null : _loadWallet(wallet), + child: Container( + height: tileHeight, + width: double.infinity, + child: Row( + children: [ + Container( height: tileHeight, - width: double.infinity, - child: Row( - children: [ - Container( - height: tileHeight, - width: 4, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topRight: Radius.circular(4), - bottomRight: Radius.circular(4)), - color: currentColor), - ), - Expanded( - child: Container( - height: tileHeight, - padding: EdgeInsets.only(left: 20, right: 20), - color: Theme.of(context).colorScheme.background, - alignment: Alignment.centerLeft, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - wallet.isEnabled - ? _imageFor(type: wallet.type) - : nonWalletTypeIcon, - SizedBox(width: 10), - Flexible( - child: Text( - wallet.name, - maxLines: null, - softWrap: true, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .extension()! - .titleColor), - )) - ]), - ), - ), - ], - ), - )); - - return wallet.isCurrent - ? row - : Row(children: [ - Expanded(child: row), - GestureDetector( - onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit, - arguments: [widget.walletListViewModel, wallet]), - child: Container( - padding: EdgeInsets.only(right: 20), - child: Center( - child: Container( - height: 40, - width: 44, - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Theme.of(context) - .extension()! - .iconsBackgroundColor), - child: Icon( - Icons.edit, - size: 14, - color: Theme.of(context) - .extension()! - .iconsColor, + width: 4, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topRight: Radius.circular(4), bottomRight: Radius.circular(4)), + color: currentColor), + ), + Expanded( + child: Container( + height: tileHeight, + padding: EdgeInsets.only(left: 20, right: 20), + color: Theme.of(context).colorScheme.background, + alignment: Alignment.centerLeft, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + wallet.isEnabled ? _imageFor(type: wallet.type) : nonWalletTypeIcon, + SizedBox(width: 10), + Flexible( + child: Text( + wallet.name, + maxLines: null, + softWrap: true, + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.w500, + color: + Theme.of(context).extension()!.titleColor, ), ), ), + ], + ), + ), + ), + ], + ), + ), + ); + + return wallet.isCurrent + ? row + : Row( + children: [ + Expanded(child: row), + GestureDetector( + onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit, + arguments: [widget.walletListViewModel, wallet]), + child: Container( + padding: EdgeInsets.only(right: 20), + child: Center( + child: Container( + height: 40, + width: 44, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Theme.of(context) + .extension()! + .iconsBackgroundColor, + ), + child: Icon( + Icons.edit, + size: 14, + color: + Theme.of(context).extension()!.iconsColor, + ), + ), ), - ) - ]); - }), + ), + ), + ], + ); + }, ), ), - bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24), - bottomSection: Column(children: [ + ), + bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24), + bottomSection: Column( + children: [ PrimaryImageButton( onPressed: () { //TODO(David): Find a way to optimize this @@ -199,29 +201,32 @@ class WalletListBodyState extends State { }, image: newWalletImage, text: S.of(context).wallet_list_create_new_wallet, - color: Theme.of(context).accentTextTheme.bodyLarge!.color!, + color: Theme.of(context).primaryColor, textColor: Colors.white, ), SizedBox(height: 10.0), PrimaryImageButton( - onPressed: () { - if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) { - widget.authService.authenticateAction( - context, - route: Routes.restoreOptions, - arguments: false, - conditionToDetermineIfToUse2FA: - widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets, - ); - } else { - Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false); - } - }, - image: restoreWalletImage, - text: S.of(context).wallet_list_restore_wallet, - color: Theme.of(context).accentTextTheme.bodySmall!.color!, - textColor: Theme.of(context).primaryTextTheme.titleLarge!.color!) - ])), + onPressed: () { + if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) { + widget.authService.authenticateAction( + context, + route: Routes.restoreOptions, + arguments: false, + conditionToDetermineIfToUse2FA: + widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets, + ); + } else { + Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false); + } + }, + image: restoreWalletImage, + text: S.of(context).wallet_list_restore_wallet, + color: Theme.of(context).cardColor, + textColor: Theme.of(context).extension()!.buttonTextColor, + ) + ], + ), + ), ); } diff --git a/lib/src/widgets/standard_list.dart b/lib/src/widgets/standard_list.dart index 530d3969c..c1fcae052 100644 --- a/lib/src/widgets/standard_list.dart +++ b/lib/src/widgets/standard_list.dart @@ -72,7 +72,10 @@ class SectionHeaderListRow extends StatelessWidget { Widget build(BuildContext context) => Column(children: [ StandardListSeparator(padding: EdgeInsets.only(left: 24)), Container( - width: double.infinity, height: 40, color: Theme.of(context).colorScheme.background), + width: double.infinity, + height: 40, + color: Theme.of(context).colorScheme.background, + ), //StandardListSeparator(padding: EdgeInsets.only(left: 24)) ]); } @@ -86,11 +89,14 @@ class StandardListSeparator extends StatelessWidget { @override Widget build(BuildContext context) { return Container( + height: height, + padding: padding, + color: Theme.of(context).colorScheme.background, + child: Container( height: height, - padding: padding, - color: Theme.of(context).colorScheme.background, - child: Container( - height: height, color: Theme.of(context).primaryTextTheme.titleLarge?.backgroundColor)); + color: Theme.of(context).extension()!.textfieldUnderlineColor, + ), + ); } } diff --git a/pubspec_base.yaml b/pubspec_base.yaml index ce7d04b3f..51cfe4b26 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -3,14 +3,13 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - intl: ^0.17.0 + intl: ^0.18.0 url_launcher: ^6.1.4 qr_flutter: git: url: https://github.com/cake-tech/qr.flutter.git ref: cake-4.0.2 version: 4.0.2 - uuid: 3.0.6 shared_preferences: ^2.0.15 flutter_secure_storage: git: @@ -23,7 +22,7 @@ dependencies: yaml: ^3.1.1 #barcode_scan: any barcode_scan2: ^4.2.1 - http: ^0.13.4 + http: ^1.1.0 path_provider: ^2.0.11 mobx: ^2.1.4 flutter_mobx: ^2.0.6+5 @@ -53,7 +52,7 @@ dependencies: encrypt: ^5.0.1 crypto: ^3.0.2 # password: ^1.0.0 - basic_utils: ^4.3.0 + basic_utils: ^5.6.1 get_it: ^7.2.0 # connectivity: ^3.0.3 connectivity_plus: ^2.3.5 @@ -86,13 +85,13 @@ dependencies: bitcoin_flutter: git: url: https://github.com/cake-tech/bitcoin_flutter.git - ref: cake-update-v2 + ref: cake-update-v3 dev_dependencies: flutter_test: sdk: flutter build_runner: ^2.3.3 - logging: 1.1.1 + logging: ^1.2.0 mobx_codegen: ^2.1.1 build_resolvers: ^2.0.9 hive_generator: ^1.1.3 @@ -100,7 +99,7 @@ dev_dependencies: # check flutter_launcher_icons for usage pedantic: ^1.8.0 # replace https://github.com/dart-lang/lints#migrating-from-packagepedantic - translator: ^0.1.7 +# translator: ^0.1.7 flutter_icons: image_path: "assets/images/app_logo.png" diff --git a/tool/append_translation.dart b/tool/append_translation.dart index e56ad89d6..080b2c5e7 100644 --- a/tool/append_translation.dart +++ b/tool/append_translation.dart @@ -1,66 +1,66 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:translator/translator.dart'; - -const defaultLang = "en"; -const langs = [ - "ar", "bg", "cs", "de", "en", "es", "fr", "ha", "hi", "hr", "id", "it", - "ja", "ko", "my", "nl", "pl", "pt", "ru", "th", "tr", "uk", "ur", "yo", - "zh-cn" // zh, but Google Translate uses zh-cn for Chinese (Simplified) -]; -final translator = GoogleTranslator(); - -void main(List args) async { - if (args.length != 2) { - throw Exception( - 'Insufficient arguments!\n\nTry to run `./append_translation.dart greetings "Hello World!"`'); - } - - final name = args.first; - final text = args.last; - - print('Appending "$name": "$text"'); - - for (var lang in langs) { - final fileName = getFileName(lang); - final translation = await getTranslation(text, lang); - - appendArbFile(fileName, name, translation); - } -} - -void appendArbFile(String fileName, String name, String text) { - final file = File(fileName); - final inputContent = file.readAsStringSync(); - final arbObj = json.decode(inputContent) as Map; - - if (arbObj.containsKey(name)) { - print("String $name already exists in $fileName!"); - return; - } - - arbObj.addAll({name: text}); - - final outputContent = json - .encode(arbObj) - .replaceAll('","', '",\n "') - .replaceAll('{"', '{\n "') - .replaceAll('"}', '"\n}') - .replaceAll('":"', '": "'); - - file.writeAsStringSync(outputContent); -} - - -Future getTranslation(String text, String lang) async { - if (lang == defaultLang) return text; - return (await translator.translate(text, from: defaultLang, to: lang)).text; -} - -String getFileName(String lang) { - final shortLang = lang - .split("-") - .first; - return "./res/values/strings_$shortLang.arb"; -} +// import 'dart:convert'; +// import 'dart:io'; +// +// import 'package:translator/translator.dart'; +// +// const defaultLang = "en"; +// const langs = [ +// "ar", "bg", "cs", "de", "en", "es", "fr", "ha", "hi", "hr", "id", "it", +// "ja", "ko", "my", "nl", "pl", "pt", "ru", "th", "tr", "uk", "ur", "yo", +// "zh-cn" // zh, but Google Translate uses zh-cn for Chinese (Simplified) +// ]; +// final translator = GoogleTranslator(); +// +// void main(List args) async { +// if (args.length != 2) { +// throw Exception( +// 'Insufficient arguments!\n\nTry to run `./append_translation.dart greetings "Hello World!"`'); +// } +// +// final name = args.first; +// final text = args.last; +// +// print('Appending "$name": "$text"'); +// +// for (var lang in langs) { +// final fileName = getFileName(lang); +// final translation = await getTranslation(text, lang); +// +// appendArbFile(fileName, name, translation); +// } +// } +// +// void appendArbFile(String fileName, String name, String text) { +// final file = File(fileName); +// final inputContent = file.readAsStringSync(); +// final arbObj = json.decode(inputContent) as Map; +// +// if (arbObj.containsKey(name)) { +// print("String $name already exists in $fileName!"); +// return; +// } +// +// arbObj.addAll({name: text}); +// +// final outputContent = json +// .encode(arbObj) +// .replaceAll('","', '",\n "') +// .replaceAll('{"', '{\n "') +// .replaceAll('"}', '"\n}') +// .replaceAll('":"', '": "'); +// +// file.writeAsStringSync(outputContent); +// } +// +// +// Future getTranslation(String text, String lang) async { +// if (lang == defaultLang) return text; +// return (await translator.translate(text, from: defaultLang, to: lang)).text; +// } +// +// String getFileName(String lang) { +// final shortLang = lang +// .split("-") +// .first; +// return "./res/values/strings_$shortLang.arb"; +// } diff --git a/tool/localization/localization_constants.dart b/tool/localization/localization_constants.dart index 0ccbd380b..326ff2c13 100644 --- a/tool/localization/localization_constants.dart +++ b/tool/localization/localization_constants.dart @@ -27,6 +27,24 @@ class S implements WidgetsLocalizations { GeneratedLocalizationsDelegate(); static S of(BuildContext context) => Localizations.of(context, S)!; + + @override + String get reorderItemToStart => "reorderItemToStart"; + + @override + String get reorderItemToEnd => "reorderItemToEnd"; + + @override + String get reorderItemUp => "reorderItemUp"; + + @override + String get reorderItemDown => "reorderItemDown"; + + @override + String get reorderItemLeft => "reorderItemLeft"; + + @override + String get reorderItemRight => "reorderItemRight"; """; const part2 = """