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
This commit is contained in:
Omar Hatem 2023-08-18 18:37:17 +03:00 committed by GitHub
parent 09c942564e
commit 9ddab2b472
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 311 additions and 282 deletions

View file

@ -18,7 +18,7 @@ jobs:
- name: Flutter action - name: Flutter action
uses: subosito/flutter-action@v1 uses: subosito/flutter-action@v1
with: with:
flutter-version: '3.3.x' flutter-version: '3.10.x'
channel: stable channel: stable
- name: Install package dependencies - name: Install package dependencies

View file

@ -28,7 +28,7 @@ jobs:
- name: Flutter action - name: Flutter action
uses: subosito/flutter-action@v1 uses: subosito/flutter-action@v1
with: with:
flutter-version: '3.7.x' flutter-version: '3.10.x'
channel: stable channel: stable
- name: Install package dependencies - name: Install package dependencies

View file

@ -27,6 +27,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View file

@ -13,16 +13,16 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
path_provider: ^2.0.11 path_provider: ^2.0.11
http: ^0.13.4 http: ^1.1.0
mobx: ^2.0.7+4 mobx: ^2.0.7+4
flutter_mobx: ^2.0.6+1 flutter_mobx: ^2.0.6+1
intl: ^0.17.0 intl: ^0.18.0
cw_core: cw_core:
path: ../cw_core path: ../cw_core
bitcoin_flutter: bitcoin_flutter:
git: git:
url: https://github.com/cake-tech/bitcoin_flutter.git url: https://github.com/cake-tech/bitcoin_flutter.git
ref: cake-update-v2 ref: cake-update-v3
rxdart: ^0.27.5 rxdart: ^0.27.5
unorm_dart: ^0.2.0 unorm_dart: ^0.2.0
cryptography: ^2.0.5 cryptography: ^2.0.5

View file

@ -12,12 +12,12 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
http: ^0.13.4 http: ^1.1.0
file: ^6.1.4 file: ^6.1.4
path_provider: ^2.0.11 path_provider: ^2.0.11
mobx: ^2.0.7+4 mobx: ^2.0.7+4
flutter_mobx: ^2.0.6+1 flutter_mobx: ^2.0.6+1
intl: ^0.17.0 intl: ^0.18.0
encrypt: ^5.0.1 encrypt: ^5.0.1
dev_dependencies: dev_dependencies:

View file

