mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
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:
parent
09c942564e
commit
9ddab2b472
27 changed files with 311 additions and 282 deletions
2
.github/workflows/cache_dependencies.yml
vendored
2
.github/workflows/cache_dependencies.yml
vendored
|
@ -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
|
||||||
|
|
2
.github/workflows/pr_test_build.yml
vendored
2
.github/workflows/pr_test_build.yml
vendored
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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)
|
||||||
```
|
```
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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 => "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 => "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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)),
|
||||||
|
|
|
@ -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,
|
||||||
|
@ -45,10 +46,8 @@ class RestoreButton extends StatelessWidget {
|
||||||
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),
|
||||||
|
@ -58,9 +57,9 @@ class RestoreButton extends StatelessWidget {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.primaryTextTheme
|
.extension<TransactionTradeTheme>()!
|
||||||
.labelSmall!
|
.detailsTitlesColor,
|
||||||
.color!),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
|
@ -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)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -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';
|
||||||
|
@ -94,8 +92,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||||
width: 4,
|
width: 4,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
topRight: Radius.circular(4),
|
topRight: Radius.circular(4), bottomRight: Radius.circular(4)),
|
||||||
bottomRight: Radius.circular(4)),
|
|
||||||
color: currentColor),
|
color: currentColor),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -107,9 +104,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
wallet.isEnabled
|
wallet.isEnabled ? _imageFor(type: wallet.type) : nonWalletTypeIcon,
|
||||||
? _imageFor(type: wallet.type)
|
|
||||||
: nonWalletTypeIcon,
|
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -119,20 +114,24 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.extension<CakeTextTheme>()!
|
Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||||
.titleColor),
|
),
|
||||||
))
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return wallet.isCurrent
|
return wallet.isCurrent
|
||||||
? row
|
? row
|
||||||
: Row(children: [
|
: Row(
|
||||||
|
children: [
|
||||||
Expanded(child: row),
|
Expanded(child: row),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit,
|
onTap: () => Navigator.of(context).pushNamed(Routes.walletEdit,
|
||||||
|
@ -148,24 +147,27 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<ReceivePageTheme>()!
|
.extension<ReceivePageTheme>()!
|
||||||
.iconsBackgroundColor),
|
.iconsBackgroundColor,
|
||||||
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.edit,
|
Icons.edit,
|
||||||
size: 14,
|
size: 14,
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.extension<ReceivePageTheme>()!
|
Theme.of(context).extension<ReceivePageTheme>()!.iconsColor,
|
||||||
.iconsColor,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
]);
|
],
|
||||||
}),
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
|
bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
|
||||||
bottomSection: Column(children: <Widget>[
|
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,7 +201,7 @@ 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),
|
||||||
|
@ -219,9 +221,12 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||||
},
|
},
|
||||||
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,
|
||||||
])),
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +93,10 @@ class StandardListSeparator extends StatelessWidget {
|
||||||
padding: padding,
|
padding: padding,
|
||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: height, color: Theme.of(context).primaryTextTheme.titleLarge?.backgroundColor));
|
height: height,
|
||||||
|
color: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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";
|
||||||
}
|
// }
|
||||||
|
|
|
@ -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 = """
|
||||||
|
|
Loading…
Reference in a new issue