mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-24 03:26:38 +00:00
Merge pull request #39 from cake-tech/CWA-175-seed-language
Cwa 175 seed language
This commit is contained in:
commit
00307cb55c
41 changed files with 12078 additions and 388 deletions
|
@ -34,7 +34,7 @@ final loadWalletNative = moneroApi
|
||||||
void createWalletSync(
|
void createWalletSync(
|
||||||
{String path,
|
{String path,
|
||||||
String password,
|
String password,
|
||||||
String language = 'English',
|
String language,
|
||||||
int nettype = 0}) {
|
int nettype = 0}) {
|
||||||
final pathPointer = Utf8.toUtf8(path);
|
final pathPointer = Utf8.toUtf8(path);
|
||||||
final passwordPointer = Utf8.toUtf8(password);
|
final passwordPointer = Utf8.toUtf8(password);
|
||||||
|
@ -95,7 +95,7 @@ void restoreWalletFromSeedSync(
|
||||||
void restoreWalletFromKeysSync(
|
void restoreWalletFromKeysSync(
|
||||||
{String path,
|
{String path,
|
||||||
String password,
|
String password,
|
||||||
String language = 'English',
|
String language,
|
||||||
String address,
|
String address,
|
||||||
String viewKey,
|
String viewKey,
|
||||||
String spendKey,
|
String spendKey,
|
||||||
|
@ -145,8 +145,9 @@ void loadWallet({String path, String password, int nettype = 0}) {
|
||||||
void _createWallet(Map<String, dynamic> args) {
|
void _createWallet(Map<String, dynamic> args) {
|
||||||
final path = args['path'] as String;
|
final path = args['path'] as String;
|
||||||
final password = args['password'] as String;
|
final password = args['password'] as String;
|
||||||
|
final language = args['language'] as String;
|
||||||
|
|
||||||
createWalletSync(path: path, password: password);
|
createWalletSync(path: path, password: password, language: language);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _restoreFromSeed(Map<String, dynamic> args) {
|
void _restoreFromSeed(Map<String, dynamic> args) {
|
||||||
|
@ -162,6 +163,7 @@ void _restoreFromSeed(Map<String, dynamic> args) {
|
||||||
void _restoreFromKeys(Map<String, dynamic> args) {
|
void _restoreFromKeys(Map<String, dynamic> args) {
|
||||||
final path = args['path'] as String;
|
final path = args['path'] as String;
|
||||||
final password = args['password'] as String;
|
final password = args['password'] as String;
|
||||||
|
final language = args['language'] as String;
|
||||||
final restoreHeight = args['restoreHeight'] as int;
|
final restoreHeight = args['restoreHeight'] as int;
|
||||||
final address = args['address'] as String;
|
final address = args['address'] as String;
|
||||||
final viewKey = args['viewKey'] as String;
|
final viewKey = args['viewKey'] as String;
|
||||||
|
@ -170,6 +172,7 @@ void _restoreFromKeys(Map<String, dynamic> args) {
|
||||||
restoreWalletFromKeysSync(
|
restoreWalletFromKeysSync(
|
||||||
path: path,
|
path: path,
|
||||||
password: password,
|
password: password,
|
||||||
|
language: language,
|
||||||
restoreHeight: restoreHeight,
|
restoreHeight: restoreHeight,
|
||||||
address: address,
|
address: address,
|
||||||
viewKey: viewKey,
|
viewKey: viewKey,
|
||||||
|
@ -190,7 +193,7 @@ Future<void> openWalletAsync(Map<String, String> args) async =>
|
||||||
Future<void> createWallet(
|
Future<void> createWallet(
|
||||||
{String path,
|
{String path,
|
||||||
String password,
|
String password,
|
||||||
String language = 'English',
|
String language,
|
||||||
int nettype = 0}) async =>
|
int nettype = 0}) async =>
|
||||||
compute(_createWallet, {
|
compute(_createWallet, {
|
||||||
'path': path,
|
'path': path,
|
||||||
|
@ -216,7 +219,7 @@ Future restoreFromSeed(
|
||||||
Future restoreFromKeys(
|
Future restoreFromKeys(
|
||||||
{String path,
|
{String path,
|
||||||
String password,
|
String password,
|
||||||
String language = 'English',
|
String language,
|
||||||
String address,
|
String address,
|
||||||
String viewKey,
|
String viewKey,
|
||||||
String spendKey,
|
String spendKey,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -35,6 +35,7 @@ import 'package:cake_wallet/src/domain/common/wallet_type.dart';
|
||||||
import 'package:cake_wallet/src/domain/services/wallet_service.dart';
|
import 'package:cake_wallet/src/domain/services/wallet_service.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/src/domain/common/language.dart';
|
import 'package:cake_wallet/src/domain/common/language.dart';
|
||||||
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
@ -99,6 +100,7 @@ void main() async {
|
||||||
priceStore: priceStore);
|
priceStore: priceStore);
|
||||||
final loginStore = LoginStore(
|
final loginStore = LoginStore(
|
||||||
sharedPreferences: sharedPreferences, walletsService: walletListService);
|
sharedPreferences: sharedPreferences, walletsService: walletListService);
|
||||||
|
final seedLanguageStore = SeedLanguageStore();
|
||||||
|
|
||||||
setReactions(
|
setReactions(
|
||||||
settingsStore: settingsStore,
|
settingsStore: settingsStore,
|
||||||
|
@ -123,7 +125,8 @@ void main() async {
|
||||||
Provider(create: (_) => contacts),
|
Provider(create: (_) => contacts),
|
||||||
Provider(create: (_) => nodes),
|
Provider(create: (_) => nodes),
|
||||||
Provider(create: (_) => transactionDescriptions),
|
Provider(create: (_) => transactionDescriptions),
|
||||||
Provider(create: (_) => trades)
|
Provider(create: (_) => trades),
|
||||||
|
Provider(create: (_) => seedLanguageStore)
|
||||||
], child: CakeWalletApp()));
|
], child: CakeWalletApp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ import 'package:cake_wallet/src/screens/restore/restore_wallet_from_seed_page.da
|
||||||
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_keys_page.dart';
|
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_keys_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/send/send_page.dart';
|
import 'package:cake_wallet/src/screens/send/send_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart';
|
import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/seed_alert/seed_alert.dart';
|
import 'package:cake_wallet/src/screens/seed_language/seed_language_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart';
|
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/accounts/account_page.dart';
|
import 'package:cake_wallet/src/screens/accounts/account_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/accounts/account_list_page.dart';
|
import 'package:cake_wallet/src/screens/accounts/account_list_page.dart';
|
||||||
|
@ -261,8 +261,8 @@ class Router {
|
||||||
return CupertinoPageRoute<void>(
|
return CupertinoPageRoute<void>(
|
||||||
builder: (_) => DisclaimerPage(isReadOnly: true));
|
builder: (_) => DisclaimerPage(isReadOnly: true));
|
||||||
|
|
||||||
case Routes.seedAlert:
|
case Routes.seedLanguage:
|
||||||
return CupertinoPageRoute<void>(builder: (_) => SeedAlert());
|
return CupertinoPageRoute<void>(builder: (_) => SeedLanguage());
|
||||||
|
|
||||||
case Routes.walletList:
|
case Routes.walletList:
|
||||||
return MaterialPageRoute<void>(
|
return MaterialPageRoute<void>(
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Routes {
|
||||||
static const newSubaddress = '/new_subaddress';
|
static const newSubaddress = '/new_subaddress';
|
||||||
static const disclaimer = '/disclaimer';
|
static const disclaimer = '/disclaimer';
|
||||||
static const readDisclaimer = '/read_disclaimer';
|
static const readDisclaimer = '/read_disclaimer';
|
||||||
static const seedAlert = '/seed_alert';
|
static const seedLanguage = '/seed_language';
|
||||||
static const walletList = '/wallet_list';
|
static const walletList = '/wallet_list';
|
||||||
static const auth = '/auth';
|
static const auth = '/auth';
|
||||||
static const nodeList = '/node_list';
|
static const nodeList = '/node_list';
|
||||||
|
|
|
@ -2,12 +2,12 @@ import 'package:cake_wallet/src/domain/common/wallet.dart';
|
||||||
import 'package:cake_wallet/src/domain/common/wallet_description.dart';
|
import 'package:cake_wallet/src/domain/common/wallet_description.dart';
|
||||||
|
|
||||||
abstract class WalletsManager {
|
abstract class WalletsManager {
|
||||||
Future<Wallet> create(String name, String password);
|
Future<Wallet> create(String name, String password, String language);
|
||||||
|
|
||||||
Future<Wallet> restoreFromSeed(
|
Future<Wallet> restoreFromSeed(
|
||||||
String name, String password, String seed, int restoreHeight);
|
String name, String password, String seed, int restoreHeight);
|
||||||
|
|
||||||
Future<Wallet> restoreFromKeys(String name, String password,
|
Future<Wallet> restoreFromKeys(String name, String password, String language,
|
||||||
int restoreHeight, String address, String viewKey, String spendKey);
|
int restoreHeight, String address, String viewKey, String spendKey);
|
||||||
|
|
||||||
Future<Wallet> openWallet(String name, String password);
|
Future<Wallet> openWallet(String name, String password);
|
||||||
|
|
1630
lib/src/domain/monero/mnemonics/chinese_simplified.dart
Normal file
1630
lib/src/domain/monero/mnemonics/chinese_simplified.dart
Normal file
File diff suppressed because it is too large
Load diff
1630
lib/src/domain/monero/mnemonics/dutch.dart
Normal file
1630
lib/src/domain/monero/mnemonics/dutch.dart
Normal file
File diff suppressed because it is too large
Load diff
1630
lib/src/domain/monero/mnemonics/german.dart
Normal file
1630
lib/src/domain/monero/mnemonics/german.dart
Normal file
File diff suppressed because it is too large
Load diff
1630
lib/src/domain/monero/mnemonics/japanese.dart
Normal file
1630
lib/src/domain/monero/mnemonics/japanese.dart
Normal file
File diff suppressed because it is too large
Load diff
1630
lib/src/domain/monero/mnemonics/portuguese.dart
Normal file
1630
lib/src/domain/monero/mnemonics/portuguese.dart
Normal file
File diff suppressed because it is too large
Load diff
1630
lib/src/domain/monero/mnemonics/russian.dart
Normal file
1630
lib/src/domain/monero/mnemonics/russian.dart
Normal file
File diff suppressed because it is too large
Load diff
1630
lib/src/domain/monero/mnemonics/spanish.dart
Normal file
1630
lib/src/domain/monero/mnemonics/spanish.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -31,12 +31,12 @@ class MoneroWalletsManager extends WalletsManager {
|
||||||
Box<WalletInfo> walletInfoSource;
|
Box<WalletInfo> walletInfoSource;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Wallet> create(String name, String password) async {
|
Future<Wallet> create(String name, String password, String language) async {
|
||||||
try {
|
try {
|
||||||
const isRecovery = false;
|
const isRecovery = false;
|
||||||
final path = await pathForWallet(name: name);
|
final path = await pathForWallet(name: name);
|
||||||
|
|
||||||
await monero_wallet_manager.createWallet(path: path, password: password);
|
await monero_wallet_manager.createWallet(path: path, password: password, language: language);
|
||||||
|
|
||||||
final wallet = await MoneroWallet.createdWallet(
|
final wallet = await MoneroWallet.createdWallet(
|
||||||
walletInfoSource: walletInfoSource,
|
walletInfoSource: walletInfoSource,
|
||||||
|
@ -82,6 +82,7 @@ class MoneroWalletsManager extends WalletsManager {
|
||||||
Future<Wallet> restoreFromKeys(
|
Future<Wallet> restoreFromKeys(
|
||||||
String name,
|
String name,
|
||||||
String password,
|
String password,
|
||||||
|
String language,
|
||||||
int restoreHeight,
|
int restoreHeight,
|
||||||
String address,
|
String address,
|
||||||
String viewKey,
|
String viewKey,
|
||||||
|
@ -93,6 +94,7 @@ class MoneroWalletsManager extends WalletsManager {
|
||||||
await monero_wallet_manager.restoreFromKeys(
|
await monero_wallet_manager.restoreFromKeys(
|
||||||
path: path,
|
path: path,
|
||||||
password: password,
|
password: password,
|
||||||
|
language: language,
|
||||||
restoreHeight: restoreHeight,
|
restoreHeight: restoreHeight,
|
||||||
address: address,
|
address: address,
|
||||||
viewKey: viewKey,
|
viewKey: viewKey,
|
||||||
|
|
|
@ -41,7 +41,7 @@ class WalletListService {
|
||||||
.map((info) => WalletDescription(name: info.name, type: info.type))
|
.map((info) => WalletDescription(name: info.name, type: info.type))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
Future create(String name) async {
|
Future create(String name, String language) async {
|
||||||
if (await walletsManager.isWalletExit(name)) {
|
if (await walletsManager.isWalletExit(name)) {
|
||||||
throw WalletIsExistException(name);
|
throw WalletIsExistException(name);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class WalletListService {
|
||||||
final password = Uuid().v4();
|
final password = Uuid().v4();
|
||||||
await saveWalletPassword(password: password, walletName: name);
|
await saveWalletPassword(password: password, walletName: name);
|
||||||
|
|
||||||
final wallet = await walletsManager.create(name, password);
|
final wallet = await walletsManager.create(name, password, language);
|
||||||
|
|
||||||
await onWalletChange(wallet);
|
await onWalletChange(wallet);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ class WalletListService {
|
||||||
await onWalletChange(wallet);
|
await onWalletChange(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future restoreFromKeys(String name, int restoreHeight, String address,
|
Future restoreFromKeys(String name, String language, int restoreHeight, String address,
|
||||||
String viewKey, String spendKey) async {
|
String viewKey, String spendKey) async {
|
||||||
if (await walletsManager.isWalletExit(name)) {
|
if (await walletsManager.isWalletExit(name)) {
|
||||||
throw WalletIsExistException(name);
|
throw WalletIsExistException(name);
|
||||||
|
@ -90,7 +90,7 @@ class WalletListService {
|
||||||
await saveWalletPassword(password: password, walletName: name);
|
await saveWalletPassword(password: password, walletName: name);
|
||||||
|
|
||||||
final wallet = await walletsManager.restoreFromKeys(
|
final wallet = await walletsManager.restoreFromKeys(
|
||||||
name, password, restoreHeight, address, viewKey, spendKey);
|
name, password, language, restoreHeight, address, viewKey, spendKey);
|
||||||
|
|
||||||
await onWalletChange(wallet);
|
await onWalletChange(wallet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
|
||||||
|
|
||||||
class NewWalletPage extends BasePage {
|
class NewWalletPage extends BasePage {
|
||||||
NewWalletPage(
|
NewWalletPage(
|
||||||
|
@ -43,6 +45,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final walletCreationStore = Provider.of<WalletCreationStore>(context);
|
final walletCreationStore = Provider.of<WalletCreationStore>(context);
|
||||||
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
||||||
|
|
||||||
reaction((_) => walletCreationStore.state, (WalletCreationState state) {
|
reaction((_) => walletCreationStore.state, (WalletCreationState state) {
|
||||||
if (state is WalletCreatedSuccessfully) {
|
if (state is WalletCreatedSuccessfully) {
|
||||||
|
@ -100,6 +103,16 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||||
return walletCreationStore.errorMessage;
|
return walletCreationStore.errorMessage;
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
|
),
|
||||||
|
Padding(padding: EdgeInsets.only(bottom: 20),
|
||||||
|
child: Text(
|
||||||
|
S.of(context).seed_language_choose,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 16.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
||||||
|
child: SeedLanguagePicker(),
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
bottomSection: Observer(
|
bottomSection: Observer(
|
||||||
|
@ -107,7 +120,8 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||||
return LoadingPrimaryButton(
|
return LoadingPrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState.validate()) {
|
if (_formKey.currentState.validate()) {
|
||||||
walletCreationStore.create(name: nameController.text);
|
walletCreationStore.create(name: nameController.text,
|
||||||
|
language: seedLanguageStore.selectedSeedLanguage);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
text: S.of(context).continue_text,
|
text: S.of(context).continue_text,
|
||||||
|
|
|
@ -15,6 +15,7 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
|
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
|
||||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
||||||
|
|
||||||
class RestoreWalletFromKeysPage extends BasePage {
|
class RestoreWalletFromKeysPage extends BasePage {
|
||||||
RestoreWalletFromKeysPage(
|
RestoreWalletFromKeysPage(
|
||||||
|
@ -49,6 +50,7 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final walletRestorationStore = Provider.of<WalletRestorationStore>(context);
|
final walletRestorationStore = Provider.of<WalletRestorationStore>(context);
|
||||||
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
||||||
|
|
||||||
reaction((_) => walletRestorationStore.state, (WalletRestorationState state) {
|
reaction((_) => walletRestorationStore.state, (WalletRestorationState state) {
|
||||||
if (state is WalletRestoredSuccessfully) {
|
if (state is WalletRestoredSuccessfully) {
|
||||||
|
@ -206,6 +208,7 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
|
||||||
if (_formKey.currentState.validate()) {
|
if (_formKey.currentState.validate()) {
|
||||||
walletRestorationStore.restoreFromKeys(
|
walletRestorationStore.restoreFromKeys(
|
||||||
name: _nameController.text,
|
name: _nameController.text,
|
||||||
|
language: seedLanguageStore.selectedSeedLanguage,
|
||||||
address: _addressController.text,
|
address: _addressController.text,
|
||||||
viewKey: _viewKeyController.text,
|
viewKey: _viewKeyController.text,
|
||||||
spendKey: _spendKeyController.text,
|
spendKey: _spendKeyController.text,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:mobx/mobx.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -11,6 +10,7 @@ import 'package:cake_wallet/src/domain/services/wallet_service.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/stores/wallet_restoration/wallet_restoration_store.dart';
|
import 'package:cake_wallet/src/stores/wallet_restoration/wallet_restoration_store.dart';
|
||||||
import 'package:cake_wallet/src/widgets/seed_widget.dart';
|
import 'package:cake_wallet/src/widgets/seed_widget.dart';
|
||||||
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
||||||
|
|
||||||
class RestoreWalletFromSeedPage extends BasePage {
|
class RestoreWalletFromSeedPage extends BasePage {
|
||||||
RestoreWalletFromSeedPage(
|
RestoreWalletFromSeedPage(
|
||||||
|
@ -53,6 +53,7 @@ class _RestoreFromSeedFormState extends State<RestoreFromSeedForm> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final walletRestorationStore = Provider.of<WalletRestorationStore>(context);
|
final walletRestorationStore = Provider.of<WalletRestorationStore>(context);
|
||||||
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
|
@ -65,6 +66,7 @@ class _RestoreFromSeedFormState extends State<RestoreFromSeedForm> {
|
||||||
onFinish: () => Navigator.of(context).pushNamed(
|
onFinish: () => Navigator.of(context).pushNamed(
|
||||||
Routes.restoreWalletFromSeedDetails,
|
Routes.restoreWalletFromSeedDetails,
|
||||||
arguments: _seedKey.currentState.items),
|
arguments: _seedKey.currentState.items),
|
||||||
|
seedLanguage: seedLanguageStore.selectedSeedLanguage,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:cake_wallet/src/screens/restore/widgets/restore_button.dart';
|
import 'package:cake_wallet/src/screens/restore/widgets/restore_button.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class RestoreWalletOptionsPage extends BasePage {
|
class RestoreWalletOptionsPage extends BasePage {
|
||||||
static const _aspectRatioImage = 2.086;
|
static const _aspectRatioImage = 2.086;
|
||||||
|
@ -19,38 +21,46 @@ class RestoreWalletOptionsPage extends BasePage {
|
||||||
final _imageKeys = Image.asset('assets/images/keysIco.png');
|
final _imageKeys = Image.asset('assets/images/keysIco.png');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) => Container(
|
Widget body(BuildContext context) {
|
||||||
padding: EdgeInsets.only(
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
||||||
left: 20.0,
|
|
||||||
right: 20.0,
|
return Container(
|
||||||
),
|
padding: EdgeInsets.only(
|
||||||
child: Column(
|
left: 20.0,
|
||||||
children: <Widget>[
|
right: 20.0,
|
||||||
Flexible(
|
),
|
||||||
child: RestoreButton(
|
child: Column(
|
||||||
onPressed: () =>
|
children: <Widget>[
|
||||||
Navigator.pushNamed(context, Routes.restoreWalletFromSeed),
|
Flexible(
|
||||||
image: _imageSeed,
|
child: RestoreButton(
|
||||||
aspectRatioImage: _aspectRatioImage,
|
onPressed: () {
|
||||||
titleColor: Palette.lightViolet,
|
seedLanguageStore.setCurrentRoute(Routes.restoreWalletFromSeed);
|
||||||
color: Palette.lightViolet,
|
Navigator.pushNamed(context, Routes.seedLanguage);
|
||||||
title: S.of(context).restore_title_from_seed,
|
},
|
||||||
description: S.of(context).restore_description_from_seed,
|
image: _imageSeed,
|
||||||
textButton: S.of(context).restore_next,
|
aspectRatioImage: _aspectRatioImage,
|
||||||
)),
|
titleColor: Palette.lightViolet,
|
||||||
Flexible(
|
color: Palette.lightViolet,
|
||||||
child: RestoreButton(
|
title: S.of(context).restore_title_from_seed,
|
||||||
onPressed: () =>
|
description: S.of(context).restore_description_from_seed,
|
||||||
Navigator.pushNamed(context, Routes.restoreWalletFromKeys),
|
textButton: S.of(context).restore_next,
|
||||||
image: _imageKeys,
|
)),
|
||||||
aspectRatioImage: _aspectRatioImage,
|
Flexible(
|
||||||
titleColor: Palette.cakeGreen,
|
child: RestoreButton(
|
||||||
color: Palette.cakeGreen,
|
onPressed: () {
|
||||||
title: S.of(context).restore_title_from_keys,
|
seedLanguageStore.setCurrentRoute(Routes.restoreWalletFromKeys);
|
||||||
description: S.of(context).restore_description_from_keys,
|
Navigator.pushNamed(context, Routes.seedLanguage);
|
||||||
textButton: S.of(context).restore_next,
|
},
|
||||||
))
|
image: _imageKeys,
|
||||||
],
|
aspectRatioImage: _aspectRatioImage,
|
||||||
),
|
titleColor: Palette.cakeGreen,
|
||||||
);
|
color: Palette.cakeGreen,
|
||||||
|
title: S.of(context).restore_title_from_keys,
|
||||||
|
description: S.of(context).restore_description_from_keys,
|
||||||
|
textButton: S.of(context).restore_next,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:cake_wallet/palette.dart';
|
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
|
||||||
|
|
||||||
class SeedAlert extends StatelessWidget {
|
|
||||||
final imageSeed = Image.asset('assets/images/seedIco.png');
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
resizeToAvoidBottomPadding: false,
|
|
||||||
backgroundColor: Theme.of(context).backgroundColor,
|
|
||||||
body: SafeArea(
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(20.0),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
imageSeed,
|
|
||||||
Text(
|
|
||||||
S.of(context).seed_alert_first_text,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(fontSize: 19.0),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.0,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
S.of(context).seed_alert_second_text,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
letterSpacing: 0.2,
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Palette.lightBlue),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.0,
|
|
||||||
),
|
|
||||||
RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(children: <TextSpan>[
|
|
||||||
TextSpan(
|
|
||||||
text: S.of(context).seed_alert_third_text,
|
|
||||||
style: TextStyle(
|
|
||||||
letterSpacing: 0.2,
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Palette.lightBlue)),
|
|
||||||
TextSpan(
|
|
||||||
text: S.of(context).seed_alert_settings,
|
|
||||||
style: TextStyle(
|
|
||||||
letterSpacing: 0.2,
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Palette.lightGreen)),
|
|
||||||
TextSpan(
|
|
||||||
text: S.of(context).seed_alert_menu,
|
|
||||||
style: TextStyle(
|
|
||||||
letterSpacing: 0.2,
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Palette.lightBlue)),
|
|
||||||
]))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
PrimaryButton(
|
|
||||||
onPressed: () {},
|
|
||||||
text: S.of(context).seed_alert_understand,
|
|
||||||
color:
|
|
||||||
Theme.of(context).primaryTextTheme.button.backgroundColor,
|
|
||||||
borderColor:
|
|
||||||
Theme.of(context).primaryTextTheme.button.decorationColor),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
52
lib/src/screens/seed_language/seed_language_page.dart
Normal file
52
lib/src/screens/seed_language/seed_language_page.dart
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
||||||
|
|
||||||
|
class SeedLanguage extends BasePage {
|
||||||
|
final imageSeed = Image.asset('assets/images/seedIco.png');
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget body(BuildContext context) {
|
||||||
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
imageSeed,
|
||||||
|
Text(
|
||||||
|
S.of(context).seed_language_choose,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 16.0),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
SeedLanguagePicker(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PrimaryButton(
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute),
|
||||||
|
text: S.of(context).seed_language_next,
|
||||||
|
color:
|
||||||
|
Theme.of(context).primaryTextTheme.button.backgroundColor,
|
||||||
|
borderColor:
|
||||||
|
Theme.of(context).primaryTextTheme.button.decorationColor),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:cake_wallet/palette.dart';
|
||||||
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/present_picker.dart';
|
||||||
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
|
||||||
|
class SeedLanguagePicker extends StatelessWidget {
|
||||||
|
List<String> seedLocales = [
|
||||||
|
S.current.seed_language_english,
|
||||||
|
S.current.seed_language_chinese,
|
||||||
|
S.current.seed_language_dutch,
|
||||||
|
S.current.seed_language_german,
|
||||||
|
S.current.seed_language_japanese,
|
||||||
|
S.current.seed_language_portuguese,
|
||||||
|
S.current.seed_language_russian,
|
||||||
|
S.current.seed_language_spanish
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
||||||
|
|
||||||
|
return Observer(
|
||||||
|
builder: (_) => InkWell(
|
||||||
|
onTap: () => _setSeedLanguage(context),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
//width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Theme.of(context).dividerTheme.color
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.0)
|
||||||
|
),
|
||||||
|
child: Text(seedLocales[seedLanguages.indexOf(seedLanguageStore.selectedSeedLanguage)],
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 16.0, color: Palette.lightBlue),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _setSeedLanguage(BuildContext context) async {
|
||||||
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
||||||
|
String selectedSeedLanguage =
|
||||||
|
await presentPicker(context, seedLocales);
|
||||||
|
|
||||||
|
if (selectedSeedLanguage != null) {
|
||||||
|
selectedSeedLanguage = seedLanguages[seedLocales.indexOf(selectedSeedLanguage)];
|
||||||
|
seedLanguageStore.setSelectedSeedLanguage(selectedSeedLanguage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import 'package:cake_wallet/src/screens/settings/attributes.dart';
|
||||||
import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart';
|
import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/settings/items/settings_item.dart';
|
import 'package:cake_wallet/src/screens/settings/items/settings_item.dart';
|
||||||
import 'package:cake_wallet/src/screens/settings/items/item_headers.dart';
|
import 'package:cake_wallet/src/screens/settings/items/item_headers.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/present_picker.dart';
|
||||||
// Settings widgets
|
// Settings widgets
|
||||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_arrow_list_row.dart';
|
import 'package:cake_wallet/src/screens/settings/widgets/settings_arrow_list_row.dart';
|
||||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_header_list_row.dart';
|
import 'package:cake_wallet/src/screens/settings/widgets/settings_header_list_row.dart';
|
||||||
|
@ -397,51 +398,10 @@ class SettingsFormState extends State<SettingsForm> {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<T> _presentPicker<T extends Object>(
|
|
||||||
BuildContext context, List<T> list) async {
|
|
||||||
T _value = list[0];
|
|
||||||
|
|
||||||
return await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(S.of(context).please_select),
|
|
||||||
backgroundColor: Theme.of(context).backgroundColor,
|
|
||||||
content: Container(
|
|
||||||
height: 150.0,
|
|
||||||
child: CupertinoPicker(
|
|
||||||
backgroundColor: Theme.of(context).backgroundColor,
|
|
||||||
itemExtent: 45.0,
|
|
||||||
onSelectedItemChanged: (int index) => _value = list[index],
|
|
||||||
children: List.generate(
|
|
||||||
list.length,
|
|
||||||
(index) => Center(
|
|
||||||
child: Text(
|
|
||||||
list[index].toString(),
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.caption
|
|
||||||
.color),
|
|
||||||
),
|
|
||||||
))),
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
FlatButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(S.of(context).cancel)),
|
|
||||||
FlatButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(_value),
|
|
||||||
child: Text(S.of(context).ok))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _setBalance(BuildContext context) async {
|
Future<void> _setBalance(BuildContext context) async {
|
||||||
final settingsStore = Provider.of<SettingsStore>(context);
|
final settingsStore = Provider.of<SettingsStore>(context);
|
||||||
final selectedDisplayMode =
|
final selectedDisplayMode =
|
||||||
await _presentPicker(context, BalanceDisplayMode.all);
|
await presentPicker(context, BalanceDisplayMode.all);
|
||||||
|
|
||||||
if (selectedDisplayMode != null) {
|
if (selectedDisplayMode != null) {
|
||||||
await settingsStore.setCurrentBalanceDisplayMode(
|
await settingsStore.setCurrentBalanceDisplayMode(
|
||||||
|
@ -451,7 +411,7 @@ class SettingsFormState extends State<SettingsForm> {
|
||||||
|
|
||||||
Future<void> _setCurrency(BuildContext context) async {
|
Future<void> _setCurrency(BuildContext context) async {
|
||||||
final settingsStore = Provider.of<SettingsStore>(context);
|
final settingsStore = Provider.of<SettingsStore>(context);
|
||||||
final selectedCurrency = await _presentPicker(context, FiatCurrency.all);
|
final selectedCurrency = await presentPicker(context, FiatCurrency.all);
|
||||||
|
|
||||||
if (selectedCurrency != null) {
|
if (selectedCurrency != null) {
|
||||||
await settingsStore.setCurrentFiatCurrency(currency: selectedCurrency);
|
await settingsStore.setCurrentFiatCurrency(currency: selectedCurrency);
|
||||||
|
@ -461,7 +421,7 @@ class SettingsFormState extends State<SettingsForm> {
|
||||||
Future<void> _setTransactionPriority(BuildContext context) async {
|
Future<void> _setTransactionPriority(BuildContext context) async {
|
||||||
final settingsStore = Provider.of<SettingsStore>(context);
|
final settingsStore = Provider.of<SettingsStore>(context);
|
||||||
final selectedPriority =
|
final selectedPriority =
|
||||||
await _presentPicker(context, TransactionPriority.all);
|
await presentPicker(context, TransactionPriority.all);
|
||||||
|
|
||||||
if (selectedPriority != null) {
|
if (selectedPriority != null) {
|
||||||
await settingsStore.setCurrentTransactionPriority(
|
await settingsStore.setCurrentTransactionPriority(
|
||||||
|
|
|
@ -100,8 +100,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||||
),
|
),
|
||||||
bottomSection: Column(children: <Widget>[
|
bottomSection: Column(children: <Widget>[
|
||||||
PrimaryIconButton(
|
PrimaryIconButton(
|
||||||
onPressed: () =>
|
onPressed: () => Navigator.of(context).pushNamed(Routes.newWallet),
|
||||||
Navigator.of(context).pushNamed(Routes.newWallet),
|
|
||||||
iconData: Icons.add,
|
iconData: Icons.add,
|
||||||
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
|
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
|
||||||
borderColor:
|
borderColor:
|
||||||
|
|
37
lib/src/stores/seed_language/seed_language_store.dart
Normal file
37
lib/src/stores/seed_language/seed_language_store.dart
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
|
part 'seed_language_store.g.dart';
|
||||||
|
|
||||||
|
const List<String> seedLanguages = [
|
||||||
|
'English',
|
||||||
|
'Chinese (simplified)',
|
||||||
|
'Dutch',
|
||||||
|
'German',
|
||||||
|
'Japanese',
|
||||||
|
'Portuguese',
|
||||||
|
'Russian',
|
||||||
|
'Spanish'
|
||||||
|
];
|
||||||
|
|
||||||
|
class SeedLanguageStore = SeedLanguageStoreBase with _$SeedLanguageStore;
|
||||||
|
|
||||||
|
abstract class SeedLanguageStoreBase with Store {
|
||||||
|
SeedLanguageStoreBase() {
|
||||||
|
selectedSeedLanguage = seedLanguages[0];
|
||||||
|
currentRoute = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
@observable
|
||||||
|
String selectedSeedLanguage;
|
||||||
|
|
||||||
|
String currentRoute;
|
||||||
|
|
||||||
|
@action
|
||||||
|
void setSelectedSeedLanguage(String seedLanguage) {
|
||||||
|
selectedSeedLanguage = seedLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCurrentRoute(String route) {
|
||||||
|
currentRoute = route;
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,12 +32,12 @@ abstract class WalletCreationStoreBase with Store {
|
||||||
bool isValid;
|
bool isValid;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future create({String name}) async {
|
Future create({String name, String language}) async {
|
||||||
state = WalletCreationStateInitial();
|
state = WalletCreationStateInitial();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
state = WalletIsCreating();
|
state = WalletIsCreating();
|
||||||
await walletListService.create(name);
|
await walletListService.create(name, language);
|
||||||
authStore.created();
|
authStore.created();
|
||||||
state = WalletCreatedSuccessfully();
|
state = WalletCreatedSuccessfully();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -56,6 +56,7 @@ abstract class WalleRestorationStoreBase with Store {
|
||||||
@action
|
@action
|
||||||
Future restoreFromKeys(
|
Future restoreFromKeys(
|
||||||
{String name,
|
{String name,
|
||||||
|
String language,
|
||||||
String address,
|
String address,
|
||||||
String viewKey,
|
String viewKey,
|
||||||
String spendKey,
|
String spendKey,
|
||||||
|
@ -65,7 +66,7 @@ abstract class WalleRestorationStoreBase with Store {
|
||||||
try {
|
try {
|
||||||
state = WalletIsRestoring();
|
state = WalletIsRestoring();
|
||||||
await walletListService.restoreFromKeys(
|
await walletListService.restoreFromKeys(
|
||||||
name, restoreHeight, address, viewKey, spendKey);
|
name, language, restoreHeight, address, viewKey, spendKey);
|
||||||
authStore.restored();
|
authStore.restored();
|
||||||
state = WalletRestoredSuccessfully();
|
state = WalletRestoredSuccessfully();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
44
lib/src/widgets/present_picker.dart
Normal file
44
lib/src/widgets/present_picker.dart
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
|
||||||
|
Future<T> presentPicker<T extends Object>(
|
||||||
|
BuildContext context, List<T> list) async {
|
||||||
|
T _value = list[0];
|
||||||
|
|
||||||
|
return await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(S.of(context).please_select),
|
||||||
|
backgroundColor: Theme.of(context).backgroundColor,
|
||||||
|
content: Container(
|
||||||
|
height: 150.0,
|
||||||
|
child: CupertinoPicker(
|
||||||
|
backgroundColor: Theme.of(context).backgroundColor,
|
||||||
|
itemExtent: 45.0,
|
||||||
|
onSelectedItemChanged: (int index) => _value = list[index],
|
||||||
|
children: List.generate(
|
||||||
|
list.length,
|
||||||
|
(index) => Center(
|
||||||
|
child: Text(
|
||||||
|
list[index].toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.caption
|
||||||
|
.color),
|
||||||
|
),
|
||||||
|
))),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
FlatButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(S.of(context).cancel)),
|
||||||
|
FlatButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(_value),
|
||||||
|
child: Text(S.of(context).ok))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
|
@ -4,14 +4,52 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:cake_wallet/src/domain/monero/mnemonics/english.dart';
|
import 'package:cake_wallet/src/domain/monero/mnemonics/english.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/monero/mnemonics/chinese_simplified.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/monero/mnemonics/dutch.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/monero/mnemonics/german.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/monero/mnemonics/japanese.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/monero/mnemonics/portuguese.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/monero/mnemonics/russian.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/monero/mnemonics/spanish.dart';
|
||||||
import 'package:cake_wallet/src/domain/common/mnemotic_item.dart';
|
import 'package:cake_wallet/src/domain/common/mnemotic_item.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
|
||||||
class SeedWidget extends StatefulWidget {
|
class SeedWidget extends StatefulWidget {
|
||||||
SeedWidget({Key key, this.onMnemoticChange, this.onFinish}) : super(key: key);
|
SeedWidget({Key key, this.onMnemoticChange, this.onFinish, this.seedLanguage}) : super(key: key) {
|
||||||
|
switch (seedLanguage) {
|
||||||
|
case 'English':
|
||||||
|
words = EnglishMnemonics.words;
|
||||||
|
break;
|
||||||
|
case 'Chinese (simplified)':
|
||||||
|
words = ChineseSimplifiedMnemonics.words;
|
||||||
|
break;
|
||||||
|
case 'Dutch':
|
||||||
|
words = DutchMnemonics.words;
|
||||||
|
break;
|
||||||
|
case 'German':
|
||||||
|
words = GermanMnemonics.words;
|
||||||
|
break;
|
||||||
|
case 'Japanese':
|
||||||
|
words = JapaneseMnemonics.words;
|
||||||
|
break;
|
||||||
|
case 'Portuguese':
|
||||||
|
words = PortugueseMnemonics.words;
|
||||||
|
break;
|
||||||
|
case 'Russian':
|
||||||
|
words = RussianMnemonics.words;
|
||||||
|
break;
|
||||||
|
case 'Spanish':
|
||||||
|
words = SpanishMnemonics.words;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
words = EnglishMnemonics.words;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final Function(List<MnemoticItem>) onMnemoticChange;
|
final Function(List<MnemoticItem>) onMnemoticChange;
|
||||||
final Function() onFinish;
|
final Function() onFinish;
|
||||||
|
final String seedLanguage;
|
||||||
|
List<String> words;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
SeedWidgetState createState() => SeedWidgetState();
|
SeedWidgetState createState() => SeedWidgetState();
|
||||||
|
@ -42,7 +80,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||||
|
|
||||||
void addMnemotic(String text) {
|
void addMnemotic(String text) {
|
||||||
setState(() => items.add(MnemoticItem(
|
setState(() => items.add(MnemoticItem(
|
||||||
text: text.trim().toLowerCase(), dic: EnglishMnemonics.words)));
|
text: text.trim().toLowerCase(), dic: widget.words)));
|
||||||
_seedController.text = '';
|
_seedController.text = '';
|
||||||
|
|
||||||
if (widget.onMnemoticChange != null) {
|
if (widget.onMnemoticChange != null) {
|
||||||
|
@ -141,7 +179,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
currentMnemotics = splitted
|
currentMnemotics = splitted
|
||||||
.map((text) => MnemoticItem(text: text, dic: EnglishMnemonics.words))
|
.map((text) => MnemoticItem(text: text, dic: widget.words))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
bool isValid = true;
|
bool isValid = true;
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Kopieren",
|
"copy" : "Kopieren",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "Die nächste Seite wird angezeigt\nDu bist ein Seed.",
|
"seed_language_choose" : "Bitte wählen Sie die Ausgangssprache",
|
||||||
"seed_alert_second_text" : "Bitte schreiben Sie diese nur in\nFalls Sie Ihr Telefon verlieren oder abwischen.",
|
"seed_language_next" : "Nächster",
|
||||||
"seed_alert_third_text" : "Sie können den Seed auch wieder sehen\nin dem ",
|
"seed_language_english" : "Englisch",
|
||||||
"seed_alert_settings" : "die Einstellungen",
|
"seed_language_chinese" : "Chinesisch",
|
||||||
"seed_alert_menu" : " Speisekarte.",
|
"seed_language_dutch" : "Niederländisch",
|
||||||
"seed_alert_understand" : "ich verstehe",
|
"seed_language_german" : "Deutsche",
|
||||||
|
"seed_language_japanese" : "Japanisch",
|
||||||
|
"seed_language_portuguese" : "Portugiesisch",
|
||||||
|
"seed_language_russian" : "Russisch",
|
||||||
|
"seed_language_spanish" : "Spanisch",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Senden Sie Monero",
|
"send_title" : "Senden Sie Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Copy",
|
"copy" : "Copy",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "The next page will show\nyou a seed.",
|
"seed_language_choose" : "Please choose seed language",
|
||||||
"seed_alert_second_text" : "Please write these down just in\ncase you lose or wipe your phone.",
|
"seed_language_next" : "Next",
|
||||||
"seed_alert_third_text" : "You can also see the seed again\nin the ",
|
"seed_language_english" : "English",
|
||||||
"seed_alert_settings" : "settings",
|
"seed_language_chinese" : "Chinese",
|
||||||
"seed_alert_menu" : " menu.",
|
"seed_language_dutch" : "Dutch",
|
||||||
"seed_alert_understand" : "I understand",
|
"seed_language_german" : "German",
|
||||||
|
"seed_language_japanese" : "Japanese",
|
||||||
|
"seed_language_portuguese" : "Portuguese",
|
||||||
|
"seed_language_russian" : "Russian",
|
||||||
|
"seed_language_spanish" : "Spanish",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Send Monero",
|
"send_title" : "Send Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Dupdo",
|
"copy" : "Dupdo",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "La siguiente página te mostrará \nuna semilla.",
|
"seed_language_choose" : "Por favor elija el idioma semilla",
|
||||||
"seed_alert_second_text" : "Anótelos solo en caso de que pierda\no limpie su teléfono.",
|
"seed_language_next" : "Próximo",
|
||||||
"seed_alert_third_text" : "También puede ver la semilla nuevamente \nen el ",
|
"seed_language_english" : "Inglés",
|
||||||
"seed_alert_settings" : "de configuración",
|
"seed_language_chinese" : "Chino",
|
||||||
"seed_alert_menu" : " menú .",
|
"seed_language_dutch" : "Holandés",
|
||||||
"seed_alert_understand" : "Entiendo",
|
"seed_language_german" : "Alemán",
|
||||||
|
"seed_language_japanese" : "Japonés",
|
||||||
|
"seed_language_portuguese" : "Portugués",
|
||||||
|
"seed_language_russian" : "Ruso",
|
||||||
|
"seed_language_spanish" : "Español",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Enviar Monero",
|
"send_title" : "Enviar Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "प्रतिलिपि",
|
"copy" : "प्रतिलिपि",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "अगला पेज दिखाएगा\nतुम एक बीज हो.",
|
"seed_language_choose" : "कृपया बीज भाषा चुनें",
|
||||||
"seed_alert_second_text" : "कृपया इन्हें केवल मामले में लिखें\nआप अपना फोन खो देते हैं या मिटा देते हैं.",
|
"seed_language_next" : "आगामी",
|
||||||
"seed_alert_third_text" : "आप बीज को फिर से देख सकते हैं\nमें ",
|
"seed_language_english" : "अंग्रेज़ी",
|
||||||
"seed_alert_settings" : "सेटिंग्स",
|
"seed_language_chinese" : "चीनी",
|
||||||
"seed_alert_menu" : " मेन्यू.",
|
"seed_language_dutch" : "डच",
|
||||||
"seed_alert_understand" : "मै समझता हुँ",
|
"seed_language_german" : "जर्मन",
|
||||||
|
"seed_language_japanese" : "जापानी",
|
||||||
|
"seed_language_portuguese" : "पुर्तगाली",
|
||||||
|
"seed_language_russian" : "रूसी",
|
||||||
|
"seed_language_spanish" : "स्पेनिश",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "संदेश Monero",
|
"send_title" : "संदेश Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "コピー",
|
"copy" : "コピー",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "次のページが表示されます\nあなたは種.",
|
"seed_language_choose" : "シード言語を選択してください",
|
||||||
"seed_alert_second_text" : "これらを書き留めてください \n電話を紛失した場合や拭いた場合.",
|
"seed_language_next" : "次",
|
||||||
"seed_alert_third_text" : "また、種子を見ることができます\nの中に ",
|
"seed_language_english" : "英語",
|
||||||
"seed_alert_settings" : "設定",
|
"seed_language_chinese" : "中国語",
|
||||||
"seed_alert_menu" : " メニュー.",
|
"seed_language_dutch" : "オランダの",
|
||||||
"seed_alert_understand" : "わかります",
|
"seed_language_german" : "ドイツ人",
|
||||||
|
"seed_language_japanese" : "日本語",
|
||||||
|
"seed_language_portuguese" : "ポルトガル語",
|
||||||
|
"seed_language_russian" : "ロシア",
|
||||||
|
"seed_language_spanish" : "スペイン語",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Moneroを送信",
|
"send_title" : "Moneroを送信",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "부",
|
"copy" : "부",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "다음 페이지가 표시됩니다\n당신은 씨앗.",
|
"seed_language_choose" : "종자 언어를 선택하십시오",
|
||||||
"seed_alert_second_text" : "아래에 적어주세요\n휴대 전화를 분실하거나 닦을 경우.",
|
"seed_language_next" : "다음 것",
|
||||||
"seed_alert_third_text" : "당신은 또한 씨앗을 다시 볼 수 있습니다\n에서 ",
|
"seed_language_english" : "영어",
|
||||||
"seed_alert_settings" : "설정",
|
"seed_language_chinese" : "중국말",
|
||||||
"seed_alert_menu" : " 메뉴.",
|
"seed_language_dutch" : "네덜란드 사람",
|
||||||
"seed_alert_understand" : "이해 했어",
|
"seed_language_german" : "독일 사람",
|
||||||
|
"seed_language_japanese" : "일본어",
|
||||||
|
"seed_language_portuguese" : "포르투갈 인",
|
||||||
|
"seed_language_russian" : "러시아인",
|
||||||
|
"seed_language_spanish" : "스페인의",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "모네로 보내기",
|
"send_title" : "모네로 보내기",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Kopiëren",
|
"copy" : "Kopiëren",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "De volgende pagina wordt getoond\njij een zaadje.",
|
"seed_language_choose" : "Kies een starttaal",
|
||||||
"seed_alert_second_text" : "Noteer deze voor het geval dat\nje verliest of veegt je telefoon.",
|
"seed_language_next" : "Volgende",
|
||||||
"seed_alert_third_text" : "Je kunt het zaad ook weer zien\nin de ",
|
"seed_language_english" : "Engels",
|
||||||
"seed_alert_settings" : "instellingen",
|
"seed_language_chinese" : "Chinese",
|
||||||
"seed_alert_menu" : " menu.",
|
"seed_language_dutch" : "Nederlands",
|
||||||
"seed_alert_understand" : "Ik begrijp het",
|
"seed_language_german" : "Duitse",
|
||||||
|
"seed_language_japanese" : "Japans",
|
||||||
|
"seed_language_portuguese" : "Portugees",
|
||||||
|
"seed_language_russian" : "Russisch",
|
||||||
|
"seed_language_spanish" : "Spaans",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Stuur Monero",
|
"send_title" : "Stuur Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Kopiuj",
|
"copy" : "Kopiuj",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "Pojawi się następna strona\nziarno.",
|
"seed_language_choose" : "Proszę wybrać język początkowy",
|
||||||
"seed_alert_second_text" : "Zapisz je na wszelki wypadek\nzgubisz lub wyczyścisz telefon.",
|
"seed_language_next" : "Kolejny",
|
||||||
"seed_alert_third_text" : "Możesz także ponownie zobaczyć ziarno\nw ",
|
"seed_language_english" : "Angielski",
|
||||||
"seed_alert_settings" : "ustawienia",
|
"seed_language_chinese" : "Chiński",
|
||||||
"seed_alert_menu" : " menu.",
|
"seed_language_dutch" : "Holenderski",
|
||||||
"seed_alert_understand" : "rozumiem",
|
"seed_language_german" : "Niemiecki",
|
||||||
|
"seed_language_japanese" : "Japoński",
|
||||||
|
"seed_language_portuguese" : "Portugalski",
|
||||||
|
"seed_language_russian" : "Rosyjski",
|
||||||
|
"seed_language_spanish" : "Hiszpański",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Wyślij Monero",
|
"send_title" : "Wyślij Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Copiar",
|
"copy" : "Copiar",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "A próxima página exibirá\n uma semente.",
|
"seed_language_choose" : "Por favor, escolha o idioma da semente",
|
||||||
"seed_alert_second_text" : "Anote a semente em um papel. Ela é o seu backup\n caso o seu telefone estrague ou seja perdido/roubado.",
|
"seed_language_next" : "Próximo",
|
||||||
"seed_alert_third_text" : "Você também poderá ver a semente novamente\nna seção ",
|
"seed_language_english" : "Inglesa",
|
||||||
"seed_alert_settings" : "configurações",
|
"seed_language_chinese" : "Chinesa",
|
||||||
"seed_alert_menu" : " do menu.",
|
"seed_language_dutch" : "Holandesa",
|
||||||
"seed_alert_understand" : "Eu entendi",
|
"seed_language_german" : "Alemã",
|
||||||
|
"seed_language_japanese" : "Japonês",
|
||||||
|
"seed_language_portuguese" : "Português",
|
||||||
|
"seed_language_russian" : "Russa",
|
||||||
|
"seed_language_spanish" : "Espanhola",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Enviar Monero",
|
"send_title" : "Enviar Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Скопировать",
|
"copy" : "Скопировать",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "Следущая страница содержит\nвашу мнемоническую фразу.",
|
"seed_language_choose" : "Пожалуйста, выберите язык мнемонической фразы",
|
||||||
"seed_alert_second_text" : "Пожалуйста, запишите ее на\nслучай, если вы потеряете или отформатируете свой телефон.",
|
"seed_language_next" : "Продолжить",
|
||||||
"seed_alert_third_text" : "Вы так же можете посмотреть вашу мнемоническую фразу\nв",
|
"seed_language_english" : "Английский",
|
||||||
"seed_alert_settings" : "настройках",
|
"seed_language_chinese" : "Китайский",
|
||||||
"seed_alert_menu" : " меню.",
|
"seed_language_dutch" : "Нидерландский",
|
||||||
"seed_alert_understand" : "Я понимаю",
|
"seed_language_german" : "Немецкий",
|
||||||
|
"seed_language_japanese" : "Японский",
|
||||||
|
"seed_language_portuguese" : "Португальский",
|
||||||
|
"seed_language_russian" : "Русский",
|
||||||
|
"seed_language_spanish" : "Испанский",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Отправить Monero",
|
"send_title" : "Отправить Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "Скопіювати",
|
"copy" : "Скопіювати",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "Наступна сторінка містить\nвашу мнемонічну фразу.",
|
"seed_language_choose" : "Будь ласка, виберіть мову мнемонічної фрази",
|
||||||
"seed_alert_second_text" : "Будь ласка, запишіть її на \nвипадок, якщо ви втратите або відформатуєте ваш телефон.",
|
"seed_language_next" : "Продовжити",
|
||||||
"seed_alert_third_text" : "Також ви можете побачити вашу мнемонічну фразу\nв",
|
"seed_language_english" : "Англійська",
|
||||||
"seed_alert_settings" : "налаштуваннях",
|
"seed_language_chinese" : "Китайська",
|
||||||
"seed_alert_menu" : " меню.",
|
"seed_language_dutch" : "Голландська",
|
||||||
"seed_alert_understand" : "Я розумію",
|
"seed_language_german" : "Німецька",
|
||||||
|
"seed_language_japanese" : "Японська",
|
||||||
|
"seed_language_portuguese" : "Португальська",
|
||||||
|
"seed_language_russian" : "Російська",
|
||||||
|
"seed_language_spanish" : "Іспанська",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "Відправити Monero",
|
"send_title" : "Відправити Monero",
|
||||||
|
|
|
@ -157,12 +157,16 @@
|
||||||
"copy" : "复制",
|
"copy" : "复制",
|
||||||
|
|
||||||
|
|
||||||
"seed_alert_first_text" : "下一页将显示\n你是种子.",
|
"seed_language_choose" : "請選擇種子語言",
|
||||||
"seed_alert_second_text" : "请写下来以防万一\n万一您丢失或擦拭手机.",
|
"seed_language_next" : "下一个",
|
||||||
"seed_alert_third_text" : "您也可以再次看到种子 \n在里面",
|
"seed_language_english" : "英語",
|
||||||
"seed_alert_settings" : "设定",
|
"seed_language_chinese" : "中文",
|
||||||
"seed_alert_menu" : " 菜单.",
|
"seed_language_dutch" : "荷蘭人",
|
||||||
"seed_alert_understand" : "我明白",
|
"seed_language_german" : "德語",
|
||||||
|
"seed_language_japanese" : "日本",
|
||||||
|
"seed_language_portuguese" : "葡萄牙語",
|
||||||
|
"seed_language_russian" : "俄語",
|
||||||
|
"seed_language_spanish" : "西班牙文",
|
||||||
|
|
||||||
|
|
||||||
"send_title" : "发送门罗币",
|
"send_title" : "发送门罗币",
|
||||||
|
|
Loading…
Reference in a new issue