@ -9,7 +9,7 @@ import 'package:cw_ethereum/pending_ethereum_transaction.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:web3dart/web3dart.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_core/node.dart';
import 'package:cw_ethereum/ethereum_transaction_priority.dart'; import 'package:cw_ethereum/ethereum_transaction_priority.dart';
import 'package:cw_ethereum/.secrets.g.dart' as secrets; import 'package:cw_ethereum/.secrets.g.dart' as secrets;
@ -72,7 +72,7 @@ class EthereumClient {
to: EthereumAddress.fromHex(toAddress), to: EthereumAddress.fromHex(toAddress),
maxGas: gas, maxGas: gas,
gasPrice: price, 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(), value: _isEthereum ? EtherAmount.inWei(BigInt.parse(amount)) : EtherAmount.zero(),
); );
@ -83,7 +83,7 @@ class EthereumClient {
if (_isEthereum) { if (_isEthereum) {
_sendTransaction = () async => await sendTransaction(signedTransaction); _sendTransaction = () async => await sendTransaction(signedTransaction);
} else { } else {
final erc20 = Erc20( final erc20 = ERC20(
client: _client!, client: _client!,
address: EthereumAddress.fromHex(contractAddress!), address: EthereumAddress.fromHex(contractAddress!),
); );
@ -153,7 +153,7 @@ I/flutter ( 4474): Gas Used: 53000
Future<ERC20Balance> fetchERC20Balances( Future<ERC20Balance> fetchERC20Balances(
EthereumAddress userAddress, String contractAddress) async { 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); final balance = await erc20.balanceOf(userAddress);
int exponent = (await erc20.decimals()).toInt(); int exponent = (await erc20.decimals()).toInt();
@ -163,7 +163,7 @@ I/flutter ( 4474): Gas Used: 53000
Future<Erc20Token?> getErc20Token(String contractAddress) async { Future<Erc20Token?> getErc20Token(String contractAddress) async {
try { 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 name = await erc20.name();
final symbol = await erc20.symbol(); final symbol = await erc20.symbol();
final decimal = await erc20.decimals(); final decimal = await erc20.decimals();

View file

@ -12,13 +12,14 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
web3dart: 2.3.5 web3dart: ^2.7.1
erc20: ^1.0.1
mobx: ^2.0.7+4 mobx: ^2.0.7+4
bip39: ^1.0.6 bip39: ^1.0.6
bip32: ^2.0.0 bip32: ^2.0.0
ed25519_hd_key: ^2.2.0 ed25519_hd_key: ^2.2.0
hex: ^0.2.0 hex: ^0.2.0
http: ^0.13.4 http: ^1.1.0
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
cw_core: cw_core:
path: ../cw_core path: ../cw_core

View file

@ -13,11 +13,11 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
ffi: ^2.0.1 ffi: ^2.0.1
http: ^0.13.4 http: ^1.1.0
path_provider: ^2.0.11 path_provider: ^2.0.11
mobx: ^2.0.7+4 mobx: ^2.0.7+4
flutter_mobx: ^2.0.6+1 flutter_mobx: ^2.0.6+1
intl: ^0.17.0 intl: ^0.18.0
cw_core: cw_core:
path: ../cw_core path: ../cw_core

View file

@ -13,11 +13,11 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
ffi: ^2.0.1 ffi: ^2.0.1
http: ^0.13.4 http: ^1.1.0
path_provider: ^2.0.11 path_provider: ^2.0.11
mobx: ^2.0.7+4 mobx: ^2.0.7+4
flutter_mobx: ^2.0.6+1 flutter_mobx: ^2.0.6+1
intl: ^0.17.0 intl: ^0.18.0
encrypt: ^5.0.1 encrypt: ^5.0.1
cw_core: cw_core:
path: ../cw_core path: ../cw_core

View file

@ -5,7 +5,7 @@ author: Cake Walelt
homepage: https://cakewallet.com homepage: https://cakewallet.com
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0" flutter: ">=1.20.0"
dependencies: dependencies:

View file

@ -5,10 +5,10 @@
The following are the system requirements to build CakeWallet for your Android device. 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 SDK 29 or higher (better to have the latest one 33)
Android NDK 17c Android NDK 17c
Flutter 3.7.x Flutter 3.10.x or earlier
``` ```
## Building CakeWallet on Android ## 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. 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): 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 toolchain - develop for Android devices (Android SDK version 29 or higher)
[✓] Android Studio (version 4.0 or higher) [✓] Android Studio (version 4.0 or higher)
``` ```

View file

@ -1,4 +1,3 @@
import 'package:uuid/uuid.dart';
import 'package:cw_core/key.dart'; import 'package:cw_core/key.dart';
String generateWalletPassword() { String generateWalletPassword() {

View file

@ -736,6 +736,21 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations {
@override @override
String get keyboardKeySpace => 'Space'; 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 /// Cupertino Support
@ -937,4 +952,7 @@ class HaCupertinoLocalizations extends GlobalCupertinoLocalizations {
static const LocalizationsDelegate<CupertinoLocalizations> delegate = static const LocalizationsDelegate<CupertinoLocalizations> delegate =
_HaCupertinoLocalizationsDelegate(); _HaCupertinoLocalizationsDelegate();
@override
String get noSpellCheckReplacementsLabel => "";
} }

View file

@ -736,6 +736,21 @@ String get keyboardKeyMetaWindows => 'Windows';
@override @override
String get keyboardKeySpace => 'Space'; 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 /// Cupertino Support
@ -937,4 +952,7 @@ String get todayLabel => 'Oyọ';
static const LocalizationsDelegate<CupertinoLocalizations> delegate = static const LocalizationsDelegate<CupertinoLocalizations> delegate =
_YoCupertinoLocalizationsDelegate(); _YoCupertinoLocalizationsDelegate();
@override
String get noSpellCheckReplacementsLabel => "";
} }

View file

@ -13,7 +13,6 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/yat_emoji_id.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/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/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -109,7 +108,7 @@ class _DashboardPageView extends BasePage {
Widget trailing(BuildContext context) { Widget trailing(BuildContext context) {
final menuButton = Image.asset( final menuButton = Image.asset(
'assets/images/menu.png', 'assets/images/menu.png',
color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor, color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
); );
return Container( return Container(
@ -128,6 +127,7 @@ class _DashboardPageView extends BasePage {
final DashboardViewModel dashboardViewModel; final DashboardViewModel dashboardViewModel;
final WalletAddressListViewModel addressListViewModel; final WalletAddressListViewModel addressListViewModel;
int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0; int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0;
ObservableList<Widget> pages = ObservableList<Widget>(); ObservableList<Widget> pages = ObservableList<Widget>();
bool _isEffectsInstalled = false; bool _isEffectsInstalled = false;

View file

@ -1,5 +1,4 @@
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; 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/anonpay/anonpay_donation_link_info.dart';
import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/entities/receive_page_option.dart'; import 'package:cake_wallet/entities/receive_page_option.dart';
@ -64,14 +63,6 @@ class AddressPage extends BasePage {
@override @override
Widget? leading(BuildContext context) { 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; bool isMobileView = ResponsiveLayoutUtil.instance.isMobile;
return MergeSemantics( return MergeSemantics(
@ -119,11 +110,7 @@ class AddressPage extends BasePage {
context: context, context: context,
); );
}, },
icon: Icon( icon: Icon(Icons.share, size: 20, color: pageIconColor(context)),
Icons.share,
size: 20,
color: Theme.of(context).accentTextTheme.displayMedium!.backgroundColor!,
),
), ),
); );
} }
@ -160,10 +147,10 @@ class AddressPage extends BasePage {
return KeyboardActions( return KeyboardActions(
autoScroll: false, autoScroll: false,
disableScroll: true, disableScroll: true,
tapOutsideToDismiss: true, tapOutsideBehavior: TapOutsideBehavior.translucentDismiss,
config: KeyboardActionsConfig( config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS, keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: Theme.of(context).accentTextTheme.bodyLarge!.backgroundColor!, keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor,
nextFocus: false, nextFocus: false,
actions: [ actions: [
KeyboardActionsItem( KeyboardActionsItem(

View file

@ -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/desktop_exchange_cards_section.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/mobile_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/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/themes/theme_base.dart';
import 'package:cake_wallet/utils/debounce.dart'; import 'package:cake_wallet/utils/debounce.dart';
import 'package:cake_wallet/utils/responsive_layout_util.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, textColor: Colors.white,
isDisabled: exchangeViewModel.selectedProviders.isEmpty, isDisabled: exchangeViewModel.selectedProviders.isEmpty,
isLoading: exchangeViewModel.tradeState is TradeIsCreating)), isLoading: exchangeViewModel.tradeState is TradeIsCreating)),

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart'; import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
@ -24,7 +25,7 @@ class RestoreButton extends StatelessWidget {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
color: Theme.of(context).accentTextTheme.bodySmall!.color!, color: Theme.of(context).cardColor,
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -43,24 +44,22 @@ class RestoreButton extends StatelessWidget {
Text( Text(
title, title,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context) color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
.primaryTextTheme ),
.titleLarge!
.color!),
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: Text( child: Text(
description, description,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .extension<TransactionTradeTheme>()!
.labelSmall! .detailsTitlesColor,
.color!), ),
), ),
) )
], ],

View file

@ -6,8 +6,6 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/themes/theme_base.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'; import 'package:flutter/material.dart';
class PreSeedPage extends BasePage { class PreSeedPage extends BasePage {
@ -62,7 +60,7 @@ class PreSeedPage extends BasePage {
onPressed: () => onPressed: () =>
Navigator.of(context).popAndPushNamed(Routes.seed, arguments: true), Navigator.of(context).popAndPushNamed(Routes.seed, arguments: true),
text: S.of(context).pre_seed_button_text, text: S.of(context).pre_seed_button_text,
color: Theme.of(context).accentTextTheme.bodyLarge!.color!, color: Theme.of(context).primaryColor,
textColor: Colors.white) textColor: Colors.white)
], ],
), ),

View file

@ -208,14 +208,8 @@ class SendPage extends BasePage {
radius: 6.0, radius: 6.0,
dotWidth: 6.0, dotWidth: 6.0,
dotHeight: 6.0, dotHeight: 6.0,
dotColor: Theme.of(context) dotColor: Theme.of(context).extension<SendPageTheme>()!.indicatorDotColor,
.primaryTextTheme! activeDotColor: Theme.of(context).extension<SendPageTheme>()!.templateBackgroundColor),
.displaySmall!
.backgroundColor!,
activeDotColor: Theme.of(context)
.primaryTextTheme!
.displayMedium!
.backgroundColor!),
) )
: Offstage(); : Offstage();
}, },
@ -340,10 +334,7 @@ class SendPage extends BasePage {
text: text:
'Change your asset (${sendViewModel.selectedCryptoCurrency})', 'Change your asset (${sendViewModel.selectedCryptoCurrency})',
color: Colors.transparent, color: Colors.transparent,
textColor: Theme.of(context) textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
.accentTextTheme!
.displaySmall!
.decorationColor!,
))), ))),
if (sendViewModel.sendTemplateViewModel.hasMultiRecipient) if (sendViewModel.sendTemplateViewModel.hasMultiRecipient)
Padding( Padding(
@ -358,15 +349,9 @@ class SendPage extends BasePage {
}, },
text: S.of(context).add_receiver, text: S.of(context).add_receiver,
color: Colors.transparent, color: Colors.transparent,
textColor: Theme.of(context) textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor,
.accentTextTheme!
.displaySmall!
.decorationColor!,
isDottedBorder: true, isDottedBorder: true,
borderColor: Theme.of(context) borderColor: Theme.of(context).extension<SendPageTheme>()!.templateDottedBorderColor,
.primaryTextTheme!
.displaySmall!
.decorationColor!,
)), )),
Observer( Observer(
builder: (_) { builder: (_) {
@ -387,7 +372,7 @@ class SendPage extends BasePage {
item.cryptoAmount.isEmpty) item.cryptoAmount.isEmpty)
.toList(); .toList();
if (notValidItems.isNotEmpty ?? false) { if (notValidItems.isNotEmpty) {
showErrorValidationAlert(context); showErrorValidationAlert(context);
return; return;
} }

View file

@ -167,8 +167,8 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
AddressTextFieldOption.qrCode, AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook AddressTextFieldOption.addressBook
], ],
buttonColor: Theme.of(context).primaryTextTheme.headlineMedium!.color!, buttonColor: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!, borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
hintStyle: TextStyle( hintStyle: TextStyle(
@ -403,14 +403,11 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
), ),
), ),
hintText: '0.00', hintText: '0.00',
borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!, borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
placeholderTextStyle: TextStyle( placeholderTextStyle: TextStyle(
color: Theme.of(context) color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor,
.primaryTextTheme
.headlineSmall!
.decorationColor!,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 14), fontSize: 14),
), ),
@ -421,7 +418,7 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
controller: noteController, controller: noteController,
keyboardType: TextInputType.multiline, keyboardType: TextInputType.multiline,
maxLines: null, maxLines: null,
borderColor: Theme.of(context).primaryTextTheme.headlineSmall!.color!, borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
hintText: S.of(context).note_optional, hintText: S.of(context).note_optional,

