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 {
|
||||
String? _name;
|
||||
|
||||
if (g1WalletsBox.get(_pubkey)!.csName != null) {
|
||||
if (g1WalletsBox.get(_pubkey)?.csName != null) {
|
||||
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() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
@ -151,9 +151,6 @@ class SubstrateSdk with ChangeNotifier {
|
|||
// sdk.api.setting.unsubscribeBestNumber();
|
||||
account.balance = await getBalance(element.address!);
|
||||
result.add(account);
|
||||
print('waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
print(element.indexInfo);
|
||||
print(element.memo);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -207,7 +204,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
return gen.mnemonic!;
|
||||
}
|
||||
|
||||
pay(BuildContext context, String address, double amount,
|
||||
Future<bool> pay(BuildContext context, String address, double amount,
|
||||
String password) async {
|
||||
final sender = TxSenderData(
|
||||
keyring.current.address,
|
||||
|
@ -227,8 +224,10 @@ class SubstrateSdk with ChangeNotifier {
|
|||
},
|
||||
);
|
||||
print(hash.toString());
|
||||
return true;
|
||||
} catch (err) {
|
||||
print(err.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
bool ischangedPin = false;
|
||||
TextEditingController newPin = TextEditingController();
|
||||
bool isEditing = false;
|
||||
bool isBalanceBlur = true;
|
||||
bool isBalanceBlur = false;
|
||||
FocusNode walletNameFocus = FocusNode();
|
||||
TextEditingController nameController = TextEditingController();
|
||||
late bool isDefaultWallet;
|
||||
|
@ -174,7 +174,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
String? getAddress(int chest, int derivation) {
|
||||
String? _address;
|
||||
walletBox.toMap().forEach((key, value) {
|
||||
if (value.chest == chest) {
|
||||
if (value.chest == chest && value.derivation == derivation) {
|
||||
_address = value.address!;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
|||
|
||||
if (regExp.hasMatch(pubkey) == true &&
|
||||
pubkey.length > 42 &&
|
||||
pubkey.length < 45) {
|
||||
pubkey.length < 50) {
|
||||
log.d("C'est une pubkey !");
|
||||
|
||||
this.pubkey = pubkey;
|
||||
|
|
|
@ -92,7 +92,8 @@ class RestoreChest extends StatelessWidget {
|
|||
await Navigator.push(
|
||||
context,
|
||||
FaderTransition(
|
||||
page: const OnboardingStepThirteen(), isFast: true),
|
||||
page: const OnboardingStepThirteen(),
|
||||
isFast: true),
|
||||
);
|
||||
} else {
|
||||
await badMnemonicPopup(context);
|
||||
|
@ -107,6 +108,30 @@ class RestoreChest extends StatelessWidget {
|
|||
),
|
||||
// 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:gecko/models/chest_data.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/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
|
@ -144,8 +143,6 @@ class UnlockingWallet extends StatelessWidget {
|
|||
Provider.of<WalletOptionsProvider>(context);
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
WalletsProfilesProvider _historyProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context);
|
||||
|
||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
|
@ -232,8 +229,10 @@ class UnlockingWallet extends StatelessWidget {
|
|||
).then((value) => _myWalletProvider.cesiumSeed.clear());
|
||||
} else if (action == "pay") {
|
||||
if (currentChest.isCesium!) {
|
||||
final resultPay = await _historyProvider.pay(context);
|
||||
await paymentsResult(context, resultPay);
|
||||
//TODO: implement substrate pay
|
||||
// final resultPay = await _historyProvider.pay(context);
|
||||
// final resultPay = await _sdk.pay(context);
|
||||
// await paymentsResult(context, resultPay);
|
||||
} else {
|
||||
Navigator.push(
|
||||
context,
|
||||
|
|
|
@ -37,7 +37,7 @@ class WalletOptions extends StatelessWidget {
|
|||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
_walletOptions.isEditing = false;
|
||||
_walletOptions.isBalanceBlur = true;
|
||||
_walletOptions.isBalanceBlur = false;
|
||||
Navigator.pop(context);
|
||||
return Future<bool>.value(true);
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ class WalletOptions extends StatelessWidget {
|
|||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||
onPressed: () {
|
||||
_walletOptions.isEditing = false;
|
||||
_walletOptions.isBalanceBlur = true;
|
||||
_walletOptions.isBalanceBlur = false;
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
title: SizedBox(
|
||||
|
@ -90,7 +90,7 @@ class WalletOptions extends StatelessWidget {
|
|||
Column(children: <Widget>[
|
||||
walletName(walletProvider, _walletOptions),
|
||||
SizedBox(height: isTall ? 5 : 0),
|
||||
balance(walletProvider),
|
||||
balance(context, walletProvider),
|
||||
]),
|
||||
const Spacer(flex: 3),
|
||||
]),
|
||||
|
@ -221,44 +221,49 @@ class WalletOptions extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
Widget balance(WalletOptionsProvider walletProvider) {
|
||||
SubstrateSdk _sdk = SubstrateSdk();
|
||||
Widget balance(BuildContext context, WalletOptionsProvider walletProvider) {
|
||||
String balanceCache = '';
|
||||
|
||||
return Column(children: <Widget>[
|
||||
FutureBuilder(
|
||||
future: _sdk.getBalance(walletProvider.address.text),
|
||||
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
|
||||
if (_balance.connectionState != ConnectionState.done ||
|
||||
_balance.hasError) {
|
||||
return Text('',
|
||||
Consumer<SubstrateSdk>(builder: (context, _sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: _sdk.getBalance(walletProvider.address.text),
|
||||
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
|
||||
if (_balance.connectionState != ConnectionState.done ||
|
||||
_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(
|
||||
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(
|
||||
key: const Key('displayBalance'),
|
||||
onTap: () {
|
||||
walletProvider.bluringBalance();
|
||||
},
|
||||
child: Image.asset(
|
||||
walletProvider.isBalanceBlur
|
||||
? 'assets/walletOptions/icon_oeuil.png'
|
||||
: 'assets/walletOptions/icon_oeuil_close.png',
|
||||
height: 35,
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}),
|
||||
|
||||
const SizedBox(height: 15),
|
||||
// InkWell(
|
||||
// key: const Key('displayBalance'),
|
||||
// onTap: () {
|
||||
// walletProvider.bluringBalance();
|
||||
// },
|
||||
// child: Image.asset(
|
||||
// walletProvider.isBalanceBlur
|
||||
// ? 'assets/walletOptions/icon_oeuil.png'
|
||||
// : 'assets/walletOptions/icon_oeuil_close.png',
|
||||
// height: 35,
|
||||
// ),
|
||||
// ),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,9 @@ class OnboardingStepFourteen extends StatelessWidget {
|
|||
pinColor = Colors.green[500];
|
||||
final address = await _sdk.importAccount(
|
||||
fromMnemonic: true,
|
||||
mnemonic: _generateWalletProvider.generatedMnemonic!);
|
||||
mnemonic: _generateWalletProvider.generatedMnemonic!,
|
||||
derivePath: '/3',
|
||||
password: _generateWalletProvider.pin.text);
|
||||
await _generateWalletProvider.storeHDWChest(
|
||||
address, 'Mon portefeuille courant', context);
|
||||
_myWalletProvider.readAllWallets(_currentChest);
|
||||
|
|
|
@ -107,9 +107,11 @@ class SearchResultScreen extends StatelessWidget {
|
|||
]);
|
||||
}
|
||||
if (_avatar.hasData) {
|
||||
g1WalletsBox
|
||||
.get(g1Wallet.pubkey)!
|
||||
.avatar = _avatar.data;
|
||||
final _w =
|
||||
g1WalletsBox.get(g1Wallet.pubkey);
|
||||
if (_w != null) {
|
||||
_w.avatar = _avatar.data;
|
||||
}
|
||||
return ClipOval(child: _avatar.data);
|
||||
} else {
|
||||
g1WalletsBox
|
||||
|
|
|
@ -974,9 +974,11 @@ packages:
|
|||
polkawallet_sdk:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: polkawallet_sdk
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
path: "."
|
||||
ref: fixAndroidActivityVersion
|
||||
resolved-ref: db17df1a7e421066dd88a16ed46c5cc945b77f82
|
||||
url: "https://github.com/poka-IT/sdk.git"
|
||||
source: git
|
||||
version: "0.4.5"
|
||||
pool:
|
||||
dependency: transitive
|
||||
|
|
|
@ -75,7 +75,10 @@ dependencies:
|
|||
desktop_window: ^0.4.0
|
||||
durt: ^0.1.6
|
||||
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:
|
||||
android: true
|
||||
|
|
Loading…
Reference in New Issue