Flutter update (#1048)

* Update Flutter Update packages * Fix localization issues Fix UI issues Update old packages Update workflow Update how to build guide * Additional UI fixes for merged conflicts

Omar Hatem committed Aug 18, 2023 at 18:37 UTC 9ddab2b4723e94251887d7567ac6367503772be7
27 files changed +309 -280
.github/workflows/cache_dependencies.yml
+1 -1
@@ -18,7 +18,7 @@ jobs:
18 - name: Flutter action
19 uses: subosito/flutter-action@v1
20 with:
21 - flutter-version: '3.3.x'
21 + flutter-version: '3.10.x'
22 channel: stable
23
24 - name: Install package dependencies
.github/workflows/pr_test_build.yml
+1 -1
@@ -28,7 +28,7 @@ jobs:
28 - name: Flutter action
29 uses: subosito/flutter-action@v1
30 with:
31 - flutter-version: '3.7.x'
31 + flutter-version: '3.10.x'
32 channel: stable
33
34 - name: Install package dependencies
android/build.gradle
+1 -1
@@ -27,6 +27,6 @@ subprojects {
27 project.evaluationDependsOn(':app')
28 }
29
30 -task clean(type: Delete) {
30 +tasks.register("clean", Delete) {
31 delete rootProject.buildDir
32 }
cw_bitcoin/pubspec.yaml
+3 -3
@@ -13,16 +13,16 @@ dependencies:
13 flutter:
14 sdk: flutter
15 path_provider: ^2.0.11
16 - http: ^0.13.4
16 + http: ^1.1.0
17 mobx: ^2.0.7+4
18 flutter_mobx: ^2.0.6+1
19 - intl: ^0.17.0
19 + intl: ^0.18.0
20 cw_core:
21 path: ../cw_core
22 bitcoin_flutter:
23 git:
24 url: https://github.com/cake-tech/bitcoin_flutter.git
25 - ref: cake-update-v2
25 + ref: cake-update-v3
26 rxdart: ^0.27.5
27 unorm_dart: ^0.2.0
28 cryptography: ^2.0.5
cw_core/pubspec.yaml
+2 -2
@@ -12,12 +12,12 @@ environment:
12 dependencies:
13 flutter:
14 sdk: flutter
15 - http: ^0.13.4
15 + http: ^1.1.0
16 file: ^6.1.4
17 path_provider: ^2.0.11
18 mobx: ^2.0.7+4
19 flutter_mobx: ^2.0.6+1
20 - intl: ^0.17.0
20 + intl: ^0.18.0
21 encrypt: ^5.0.1
22
23 dev_dependencies:
cw_ethereum/lib/ethereum_client.dart
+5 -5
@@ -9,7 +9,7 @@ import 'package:cw_ethereum/pending_ethereum_transaction.dart';
9 import 'package:flutter/services.dart';
10 import 'package:http/http.dart';
11 import 'package:web3dart/web3dart.dart';
12 -import 'package:web3dart/contracts/erc20.dart';
12 +import 'package:erc20/erc20.dart';
13 import 'package:cw_core/node.dart';
14 import 'package:cw_ethereum/ethereum_transaction_priority.dart';
15 import 'package:cw_ethereum/.secrets.g.dart' as secrets;
@@ -72,7 +72,7 @@ class EthereumClient {
72 to: EthereumAddress.fromHex(toAddress),
73 maxGas: gas,
74 gasPrice: price,
75 - maxPriorityFeePerGas: EtherAmount.fromUnitAndValue(EtherUnit.gwei, priority.tip),
75 + maxPriorityFeePerGas: EtherAmount.fromInt(EtherUnit.gwei, priority.tip),
76 value: _isEthereum ? EtherAmount.inWei(BigInt.parse(amount)) : EtherAmount.zero(),
77 );
78
@@ -83,7 +83,7 @@ class EthereumClient {
83 if (_isEthereum) {
84 _sendTransaction = () async => await sendTransaction(signedTransaction);
85 } else {
86 - final erc20 = Erc20(
86 + final erc20 = ERC20(
87 client: _client!,
88 address: EthereumAddress.fromHex(contractAddress!),
89 );
@@ -153,7 +153,7 @@ I/flutter ( 4474): Gas Used: 53000
153
154 Future<ERC20Balance> fetchERC20Balances(
155 EthereumAddress userAddress, String contractAddress) async {
156 - final erc20 = Erc20(address: EthereumAddress.fromHex(contractAddress), client: _client!);
156 + final erc20 = ERC20(address: EthereumAddress.fromHex(contractAddress), client: _client!);
157 final balance = await erc20.balanceOf(userAddress);
158
159 int exponent = (await erc20.decimals()).toInt();
@@ -163,7 +163,7 @@ I/flutter ( 4474): Gas Used: 53000
163
164 Future<Erc20Token?> getErc20Token(String contractAddress) async {
165 try {
166 - final erc20 = Erc20(address: EthereumAddress.fromHex(contractAddress), client: _client!);
166 + final erc20 = ERC20(address: EthereumAddress.fromHex(contractAddress), client: _client!);
167 final name = await erc20.name();
168 final symbol = await erc20.symbol();
169 final decimal = await erc20.decimals();
cw_ethereum/pubspec.yaml
+3 -2
@@ -12,13 +12,14 @@ environment:
12 dependencies:
13 flutter:
14 sdk: flutter
15 - web3dart: 2.3.5
15 + web3dart: ^2.7.1
16 + erc20: ^1.0.1
17 mobx: ^2.0.7+4
18 bip39: ^1.0.6
19 bip32: ^2.0.0
20 ed25519_hd_key: ^2.2.0
21 hex: ^0.2.0
21 - http: ^0.13.4
22 + http: ^1.1.0
23 shared_preferences: ^2.0.15
24 cw_core:
25 path: ../cw_core
cw_haven/pubspec.yaml
+2 -2
@@ -13,11 +13,11 @@ dependencies:
13 flutter:
14 sdk: flutter
15 ffi: ^2.0.1
16 - http: ^0.13.4
16 + http: ^1.1.0
17 path_provider: ^2.0.11
18 mobx: ^2.0.7+4
19 flutter_mobx: ^2.0.6+1
20 - intl: ^0.17.0
20 + intl: ^0.18.0
21 cw_core:
22 path: ../cw_core
23
cw_monero/pubspec.yaml
+2 -2
@@ -13,11 +13,11 @@ dependencies:
13 flutter:
14 sdk: flutter
15 ffi: ^2.0.1
16 - http: ^0.13.4
16 + http: ^1.1.0
17 path_provider: ^2.0.11
18 mobx: ^2.0.7+4
19 flutter_mobx: ^2.0.6+1
20 - intl: ^0.17.0
20 + intl: ^0.18.0
21 encrypt: ^5.0.1
22 cw_core:
23 path: ../cw_core
cw_shared_external/pubspec.yaml
+1 -1
@@ -5,7 +5,7 @@ author: Cake Walelt
5 homepage: https://cakewallet.com
6
7 environment:
8 - sdk: ">=2.7.0 <3.0.0"
8 + sdk: ">=2.12.0 <3.0.0"
9 flutter: ">=1.20.0"
10
11 dependencies:
howto-build-android.md
+3 -3
@@ -5,10 +5,10 @@
5 The following are the system requirements to build CakeWallet for your Android device.
6
7 ```
8 -Ubuntu >= 16.04
8 +Ubuntu >= 20.04
9 Android SDK 29 or higher (better to have the latest one 33)
10 Android NDK 17c
11 -Flutter 3.7.x
11 +Flutter 3.10.x or earlier
12 ```
13
14 ## Building CakeWallet on Android
@@ -66,7 +66,7 @@ Verify that the Android toolchain, Flutter, and Android Studio have been correct
66 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.
67 ```
68 Doctor summary (to see all details, run flutter doctor -v):
69 -[✓] Flutter (Channel stable, 3.7.x, on Linux, locale en_US.UTF-8)
69 +[✓] Flutter (Channel stable, 3.10.x, on Linux, locale en_US.UTF-8)
70 [✓] Android toolchain - develop for Android devices (Android SDK version 29 or higher)
71 [✓] Android Studio (version 4.0 or higher)
72 ```
lib/core/generate_wallet_password.dart
-1
@@ -1,4 +1,3 @@
1 -import 'package:uuid/uuid.dart';
1 import 'package:cw_core/key.dart';
2
3 String generateWalletPassword() {
lib/locales/hausa_intl.dart
+18
@@ -736,6 +736,21 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations {
736
737 @override
738 String get keyboardKeySpace => 'Space';
739 +
740 + @override
741 + String get bottomSheetLabel => "Bottom Sheet";
742 +
743 + @override
744 + String get currentDateLabel => "Current Date";
745 +
746 + @override
747 + String get keyboardKeyShift => "Shift";
748 +
749 + @override
750 + String get scrimLabel => "Scrim";
751 +
752 + @override
753 + String get scrimOnTapHintRaw => "Scrip on Tap";
754 }
755
756 /// Cupertino Support
@@ -937,4 +952,7 @@ class HaCupertinoLocalizations extends GlobalCupertinoLocalizations {
952
953 static const LocalizationsDelegate<CupertinoLocalizations> delegate =
954 _HaCupertinoLocalizationsDelegate();
955 +
956 + @override
957 + String get noSpellCheckReplacementsLabel => "";
958 }
lib/locales/yoruba_intl.dart
+18
@@ -736,6 +736,21 @@ String get keyboardKeyMetaWindows => 'Windows';
736
737 @override
738 String get keyboardKeySpace => 'Space';
739 +
740 + @override
741 + String get bottomSheetLabel => "Bottom Sheet";
742 +
743 + @override
744 + String get currentDateLabel => "Current Date";
745 +
746 + @override
747 + String get keyboardKeyShift => "Shift";
748 +
749 + @override
750 + String get scrimLabel => "Scrim";
751 +
752 + @override
753 + String get scrimOnTapHintRaw => "Scrip on Tap";
754 }
755
756 /// Cupertino Support
@@ -937,4 +952,7 @@ String get todayLabel => 'Oyọ';
952
953 static const LocalizationsDelegate<CupertinoLocalizations> delegate =
954 _YoCupertinoLocalizationsDelegate();
955 +
956 + @override
957 + String get noSpellCheckReplacementsLabel => "";
958 }
lib/src/screens/dashboard/dashboard_page.dart
+2 -2
@@ -13,7 +13,6 @@ import 'package:cake_wallet/generated/i18n.dart';
13 import 'package:cake_wallet/routes.dart';
14 import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
15 import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
16 -import 'package:cake_wallet/themes/theme_base.dart';
16 import 'package:cake_wallet/utils/responsive_layout_util.dart';
17 import 'package:cake_wallet/utils/show_pop_up.dart';
18 import 'package:flutter/material.dart';
@@ -109,7 +108,7 @@ class _DashboardPageView extends BasePage {
108 Widget trailing(BuildContext context) {
109 final menuButton = Image.asset(
110 'assets/images/menu.png',
112 - color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor,
111 + color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
112 );
113
114 return Container(
@@ -128,6 +127,7 @@ class _DashboardPageView extends BasePage {
127
128 final DashboardViewModel dashboardViewModel;
129 final WalletAddressListViewModel addressListViewModel;
130 +
131 int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0;
132 ObservableList<Widget> pages = ObservableList<Widget>();
133 bool _isEffectsInstalled = false;
lib/src/screens/dashboard/widgets/address_page.dart
+3 -16
@@ -1,5 +1,4 @@
1 import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
2 -import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
2 import 'package:cake_wallet/anonpay/anonpay_donation_link_info.dart';
3 import 'package:cake_wallet/entities/preferences_key.dart';
4 import 'package:cake_wallet/entities/receive_page_option.dart';
@@ -64,14 +63,6 @@ class AddressPage extends BasePage {
63
64 @override
65 Widget? leading(BuildContext context) {
67 - final _backButton = Icon(
68 - Icons.arrow_back_ios,
69 - color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor!,
70 - size: 16,
71 - );
72 - final _closeButton =
73 - currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
74 -
66 bool isMobileView = ResponsiveLayoutUtil.instance.isMobile;
67
68 return MergeSemantics(
@@ -119,11 +110,7 @@ class AddressPage extends BasePage {
110 context: context,
111 );
112 },
122 - icon: Icon(
123 - Icons.share,
124 - size: 20,
125 - color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor!,
126 - ),
113 + icon: Icon(Icons.share, size: 20, color: pageIconColor(context)),
114 ),
115 );
116 }
@@ -160,10 +147,10 @@ class AddressPage extends BasePage {
147 return KeyboardActions(
148 autoScroll: false,
149 disableScroll: true,
163 - tapOutsideToDismiss: true,
150 + tapOutsideBehavior: TapOutsideBehavior.translucentDismiss,
151 config: KeyboardActionsConfig(
152 keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
166 - keyboardBarColor: Theme.of(context).accentTextTheme.bodyLarge!.backgroundColor!,
153 + keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
154 nextFocus: false,
155 actions: [
156 KeyboardActionsItem(
lib/src/screens/exchange/exchange_page.dart
+1 -2
@@ -5,7 +5,6 @@ import 'package:cake_wallet/di.dart';
5 import 'package:cake_wallet/src/screens/exchange/widgets/desktop_exchange_cards_section.dart';
6 import 'package:cake_wallet/src/screens/exchange/widgets/mobile_exchange_cards_section.dart';
7 import 'package:cake_wallet/src/widgets/add_template_button.dart';
8 -import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
8 import 'package:cake_wallet/themes/theme_base.dart';
9 import 'package:cake_wallet/utils/debounce.dart';
10 import 'package:cake_wallet/utils/responsive_layout_util.dart';
@@ -250,7 +249,7 @@ class ExchangePage extends BasePage {
249 }
250 }
251 },
253 - color: Theme.of(context).accentTextTheme.bodyLarge!.color!,
252 + color: Theme.of(context).primaryColor,
253 textColor: Colors.white,
254 isDisabled: exchangeViewModel.selectedProviders.isEmpty,
255 isLoading: exchangeViewModel.tradeState is TradeIsCreating)),
lib/src/screens/restore/widgets/restore_button.dart
+12 -13
@@ -1,3 +1,4 @@
1 +import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
2 import 'package:flutter/material.dart';
3 import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
4
@@ -24,7 +25,7 @@ class RestoreButton extends StatelessWidget {
25 alignment: Alignment.topLeft,
26 decoration: BoxDecoration(
27 borderRadius: BorderRadius.all(Radius.circular(12)),
27 - color: Theme.of(context).accentTextTheme.bodySmall!.color!,
28 + color: Theme.of(context).cardColor,
29 ),
30 child: Row(
31 mainAxisSize: MainAxisSize.max,
@@ -43,24 +44,22 @@ class RestoreButton extends StatelessWidget {
44 Text(
45 title,
46 style: TextStyle(
46 - fontSize: 16,
47 - fontWeight: FontWeight.w500,
48 - color: Theme.of(context)
49 - .primaryTextTheme
50 - .titleLarge!
51 - .color!),
47 + fontSize: 16,
48 + fontWeight: FontWeight.w500,
49 + color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
50 + ),
51 ),
52 Padding(
53 padding: EdgeInsets.only(top: 5),
54 child: Text(
55 description,
56 style: TextStyle(
58 - fontSize: 14,
59 - fontWeight: FontWeight.normal,
60 - color: Theme.of(context)
61 - .primaryTextTheme
62 - .labelSmall!
63 - .color!),
57 + fontSize: 14,
58 + fontWeight: FontWeight.normal,
59 + color: Theme.of(context)
60 + .extension<TransactionTradeTheme>()!
61 + .detailsTitlesColor,
62 + ),
63 ),
64 )
65 ],
lib/src/screens/seed/pre_seed_page.dart
+1 -3
@@ -6,8 +6,6 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
6 import 'package:cake_wallet/generated/i18n.dart';
7 import 'package:cake_wallet/routes.dart';
8 import 'package:cake_wallet/themes/theme_base.dart';
9 -import 'package:cake_wallet/utils/responsive_layout_util.dart';
10 -import 'package:cw_core/wallet_type.dart';
9 import 'package:flutter/material.dart';
10
11 class PreSeedPage extends BasePage {
@@ -62,7 +60,7 @@ class PreSeedPage extends BasePage {
60 onPressed: () =>
61 Navigator.of(context).popAndPushNamed(Routes.seed, arguments: true),
62 text: S.of(context).pre_seed_button_text,
65 - color: Theme.of(context).accentTextTheme.bodyLarge!.color!,
63 + color: Theme.of(context).primaryColor,
64 textColor: Colors.white)
65 ],
66 ),
lib/src/screens/send/send_page.dart
+6 -21
@@ -208,14 +208,8 @@ class SendPage extends BasePage {
208 radius: 6.0,
209 dotWidth: 6.0,
210 dotHeight: 6.0,
211 - dotColor: Theme.of(context)
212 - .primaryTextTheme!
213 - .displaySmall!
214 - .backgroundColor!,
215 - activeDotColor: Theme.of(context)
216 - .primaryTextTheme!
217 - .displayMedium!
218 - .backgroundColor!),
211 + dotColor: Theme.of(context).extension<SendPageTheme>()!.indicatorDotColor,
212 + activeDotColor: Theme.of(context).extension<SendPageTheme>()!.templateBackgroundColor),
213 )
214 : Offstage();
215 },
@@ -340,10 +334,7 @@ class SendPage extends BasePage {
334 text:
335 'Change your asset (${sendViewModel.selectedCryptoCurrency})',
336 color: Colors.transparent,
343 - textColor: Theme.of(context)
344 - .accentTextTheme!
345 - .displaySmall!
346 - .decorationColor!,
337 + textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
338 ))),
339 if (sendViewModel.sendTemplateViewModel.hasMultiRecipient)
340 Padding(
@@ -358,15 +349,9 @@ class SendPage extends BasePage {
349 },
350 text: S.of(context).add_receiver,
351 color: Colors.transparent,
361 - textColor: Theme.of(context)
362 - .accentTextTheme!
363 - .displaySmall!
364 - .decorationColor!,
352 + textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
353 isDottedBorder: true,
366 - borderColor: Theme.of(context)
367 - .primaryTextTheme!
368 - .displaySmall!
369 - .decorationColor!,
354 + borderColor: Theme.of(context).extension<SendPageTheme>()!.templateDottedBorderColor,
355 )),
356 Observer(
357 builder: (_) {
@@ -387,7 +372,7 @@ class SendPage extends BasePage {
372 item.cryptoAmount.isEmpty)
373 .toList();
374
390 - if (notValidItems.isNotEmpty ?? false) {
375 + if (notValidItems.isNotEmpty) {
376 showErrorValidationAlert(context);
377 return;
378 }
lib/src/screens/send/widgets/send_card.dart
+5 -8
@@ -167,8 +167,8 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
167 AddressTextFieldOption.qrCode,
168 AddressTextFieldOption.addressBook
169 ],
170 - buttonColor: Theme.of(context).primaryTextTheme.headlineMedium!.color!,
171 - borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!,
170 + buttonColor: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
171 + borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
172 textStyle: TextStyle(
173 fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
174 hintStyle: TextStyle(
@@ -403,14 +403,11 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
403 ),
404 ),
405 hintText: '0.00',
406 - borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!,
406 + borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
407 textStyle: TextStyle(
408 fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
409 placeholderTextStyle: TextStyle(
410 - color: Theme.of(context)
411 - .primaryTextTheme
412 - .headlineSmall!
413 - .decorationColor!,
410 + color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor,
411 fontWeight: FontWeight.w500,
412 fontSize: 14),
413 ),
@@ -421,7 +418,7 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
418 controller: noteController,
419 keyboardType: TextInputType.multiline,
420 maxLines: null,
424 - borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!,
421 + borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
422 textStyle: TextStyle(
423 fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
424 hintText: S.of(context).note_optional,
lib/src/screens/settings/widgets/settings_choices_cell.dart
+1 -1
@@ -59,7 +59,7 @@ class SettingsChoicesCell extends StatelessWidget {
59 style: TextStyle(
60 color: isSelected
61 ? Colors.white
62 - : Theme.of(context).primaryTextTheme.bodySmall!.color!,
62 + : Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
63 fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal,
64 ),
65 ),
lib/src/screens/wallet_list/wallet_list_page.dart
+117 -112
@@ -1,10 +1,8 @@
1 import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
2 import 'package:cake_wallet/core/auth_service.dart';
3 -import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
3 import 'package:cake_wallet/themes/extensions/receive_page_theme.dart';
4 import 'package:cake_wallet/utils/responsive_layout_util.dart';
5 import 'package:cake_wallet/utils/show_bar.dart';
7 -import 'package:cake_wallet/utils/show_pop_up.dart';
6 import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
7 import 'package:another_flushbar/flushbar.dart';
8 import 'package:flutter/material.dart';
@@ -66,106 +64,110 @@ class WalletListBodyState extends State<WalletListBody> {
64 return Container(
65 padding: EdgeInsets.only(top: 16),
66 child: ScrollableWithBottomSection(
69 - contentPadding: EdgeInsets.only(bottom: 20),
70 - content: Container(
71 - child: Observer(
72 - builder: (_) => ListView.separated(
73 - shrinkWrap: true,
74 - physics: const NeverScrollableScrollPhysics(),
75 - separatorBuilder: (_, index) =>
76 - Divider(color: Theme.of(context).colorScheme.background, height: 32),
77 - itemCount: widget.walletListViewModel.wallets.length,
78 - itemBuilder: (__, index) {
79 - final wallet = widget.walletListViewModel.wallets[index];
80 - final currentColor = wallet.isCurrent
81 - ? Theme.of(context)
82 - .extension<WalletListTheme>()!
83 - .createNewWalletButtonBackgroundColor
84 - : Theme.of(context).colorScheme.background;
85 - final row = GestureDetector(
86 - onTap: () => wallet.isCurrent ? null : _loadWallet(wallet),
87 - child: Container(
67 + contentPadding: EdgeInsets.only(bottom: 20),
68 + content: Container(
69 + child: Observer(
70 + builder: (_) => ListView.separated(
71 + shrinkWrap: true,
72 + physics: const NeverScrollableScrollPhysics(),
73 + separatorBuilder: (_, index) =>
74 + Divider(color: Theme.of(context).colorScheme.background, height: 32),
75 + itemCount: widget.walletListViewModel.wallets.length,
76 + itemBuilder: (__, index) {
77 + final wallet = widget.walletListViewModel.wallets[index];
78 + final currentColor = wallet.isCurrent
79 + ? Theme.of(context)
80 + .extension<WalletListTheme>()!
81 + .createNewWalletButtonBackgroundColor
82 + : Theme.of(context).colorScheme.background;
83 + final row = GestureDetector(
84 + onTap: () => wallet.isCurrent ? null : _loadWallet(wallet),
85 + child: Container(
86 + height: tileHeight,
87 + width: double.infinity,
88 + child: Row(
89 + children: <Widget>[
90 + Container(
91 height: tileHeight,
89 - width: double.infinity,
90 - child: Row(
91 - children: <Widget>[
92 - Container(
93 - height: tileHeight,
94 - width: 4,
95 - decoration: BoxDecoration(
96 - borderRadius: BorderRadius.only(
97 - topRight: Radius.circular(4),
98 - bottomRight: Radius.circular(4)),
99 - color: currentColor),
100 - ),
101 - Expanded(
102 - child: Container(
103 - height: tileHeight,
104 - padding: EdgeInsets.only(left: 20, right: 20),
105 - color: Theme.of(context).colorScheme.background,
106 - alignment: Alignment.centerLeft,
107 - child: Row(
108 - crossAxisAlignment: CrossAxisAlignment.center,
109 - children: <Widget>[
110 - wallet.isEnabled
111 - ? _imageFor(type: wallet.type)
112 - : nonWalletTypeIcon,
113 - SizedBox(width: 10),
114 - Flexible(
115 - child: Text(
116 - wallet.name,
117 - maxLines: null,
118 - softWrap: true,
119 - style: TextStyle(
120 - fontSize: 22,
121 - fontWeight: FontWeight.w500,
122 - color: Theme.of(context)
123 - .extension<CakeTextTheme>()!
124 - .titleColor),
125 - ))
126 - ]),
92 + width: 4,
93 + decoration: BoxDecoration(
94 + borderRadius: BorderRadius.only(
95 + topRight: Radius.circular(4), bottomRight: Radius.circular(4)),
96 + color: currentColor),
97 + ),
98 + Expanded(
99 + child: Container(
100 + height: tileHeight,
101 + padding: EdgeInsets.only(left: 20, right: 20),
102 + color: Theme.of(context).colorScheme.background,
103 + alignment: Alignment.centerLeft,
104 + child: Row(
105 + crossAxisAlignment: CrossAxisAlignment.center,
106 + children: <Widget>[
107 + wallet.isEnabled ? _imageFor(type: wallet.type) : nonWalletTypeIcon,
108 + SizedBox(width: 10),
109 + Flexible(
110 + child: Text(
111 + wallet.name,
112 + maxLines: null,
113 + softWrap: true,
114 + style: TextStyle(
115 + fontSize: 22,
116 + fontWeight: FontWeight.w500,
117 + color:
118 + Theme.of(context).extension<CakeTextTheme>()!.titleColor,
119 + ),
120 + ),
121 ),
128 - ),
129 - ],
122 + ],
123 + ),
124 ),
131 - ));
125 + ),
126 + ],
127 + ),
128 + ),
129 + );
130
133 - return wallet.isCurrent
134 - ? row
135 - : Row(children: [
136 - Expanded(child: row),
137 - GestureDetector(
138 - onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit,
139 - arguments: [widget.walletListViewModel, wallet]),
140 - child: Container(
141 - padding: EdgeInsets.only(right: 20),
142 - child: Center(
143 - child: Container(
144 - height: 40,
145 - width: 44,
146 - padding: EdgeInsets.all(10),
147 - decoration: BoxDecoration(
148 - shape: BoxShape.circle,
149 - color: Theme.of(context)
150 - .extension<ReceivePageTheme>()!
151 - .iconsBackgroundColor),
152 - child: Icon(
153 - Icons.edit,
154 - size: 14,
155 - color: Theme.of(context)
156 - .extension<ReceivePageTheme>()!
157 - .iconsColor,
158 - ),
131 + return wallet.isCurrent
132 + ? row
133 + : Row(
134 + children: [
135 + Expanded(child: row),
136 + GestureDetector(
137 + onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit,
138 + arguments: [widget.walletListViewModel, wallet]),
139 + child: Container(
140 + padding: EdgeInsets.only(right: 20),
141 + child: Center(
142 + child: Container(
143 + height: 40,
144 + width: 44,
145 + padding: EdgeInsets.all(10),
146 + decoration: BoxDecoration(
147 + shape: BoxShape.circle,
148 + color: Theme.of(context)
149 + .extension<ReceivePageTheme>()!
150 + .iconsBackgroundColor,
151 + ),
152 + child: Icon(
153 + Icons.edit,
154 + size: 14,
155 + color:
156 + Theme.of(context).extension<ReceivePageTheme>()!.iconsColor,
157 ),
158 ),
159 ),
162 - )
163 - ]);
164 - }),
160 + ),
161 + ),
162 + ],
163 + );
164 + },
165 ),
166 ),
167 - bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
168 - bottomSection: Column(children: <Widget>[
167 + ),
168 + bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
169 + bottomSection: Column(
170 + children: <Widget>[
171 PrimaryImageButton(
172 onPressed: () {
173 //TODO(David): Find a way to optimize this
@@ -199,29 +201,32 @@ class WalletListBodyState extends State<WalletListBody> {
201 },
202 image: newWalletImage,
203 text: S.of(context).wallet_list_create_new_wallet,
202 - color: Theme.of(context).accentTextTheme.bodyLarge!.color!,
204 + color: Theme.of(context).primaryColor,
205 textColor: Colors.white,
206 ),
207 SizedBox(height: 10.0),
208 PrimaryImageButton(
207 - onPressed: () {
208 - if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
209 - widget.authService.authenticateAction(
210 - context,
211 - route: Routes.restoreOptions,
212 - arguments: false,
213 - conditionToDetermineIfToUse2FA:
214 - widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
215 - );
216 - } else {
217 - Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false);
218 - }
219 - },
220 - image: restoreWalletImage,
221 - text: S.of(context).wallet_list_restore_wallet,
222 - color: Theme.of(context).accentTextTheme.bodySmall!.color!,
223 - textColor: Theme.of(context).primaryTextTheme.titleLarge!.color!)
224 - ])),
209 + onPressed: () {
210 + if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
211 + widget.authService.authenticateAction(
212 + context,
213 + route: Routes.restoreOptions,
214 + arguments: false,
215 + conditionToDetermineIfToUse2FA:
216 + widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
217 + );
218 + } else {
219 + Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false);
220 + }
221 + },
222 + image: restoreWalletImage,
223 + text: S.of(context).wallet_list_restore_wallet,
224 + color: Theme.of(context).cardColor,
225 + textColor: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
226 + )
227 + ],
228 + ),
229 + ),
230 );
231 }
232
lib/src/widgets/standard_list.dart
+11 -5
@@ -72,7 +72,10 @@ class SectionHeaderListRow extends StatelessWidget {
72 Widget build(BuildContext context) => Column(children: [
73 StandardListSeparator(padding: EdgeInsets.only(left: 24)),
74 Container(
75 - width: double.infinity, height: 40, color: Theme.of(context).colorScheme.background),
75 + width: double.infinity,
76 + height: 40,
77 + color: Theme.of(context).colorScheme.background,
78 + ),
79 //StandardListSeparator(padding: EdgeInsets.only(left: 24))
80 ]);
81 }
@@ -86,11 +89,14 @@ class StandardListSeparator extends StatelessWidget {
89 @override
90 Widget build(BuildContext context) {
91 return Container(
92 + height: height,
93 + padding: padding,
94 + color: Theme.of(context).colorScheme.background,
95 + child: Container(
96 height: height,
90 - padding: padding,
91 - color: Theme.of(context).colorScheme.background,
92 - child: Container(
93 - height: height, color: Theme.of(context).primaryTextTheme.titleLarge?.backgroundColor));
97 + color: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
98 + ),
99 + );
100 }
101 }
102
pubspec_base.yaml
+6 -7
@@ -3,14 +3,13 @@ dependencies:
3 sdk: flutter
4 flutter_localizations:
5 sdk: flutter
6 - intl: ^0.17.0
6 + intl: ^0.18.0
7 url_launcher: ^6.1.4
8 qr_flutter:
9 git:
10 url: https://github.com/cake-tech/qr.flutter.git
11 ref: cake-4.0.2
12 version: 4.0.2
13 - uuid: 3.0.6
13 shared_preferences: ^2.0.15
14 flutter_secure_storage:
15 git:
@@ -23,7 +22,7 @@ dependencies:
22 yaml: ^3.1.1
23 #barcode_scan: any
24 barcode_scan2: ^4.2.1
26 - http: ^0.13.4
25 + http: ^1.1.0
26 path_provider: ^2.0.11
27 mobx: ^2.1.4
28 flutter_mobx: ^2.0.6+5
@@ -53,7 +52,7 @@ dependencies:
52 encrypt: ^5.0.1
53 crypto: ^3.0.2
54 # password: ^1.0.0
56 - basic_utils: ^4.3.0
55 + basic_utils: ^5.6.1
56 get_it: ^7.2.0
57 # connectivity: ^3.0.3
58 connectivity_plus: ^2.3.5
@@ -86,13 +85,13 @@ dependencies:
85 bitcoin_flutter:
86 git:
87 url: https://github.com/cake-tech/bitcoin_flutter.git
89 - ref: cake-update-v2
88 + ref: cake-update-v3
89
90 dev_dependencies:
91 flutter_test:
92 sdk: flutter
93 build_runner: ^2.3.3
95 - logging: 1.1.1
94 + logging: ^1.2.0
95 mobx_codegen: ^2.1.1
96 build_resolvers: ^2.0.9
97 hive_generator: ^1.1.3
@@ -100,7 +99,7 @@ dev_dependencies:
99 # check flutter_launcher_icons for usage
100 pedantic: ^1.8.0
101 # replace https://github.com/dart-lang/lints#migrating-from-packagepedantic
103 - translator: ^0.1.7
102 +# translator: ^0.1.7
103
104 flutter_icons:
105 image_path: "assets/images/app_logo.png"
tool/append_translation.dart
+66 -66
@@ -1,66 +1,66 @@
1 -import 'dart:convert';
2 -import 'dart:io';
3 -
4 -import 'package:translator/translator.dart';
5 -
6 -const defaultLang = "en";
7 -const langs = [
8 - "ar", "bg", "cs", "de", "en", "es", "fr", "ha", "hi", "hr", "id", "it",
9 - "ja", "ko", "my", "nl", "pl", "pt", "ru", "th", "tr", "uk", "ur", "yo",
10 - "zh-cn" // zh, but Google Translate uses zh-cn for Chinese (Simplified)
11 -];
12 -final translator = GoogleTranslator();
13 -
14 -void main(List<String> args) async {
15 - if (args.length != 2) {
16 - throw Exception(
17 - 'Insufficient arguments!\n\nTry to run `./append_translation.dart greetings "Hello World!"`');
18 - }
19 -
20 - final name = args.first;
21 - final text = args.last;
22 -
23 - print('Appending "$name": "$text"');
24 -
25 - for (var lang in langs) {
26 - final fileName = getFileName(lang);
27 - final translation = await getTranslation(text, lang);
28 -
29 - appendArbFile(fileName, name, translation);
30 - }
31 -}
32 -
33 -void appendArbFile(String fileName, String name, String text) {
34 - final file = File(fileName);
35 - final inputContent = file.readAsStringSync();
36 - final arbObj = json.decode(inputContent) as Map<String, dynamic>;
37 -
38 - if (arbObj.containsKey(name)) {
39 - print("String $name already exists in $fileName!");
40 - return;
41 - }
42 -
43 - arbObj.addAll({name: text});
44 -
45 - final outputContent = json
46 - .encode(arbObj)
47 - .replaceAll('","', '",\n "')
48 - .replaceAll('{"', '{\n "')
49 - .replaceAll('"}', '"\n}')
50 - .replaceAll('":"', '": "');
51 -
52 - file.writeAsStringSync(outputContent);
53 -}
54 -
55 -
56 -Future<String> getTranslation(String text, String lang) async {
57 - if (lang == defaultLang) return text;
58 - return (await translator.translate(text, from: defaultLang, to: lang)).text;
59 -}
60 -
61 -String getFileName(String lang) {
62 - final shortLang = lang
63 - .split("-")
64 - .first;
65 - return "./res/values/strings_$shortLang.arb";
66 -}
1 +// import 'dart:convert';
2 +// import 'dart:io';
3 +//
4 +// import 'package:translator/translator.dart';
5 +//
6 +// const defaultLang = "en";
7 +// const langs = [
8 +// "ar", "bg", "cs", "de", "en", "es", "fr", "ha", "hi", "hr", "id", "it",
9 +// "ja", "ko", "my", "nl", "pl", "pt", "ru", "th", "tr", "uk", "ur", "yo",
10 +// "zh-cn" // zh, but Google Translate uses zh-cn for Chinese (Simplified)
11 +// ];
12 +// final translator = GoogleTranslator();
13 +//
14 +// void main(List<String> args) async {
15 +// if (args.length != 2) {
16 +// throw Exception(
17 +// 'Insufficient arguments!\n\nTry to run `./append_translation.dart greetings "Hello World!"`');
18 +// }
19 +//
20 +// final name = args.first;
21 +// final text = args.last;
22 +//
23 +// print('Appending "$name": "$text"');
24 +//
25 +// for (var lang in langs) {
26 +// final fileName = getFileName(lang);
27 +// final translation = await getTranslation(text, lang);
28 +//
29 +// appendArbFile(fileName, name, translation);
30 +// }
31 +// }
32 +//
33 +// void appendArbFile(String fileName, String name, String text) {
34 +// final file = File(fileName);
35 +// final inputContent = file.readAsStringSync();
36 +// final arbObj = json.decode(inputContent) as Map<String, dynamic>;
37 +//
38 +// if (arbObj.containsKey(name)) {
39 +// print("String $name already exists in $fileName!");
40 +// return;
41 +// }
42 +//
43 +// arbObj.addAll({name: text});
44 +//
45 +// final outputContent = json
46 +// .encode(arbObj)
47 +// .replaceAll('","', '",\n "')
48 +// .replaceAll('{"', '{\n "')
49 +// .replaceAll('"}', '"\n}')
50 +// .replaceAll('":"', '": "');
51 +//
52 +// file.writeAsStringSync(outputContent);
53 +// }
54 +//
55 +//
56 +// Future<String> getTranslation(String text, String lang) async {
57 +// if (lang == defaultLang) return text;
58 +// return (await translator.translate(text, from: defaultLang, to: lang)).text;
59 +// }
60 +//
61 +// String getFileName(String lang) {
62 +// final shortLang = lang
63 +// .split("-")
64 +// .first;
65 +// return "./res/values/strings_$shortLang.arb";
66 +// }
tool/localization/localization_constants.dart
+18
@@ -27,6 +27,24 @@ class S implements WidgetsLocalizations {
27 GeneratedLocalizationsDelegate();
28
29 static S of(BuildContext context) => Localizations.of<S>(context, S)!;
30 +
31 + @override
32 + String get reorderItemToStart => "reorderItemToStart";
33 +
34 + @override
35 + String get reorderItemToEnd => "reorderItemToEnd";
36 +
37 + @override
38 + String get reorderItemUp => "reorderItemUp";
39 +
40 + @override
41 + String get reorderItemDown => "reorderItemDown";
42 +
43 + @override
44 + String get reorderItemLeft => "reorderItemLeft";
45 +
46 + @override
47 + String get reorderItemRight => "reorderItemRight";
48 """;
49
50 const part2 = """