View file

@ -59,7 +59,7 @@ class SettingsChoicesCell extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: isSelected color: isSelected
? Colors.white ? Colors.white
: Theme.of(context).primaryTextTheme.bodySmall!.color!, : Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal, fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal,
), ),
), ),

View file

@ -1,10 +1,8 @@
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/core/auth_service.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/themes/extensions/receive_page_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_bar.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:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
import 'package:another_flushbar/flushbar.dart'; import 'package:another_flushbar/flushbar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -66,106 +64,110 @@ class WalletListBodyState extends State<WalletListBody> {
return Container( return Container(
padding: EdgeInsets.only(top: 16), padding: EdgeInsets.only(top: 16),
child: ScrollableWithBottomSection( child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 20), contentPadding: EdgeInsets.only(bottom: 20),
content: Container( content: Container(
child: Observer( child: Observer(
builder: (_) => ListView.separated( builder: (_) => ListView.separated(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (_, index) => separatorBuilder: (_, index) =>
Divider(color: Theme.of(context).colorScheme.background, height: 32), Divider(color: Theme.of(context).colorScheme.background, height: 32),
itemCount: widget.walletListViewModel.wallets.length, itemCount: widget.walletListViewModel.wallets.length,
itemBuilder: (__, index) { itemBuilder: (__, index) {
final wallet = widget.walletListViewModel.wallets[index]; final wallet = widget.walletListViewModel.wallets[index];
final currentColor = wallet.isCurrent final currentColor = wallet.isCurrent
? Theme.of(context) ? Theme.of(context)
.extension<WalletListTheme>()! .extension<WalletListTheme>()!
.createNewWalletButtonBackgroundColor .createNewWalletButtonBackgroundColor
: Theme.of(context).colorScheme.background; : Theme.of(context).colorScheme.background;
final row = GestureDetector( final row = GestureDetector(
onTap: () => wallet.isCurrent ? null : _loadWallet(wallet), onTap: () => wallet.isCurrent ? null : _loadWallet(wallet),
child: Container( child: Container(
height: tileHeight,
width: double.infinity,
child: Row(
children: <Widget>[
Container(
height: tileHeight, height: tileHeight,
width: double.infinity, width: 4,
child: Row( decoration: BoxDecoration(
children: <Widget>[ borderRadius: BorderRadius.only(
Container( topRight: Radius.circular(4), bottomRight: Radius.circular(4)),
height: tileHeight, color: currentColor),
width: 4, ),
decoration: BoxDecoration( Expanded(
borderRadius: BorderRadius.only( child: Container(
topRight: Radius.circular(4), height: tileHeight,
bottomRight: Radius.circular(4)), padding: EdgeInsets.only(left: 20, right: 20),
color: currentColor), color: Theme.of(context).colorScheme.background,
), alignment: Alignment.centerLeft,
Expanded( child: Row(
child: Container( crossAxisAlignment: CrossAxisAlignment.center,
height: tileHeight, children: <Widget>[
padding: EdgeInsets.only(left: 20, right: 20), wallet.isEnabled ? _imageFor(type: wallet.type) : nonWalletTypeIcon,
color: Theme.of(context).colorScheme.background, SizedBox(width: 10),
alignment: Alignment.centerLeft, Flexible(
child: Row( child: Text(
crossAxisAlignment: CrossAxisAlignment.center, wallet.name,
children: <Widget>[ maxLines: null,
wallet.isEnabled softWrap: true,
? _imageFor(type: wallet.type) style: TextStyle(
: nonWalletTypeIcon, fontSize: 22,
SizedBox(width: 10), fontWeight: FontWeight.w500,
Flexible( color:
child: Text( Theme.of(context).extension<CakeTextTheme>()!.titleColor,
wallet.name,
maxLines: null,
softWrap: true,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.extension<CakeTextTheme>()!
.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<ReceivePageTheme>()!
.iconsBackgroundColor),
child: Icon(
Icons.edit,
size: 14,
color: Theme.of(context)
.extension<ReceivePageTheme>()!
.iconsColor,
), ),
), ),
), ),
],
),
),
),
],
),
),
);
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<ReceivePageTheme>()!
.iconsBackgroundColor,
),
child: Icon(
Icons.edit,
size: 14,
color:
Theme.of(context).extension<ReceivePageTheme>()!.iconsColor,
),
),
), ),
) ),
]); ),
}), ],
);
},
), ),
), ),
bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24), ),
bottomSection: Column(children: <Widget>[ bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
bottomSection: Column(
children: <Widget>[
PrimaryImageButton( PrimaryImageButton(
onPressed: () { onPressed: () {
//TODO(David): Find a way to optimize this //TODO(David): Find a way to optimize this
@ -199,29 +201,32 @@ class WalletListBodyState extends State<WalletListBody> {
}, },
image: newWalletImage, image: newWalletImage,
text: S.of(context).wallet_list_create_new_wallet, text: S.of(context).wallet_list_create_new_wallet,
color: Theme.of(context).accentTextTheme.bodyLarge!.color!, color: Theme.of(context).primaryColor,
textColor: Colors.white, textColor: Colors.white,
), ),
SizedBox(height: 10.0), SizedBox(height: 10.0),
PrimaryImageButton( PrimaryImageButton(
onPressed: () { onPressed: () {
if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) { if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
widget.authService.authenticateAction( widget.authService.authenticateAction(
context, context,
route: Routes.restoreOptions, route: Routes.restoreOptions,
arguments: false, arguments: false,
conditionToDetermineIfToUse2FA: conditionToDetermineIfToUse2FA:
widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets, widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
); );
} else { } else {
Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false); Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false);
} }
}, },
image: restoreWalletImage, image: restoreWalletImage,
text: S.of(context).wallet_list_restore_wallet, text: S.of(context).wallet_list_restore_wallet,
color: Theme.of(context).accentTextTheme.bodySmall!.color!, color: Theme.of(context).cardColor,
textColor: Theme.of(context).primaryTextTheme.titleLarge!.color!) textColor: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
])), )
],
),
),
); );
} }

