Globalized done
This commit is contained in:
parent
a72390f428
commit
48d997c835
|
@ -63,7 +63,7 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
Future<String> getName(String? _pubkey) async {
|
Future<String> getName(String? _pubkey) async {
|
||||||
String? _name;
|
String? _name;
|
||||||
|
|
||||||
if (g1WalletsBox.get(_pubkey)!.csName != null) {
|
if (g1WalletsBox.get(_pubkey)?.csName != null) {
|
||||||
return g1WalletsBox.get(_pubkey)!.csName!;
|
return g1WalletsBox.get(_pubkey)!.csName!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,6 +390,34 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future pasteMnemonic(BuildContext context) async {
|
||||||
|
final sentence = await Clipboard.getData('text/plain');
|
||||||
|
int nbr = 0;
|
||||||
|
|
||||||
|
List cells = [
|
||||||
|
cellController0,
|
||||||
|
cellController1,
|
||||||
|
cellController2,
|
||||||
|
cellController3,
|
||||||
|
cellController4,
|
||||||
|
cellController5,
|
||||||
|
cellController6,
|
||||||
|
cellController7,
|
||||||
|
cellController8,
|
||||||
|
cellController9,
|
||||||
|
cellController10,
|
||||||
|
cellController11
|
||||||
|
];
|
||||||
|
for (var word in sentence!.text!.split(' ')) {
|
||||||
|
bool isValid = isBipWord(word);
|
||||||
|
|
||||||
|
if (isValid) {
|
||||||
|
cells[nbr].text = word;
|
||||||
|
}
|
||||||
|
nbr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void reloadBuild() {
|
void reloadBuild() {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,6 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
// sdk.api.setting.unsubscribeBestNumber();
|
// sdk.api.setting.unsubscribeBestNumber();
|
||||||
account.balance = await getBalance(element.address!);
|
account.balance = await getBalance(element.address!);
|
||||||
result.add(account);
|
result.add(account);
|
||||||
print('waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
|
||||||
print(element.indexInfo);
|
|
||||||
print(element.memo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -207,7 +204,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
return gen.mnemonic!;
|
return gen.mnemonic!;
|
||||||
}
|
}
|
||||||
|
|
||||||
pay(BuildContext context, String address, double amount,
|
Future<bool> pay(BuildContext context, String address, double amount,
|
||||||
String password) async {
|
String password) async {
|
||||||
final sender = TxSenderData(
|
final sender = TxSenderData(
|
||||||
keyring.current.address,
|
keyring.current.address,
|
||||||
|
@ -227,8 +224,10 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
print(hash.toString());
|
print(hash.toString());
|
||||||
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print(err.toString());
|
print(err.toString());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
bool ischangedPin = false;
|
bool ischangedPin = false;
|
||||||
TextEditingController newPin = TextEditingController();
|
TextEditingController newPin = TextEditingController();
|
||||||
bool isEditing = false;
|
bool isEditing = false;
|
||||||
bool isBalanceBlur = true;
|
bool isBalanceBlur = false;
|
||||||
FocusNode walletNameFocus = FocusNode();
|
FocusNode walletNameFocus = FocusNode();
|
||||||
TextEditingController nameController = TextEditingController();
|
TextEditingController nameController = TextEditingController();
|
||||||
late bool isDefaultWallet;
|
late bool isDefaultWallet;
|
||||||
|
@ -174,7 +174,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
String? getAddress(int chest, int derivation) {
|
String? getAddress(int chest, int derivation) {
|
||||||
String? _address;
|
String? _address;
|
||||||
walletBox.toMap().forEach((key, value) {
|
walletBox.toMap().forEach((key, value) {
|
||||||
if (value.chest == chest) {
|
if (value.chest == chest && value.derivation == derivation) {
|
||||||
_address = value.address!;
|
_address = value.address!;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
|
|
||||||
if (regExp.hasMatch(pubkey) == true &&
|
if (regExp.hasMatch(pubkey) == true &&
|
||||||
pubkey.length > 42 &&
|
pubkey.length > 42 &&
|
||||||
pubkey.length < 45) {
|
pubkey.length < 50) {
|
||||||
log.d("C'est une pubkey !");
|
log.d("C'est une pubkey !");
|
||||||
|
|
||||||
this.pubkey = pubkey;
|
this.pubkey = pubkey;
|
||||||
|
|
|
@ -92,7 +92,8 @@ class RestoreChest extends StatelessWidget {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
page: const OnboardingStepThirteen(), isFast: true),
|
page: const OnboardingStepThirteen(),
|
||||||
|
isFast: true),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await badMnemonicPopup(context);
|
await badMnemonicPopup(context);
|
||||||
|
@ -107,6 +108,30 @@ class RestoreChest extends StatelessWidget {
|
||||||
),
|
),
|
||||||
// SizedBox(height: isTall ? 80 : 80),
|
// SizedBox(height: isTall ? 80 : 80),
|
||||||
))
|
))
|
||||||
|
else
|
||||||
|
Column(children: [
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
|
height: 50,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
elevation: 4,
|
||||||
|
primary: yellowC, // background
|
||||||
|
onPrimary: Colors.black, // foreground
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
generateWalletProvider.pasteMnemonic(context);
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Coller depuis le\npresse-papier',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 16, fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
])
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'dart:async';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/models/chest_data.dart';
|
import 'package:gecko/models/chest_data.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/providers/wallets_profiles.dart';
|
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/providers/wallet_options.dart';
|
import 'package:gecko/providers/wallet_options.dart';
|
||||||
|
@ -144,8 +143,6 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
WalletsProfilesProvider _historyProvider =
|
|
||||||
Provider.of<WalletsProfilesProvider>(context);
|
|
||||||
|
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
|
@ -232,8 +229,10 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
).then((value) => _myWalletProvider.cesiumSeed.clear());
|
).then((value) => _myWalletProvider.cesiumSeed.clear());
|
||||||
} else if (action == "pay") {
|
} else if (action == "pay") {
|
||||||
if (currentChest.isCesium!) {
|
if (currentChest.isCesium!) {
|
||||||
final resultPay = await _historyProvider.pay(context);
|
//TODO: implement substrate pay
|
||||||
await paymentsResult(context, resultPay);
|
// final resultPay = await _historyProvider.pay(context);
|
||||||
|
// final resultPay = await _sdk.pay(context);
|
||||||
|
// await paymentsResult(context, resultPay);
|
||||||
} else {
|
} else {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|
|
@ -37,7 +37,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_walletOptions.isEditing = false;
|
_walletOptions.isEditing = false;
|
||||||
_walletOptions.isBalanceBlur = true;
|
_walletOptions.isBalanceBlur = false;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
|
@ -50,7 +50,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_walletOptions.isEditing = false;
|
_walletOptions.isEditing = false;
|
||||||
_walletOptions.isBalanceBlur = true;
|
_walletOptions.isBalanceBlur = false;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
|
@ -90,7 +90,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
walletName(walletProvider, _walletOptions),
|
walletName(walletProvider, _walletOptions),
|
||||||
SizedBox(height: isTall ? 5 : 0),
|
SizedBox(height: isTall ? 5 : 0),
|
||||||
balance(walletProvider),
|
balance(context, walletProvider),
|
||||||
]),
|
]),
|
||||||
const Spacer(flex: 3),
|
const Spacer(flex: 3),
|
||||||
]),
|
]),
|
||||||
|
@ -221,44 +221,49 @@ class WalletOptions extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget balance(WalletOptionsProvider walletProvider) {
|
Widget balance(BuildContext context, WalletOptionsProvider walletProvider) {
|
||||||
SubstrateSdk _sdk = SubstrateSdk();
|
String balanceCache = '';
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
FutureBuilder(
|
Consumer<SubstrateSdk>(builder: (context, _sdk, _) {
|
||||||
future: _sdk.getBalance(walletProvider.address.text),
|
return FutureBuilder(
|
||||||
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
|
future: _sdk.getBalance(walletProvider.address.text),
|
||||||
if (_balance.connectionState != ConnectionState.done ||
|
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
|
||||||
_balance.hasError) {
|
if (_balance.connectionState != ConnectionState.done ||
|
||||||
return Text('',
|
_balance.hasError) {
|
||||||
|
return Text(balanceCache,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isTall ? 20 : 18,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
balanceCache = "${_balance.data.toString()} Ğ1";
|
||||||
|
return ImageFiltered(
|
||||||
|
imageFilter: ImageFilter.blur(
|
||||||
|
sigmaX: walletProvider.isBalanceBlur ? 6 : 0,
|
||||||
|
sigmaY: walletProvider.isBalanceBlur ? 5 : 0),
|
||||||
|
child: Text(
|
||||||
|
_balance.data.toString() + ' Ğ1',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: isTall ? 20 : 18,
|
fontSize: isTall ? 20 : 18,
|
||||||
));
|
),
|
||||||
}
|
|
||||||
return ImageFiltered(
|
|
||||||
imageFilter: ImageFilter.blur(
|
|
||||||
sigmaX: walletProvider.isBalanceBlur ? 6 : 0,
|
|
||||||
sigmaY: walletProvider.isBalanceBlur ? 5 : 0),
|
|
||||||
child: Text(
|
|
||||||
_balance.data.toString() + ' Ğ1',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: isTall ? 20 : 18,
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
});
|
||||||
}),
|
}),
|
||||||
const SizedBox(height: 5),
|
|
||||||
InkWell(
|
const SizedBox(height: 15),
|
||||||
key: const Key('displayBalance'),
|
// InkWell(
|
||||||
onTap: () {
|
// key: const Key('displayBalance'),
|
||||||
walletProvider.bluringBalance();
|
// onTap: () {
|
||||||
},
|
// walletProvider.bluringBalance();
|
||||||
child: Image.asset(
|
// },
|
||||||
walletProvider.isBalanceBlur
|
// child: Image.asset(
|
||||||
? 'assets/walletOptions/icon_oeuil.png'
|
// walletProvider.isBalanceBlur
|
||||||
: 'assets/walletOptions/icon_oeuil_close.png',
|
// ? 'assets/walletOptions/icon_oeuil.png'
|
||||||
height: 35,
|
// : 'assets/walletOptions/icon_oeuil_close.png',
|
||||||
),
|
// height: 35,
|
||||||
),
|
// ),
|
||||||
|
// ),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,9 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
pinColor = Colors.green[500];
|
pinColor = Colors.green[500];
|
||||||
final address = await _sdk.importAccount(
|
final address = await _sdk.importAccount(
|
||||||
fromMnemonic: true,
|
fromMnemonic: true,
|
||||||
mnemonic: _generateWalletProvider.generatedMnemonic!);
|
mnemonic: _generateWalletProvider.generatedMnemonic!,
|
||||||
|
derivePath: '/3',
|
||||||
|
password: _generateWalletProvider.pin.text);
|
||||||
await _generateWalletProvider.storeHDWChest(
|
await _generateWalletProvider.storeHDWChest(
|
||||||
address, 'Mon portefeuille courant', context);
|
address, 'Mon portefeuille courant', context);
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
|
|
|
@ -107,9 +107,11 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (_avatar.hasData) {
|
if (_avatar.hasData) {
|
||||||
g1WalletsBox
|
final _w =
|
||||||
.get(g1Wallet.pubkey)!
|
g1WalletsBox.get(g1Wallet.pubkey);
|
||||||
.avatar = _avatar.data;
|
if (_w != null) {
|
||||||
|
_w.avatar = _avatar.data;
|
||||||
|
}
|
||||||
return ClipOval(child: _avatar.data);
|
return ClipOval(child: _avatar.data);
|
||||||
} else {
|
} else {
|
||||||
g1WalletsBox
|
g1WalletsBox
|
||||||
|
|
|
@ -974,9 +974,11 @@ packages:
|
||||||
polkawallet_sdk:
|
polkawallet_sdk:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: polkawallet_sdk
|
path: "."
|
||||||
url: "https://pub.dartlang.org"
|
ref: fixAndroidActivityVersion
|
||||||
source: hosted
|
resolved-ref: db17df1a7e421066dd88a16ed46c5cc945b77f82
|
||||||
|
url: "https://github.com/poka-IT/sdk.git"
|
||||||
|
source: git
|
||||||
version: "0.4.5"
|
version: "0.4.5"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
|
|
|
@ -75,7 +75,10 @@ dependencies:
|
||||||
desktop_window: ^0.4.0
|
desktop_window: ^0.4.0
|
||||||
durt: ^0.1.6
|
durt: ^0.1.6
|
||||||
package_info_plus: ^1.4.2
|
package_info_plus: ^1.4.2
|
||||||
polkawallet_sdk: ^0.4.5
|
polkawallet_sdk: #^0.4.5
|
||||||
|
git:
|
||||||
|
url: https://github.com/poka-IT/sdk.git
|
||||||
|
ref: fixAndroidActivityVersion
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: true
|
android: true
|
||||||
|
|
Loading…
Reference in New Issue