View file

@ -72,7 +72,10 @@ class SectionHeaderListRow extends StatelessWidget {
Widget build(BuildContext context) => Column(children: [ Widget build(BuildContext context) => Column(children: [
StandardListSeparator(padding: EdgeInsets.only(left: 24)), StandardListSeparator(padding: EdgeInsets.only(left: 24)),
Container( 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)) //StandardListSeparator(padding: EdgeInsets.only(left: 24))
]); ]);
} }
@ -86,11 +89,14 @@ class StandardListSeparator extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: height,
padding: padding,
color: Theme.of(context).colorScheme.background,
child: Container(
height: height, height: height,
padding: padding, color: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
color: Theme.of(context).colorScheme.background, ),
child: Container( );
height: height, color: Theme.of(context).primaryTextTheme.titleLarge?.backgroundColor));
} }
} }

View file

@ -3,14 +3,13 @@ dependencies:
sdk: flutter sdk: flutter
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter
intl: ^0.17.0 intl: ^0.18.0
url_launcher: ^6.1.4 url_launcher: ^6.1.4
qr_flutter: qr_flutter:
git: git:
url: https://github.com/cake-tech/qr.flutter.git url: https://github.com/cake-tech/qr.flutter.git
ref: cake-4.0.2 ref: cake-4.0.2
version: 4.0.2 version: 4.0.2
uuid: 3.0.6
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
flutter_secure_storage: flutter_secure_storage:
git: git:
@ -23,7 +22,7 @@ dependencies:
yaml: ^3.1.1 yaml: ^3.1.1
#barcode_scan: any #barcode_scan: any
barcode_scan2: ^4.2.1 barcode_scan2: ^4.2.1
http: ^0.13.4 http: ^1.1.0
path_provider: ^2.0.11 path_provider: ^2.0.11
mobx: ^2.1.4 mobx: ^2.1.4
flutter_mobx: ^2.0.6+5 flutter_mobx: ^2.0.6+5
@ -53,7 +52,7 @@ dependencies:
encrypt: ^5.0.1 encrypt: ^5.0.1
crypto: ^3.0.2 crypto: ^3.0.2
# password: ^1.0.0 # password: ^1.0.0
basic_utils: ^4.3.0 basic_utils: ^5.6.1
get_it: ^7.2.0 get_it: ^7.2.0
# connectivity: ^3.0.3 # connectivity: ^3.0.3
connectivity_plus: ^2.3.5 connectivity_plus: ^2.3.5
@ -86,13 +85,13 @@ dependencies:
bitcoin_flutter: bitcoin_flutter:
git: git:
url: https://github.com/cake-tech/bitcoin_flutter.git url: https://github.com/cake-tech/bitcoin_flutter.git
ref: cake-update-v2 ref: cake-update-v3
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
build_runner: ^2.3.3 build_runner: ^2.3.3
logging: 1.1.1 logging: ^1.2.0
mobx_codegen: ^2.1.1 mobx_codegen: ^2.1.1
build_resolvers: ^2.0.9 build_resolvers: ^2.0.9
hive_generator: ^1.1.3 hive_generator: ^1.1.3
@ -100,7 +99,7 @@ dev_dependencies:
# check flutter_launcher_icons for usage # check flutter_launcher_icons for usage
pedantic: ^1.8.0 pedantic: ^1.8.0
# replace https://github.com/dart-lang/lints#migrating-from-packagepedantic # replace https://github.com/dart-lang/lints#migrating-from-packagepedantic
translator: ^0.1.7 # translator: ^0.1.7
flutter_icons: flutter_icons:
image_path: "assets/images/app_logo.png" image_path: "assets/images/app_logo.png"

View file

@ -1,66 +1,66 @@
import 'dart:convert'; // import 'dart:convert';
import 'dart:io'; // import 'dart:io';
//
import 'package:translator/translator.dart'; // import 'package:translator/translator.dart';
//
const defaultLang = "en"; // const defaultLang = "en";
const langs = [ // const langs = [
"ar", "bg", "cs", "de", "en", "es", "fr", "ha", "hi", "hr", "id", "it", // "ar", "bg", "cs", "de", "en", "es", "fr", "ha", "hi", "hr", "id", "it",
"ja", "ko", "my", "nl", "pl", "pt", "ru", "th", "tr", "uk", "ur", "yo", // "ja", "ko", "my", "nl", "pl", "pt", "ru", "th", "tr", "uk", "ur", "yo",
"zh-cn" // zh, but Google Translate uses zh-cn for Chinese (Simplified) // "zh-cn" // zh, but Google Translate uses zh-cn for Chinese (Simplified)
]; // ];
final translator = GoogleTranslator(); // final translator = GoogleTranslator();
//
void main(List<String> args) async { // void main(List<String> args) async {
if (args.length != 2) { // if (args.length != 2) {
throw Exception( // throw Exception(
'Insufficient arguments!\n\nTry to run `./append_translation.dart greetings "Hello World!"`'); // 'Insufficient arguments!\n\nTry to run `./append_translation.dart greetings "Hello World!"`');
} // }
//
final name = args.first; // final name = args.first;
final text = args.last; // final text = args.last;
//
print('Appending "$name": "$text"'); // print('Appending "$name": "$text"');
//
for (var lang in langs) { // for (var lang in langs) {
final fileName = getFileName(lang); // final fileName = getFileName(lang);
final translation = await getTranslation(text, lang); // final translation = await getTranslation(text, lang);
//
appendArbFile(fileName, name, translation); // appendArbFile(fileName, name, translation);
} // }
} // }
//
void appendArbFile(String fileName, String name, String text) { // void appendArbFile(String fileName, String name, String text) {
final file = File(fileName); // final file = File(fileName);
final inputContent = file.readAsStringSync(); // final inputContent = file.readAsStringSync();
final arbObj = json.decode(inputContent) as Map<String, dynamic>; // final arbObj = json.decode(inputContent) as Map<String, dynamic>;
//
if (arbObj.containsKey(name)) { // if (arbObj.containsKey(name)) {
print("String $name already exists in $fileName!"); // print("String $name already exists in $fileName!");
return; // return;
} // }
//
arbObj.addAll({name: text}); // arbObj.addAll({name: text});
//
final outputContent = json // final outputContent = json
.encode(arbObj) // .encode(arbObj)
.replaceAll('","', '",\n "') // .replaceAll('","', '",\n "')
.replaceAll('{"', '{\n "') // .replaceAll('{"', '{\n "')
.replaceAll('"}', '"\n}') // .replaceAll('"}', '"\n}')
.replaceAll('":"', '": "'); // .replaceAll('":"', '": "');
//
file.writeAsStringSync(outputContent); // file.writeAsStringSync(outputContent);
} // }
//
//
Future<String> getTranslation(String text, String lang) async { // Future<String> getTranslation(String text, String lang) async {
if (lang == defaultLang) return text; // if (lang == defaultLang) return text;
return (await translator.translate(text, from: defaultLang, to: lang)).text; // return (await translator.translate(text, from: defaultLang, to: lang)).text;
} // }
//
String getFileName(String lang) { // String getFileName(String lang) {
final shortLang = lang // final shortLang = lang
.split("-") // .split("-")
.first; // .first;
return "./res/values/strings_$shortLang.arb"; // return "./res/values/strings_$shortLang.arb";
} // }

View file

@ -27,6 +27,24 @@ class S implements WidgetsLocalizations {
GeneratedLocalizationsDelegate(); GeneratedLocalizationsDelegate();
static S of(BuildContext context) => Localizations.of<S>(context, S)!; static S of(BuildContext context) => Localizations.of<S>(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 = """ const part2 = """