change choose wallet in payment popup to dropdown
This commit is contained in:
parent
0a47c3b2e3
commit
611d715ded
|
@ -23,7 +23,7 @@
|
||||||
"toUnlockEnterPassword": "To unlock your safe, enter your secret code, away from prying lizards:",
|
"toUnlockEnterPassword": "To unlock your safe, enter your secret code, away from prying lizards:",
|
||||||
"rememberPassword": "Keep this code in memory for 15 minutes",
|
"rememberPassword": "Keep this code in memory for 15 minutes",
|
||||||
"myRootWallet": "My root wallet",
|
"myRootWallet": "My root wallet",
|
||||||
"currentWallet": "My current chest",
|
"currentWallet": "My current wallet",
|
||||||
"wallet": "Wallet",
|
"wallet": "Wallet",
|
||||||
"displayMnemonic": "Display my mnemonic sentence",
|
"displayMnemonic": "Display my mnemonic sentence",
|
||||||
"changePassword": "Change my password",
|
"changePassword": "Change my password",
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"toUnlockEnterPassword": "Para desbloquear tu cofre, introduce tu contraseña, lejos de lagartijas curiosas:",
|
"toUnlockEnterPassword": "Para desbloquear tu cofre, introduce tu contraseña, lejos de lagartijas curiosas:",
|
||||||
"rememberPassword": "Mantener en memoria mi contraseña durante 15 minutos",
|
"rememberPassword": "Mantener en memoria mi contraseña durante 15 minutos",
|
||||||
"myRootWallet": "Mi monedero principal",
|
"myRootWallet": "Mi monedero principal",
|
||||||
"currentWallet": "Mi cofre actual",
|
"currentWallet": "Mi monedero actual",
|
||||||
"wallet": "monedero",
|
"wallet": "monedero",
|
||||||
"displayMnemonic": "Mostrar mi frase de restauración",
|
"displayMnemonic": "Mostrar mi frase de restauración",
|
||||||
"changePassword": "Cambiar mi contraseña",
|
"changePassword": "Cambiar mi contraseña",
|
||||||
|
|
|
@ -20,7 +20,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
// NewWallet generatedWallet;
|
// NewWallet generatedWallet;
|
||||||
durt.NewWallet? actualWallet;
|
durt.NewWallet? actualWallet;
|
||||||
|
|
||||||
FocusNode walletNameFocus = FocusNode();
|
final walletNameFocus = FocusNode();
|
||||||
Color? askedWordColor = Colors.black;
|
Color? askedWordColor = Colors.black;
|
||||||
bool isAskedWordValid = false;
|
bool isAskedWordValid = false;
|
||||||
int scanedValidWalletNumber = -1;
|
int scanedValidWalletNumber = -1;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import 'package:gecko/widgets/payment_popup.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||||
// import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
|
||||||
|
|
||||||
class WalletsHome extends StatefulWidget {
|
class WalletsHome extends StatefulWidget {
|
||||||
const WalletsHome({Key? key}) : super(key: key);
|
const WalletsHome({Key? key}) : super(key: key);
|
||||||
|
|
|
@ -344,8 +344,23 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
key: keyPay,
|
key: keyPay,
|
||||||
splashColor: yellowC,
|
splashColor: yellowC,
|
||||||
onTap: sub.nodeConnected
|
onTap: sub.nodeConnected
|
||||||
? () {
|
? () async {
|
||||||
paymentPopup(context, address, username);
|
String? pin;
|
||||||
|
if (myWalletProvider.pinCode == '') {
|
||||||
|
pin = await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (homeContext) {
|
||||||
|
return UnlockingWallet(
|
||||||
|
wallet: defaultWallet);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (pin != null ||
|
||||||
|
myWalletProvider.pinCode != '') {
|
||||||
|
paymentPopup(context, address, username);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: const Padding(
|
child: const Padding(
|
||||||
|
|
|
@ -4,12 +4,12 @@ import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/providers/wallet_options.dart';
|
import 'package:gecko/providers/wallet_options.dart';
|
||||||
import 'package:gecko/providers/wallets_profiles.dart';
|
import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
import 'package:gecko/screens/myWallets/choose_wallet.dart';
|
|
||||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||||
import 'package:gecko/widgets/balance.dart';
|
import 'package:gecko/widgets/balance.dart';
|
||||||
|
@ -24,8 +24,10 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
|
||||||
|
|
||||||
double fees = 0;
|
double fees = 0;
|
||||||
const double shapeSize = 20;
|
const double shapeSize = 20;
|
||||||
final defaultWallet = myWalletProvider.getDefaultWallet();
|
var defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
bool canValidate = false;
|
bool canValidate = false;
|
||||||
|
final amountFocus = FocusNode();
|
||||||
|
final dropdownKey = GlobalKey();
|
||||||
|
|
||||||
Future executeTransfert() async {
|
Future executeTransfert() async {
|
||||||
String? pin;
|
String? pin;
|
||||||
|
@ -60,6 +62,9 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myWalletProvider.readAllWallets();
|
||||||
|
log.d(myWalletProvider.listWallets);
|
||||||
|
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
|
@ -140,49 +145,66 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return InkWell(
|
return DropdownButton(
|
||||||
key: keyChangeChest,
|
dropdownColor: const Color(0xffffeed1),
|
||||||
onTap: () async {
|
elevation: 12,
|
||||||
String? pin;
|
key: dropdownKey,
|
||||||
if (myWalletProvider.pinCode == '') {
|
value: defaultWallet,
|
||||||
pin = await Navigator.push(
|
// onTap: () async {
|
||||||
context,
|
// await Future.delayed(const Duration(milliseconds: 10));
|
||||||
MaterialPageRoute(
|
// amountFocus.requestFocus();
|
||||||
builder: (homeContext) {
|
// },
|
||||||
return UnlockingWallet(
|
selectedItemBuilder: (_) {
|
||||||
wallet: defaultWallet);
|
return myWalletProvider.listWallets
|
||||||
},
|
.map((WalletData wallet) {
|
||||||
|
return Container(
|
||||||
|
width: 408,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.blueAccent.shade200,
|
||||||
|
width: 2),
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(10.0)),
|
||||||
),
|
),
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: Row(children: [
|
||||||
|
Text(g1WalletsBox
|
||||||
|
.get(wallet.address)
|
||||||
|
?.username ??
|
||||||
|
wallet.name!),
|
||||||
|
const Spacer(),
|
||||||
|
Balance(address: wallet.address, size: 20),
|
||||||
|
]),
|
||||||
);
|
);
|
||||||
}
|
}).toList();
|
||||||
if (pin != null || myWalletProvider.pinCode != '') {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) {
|
|
||||||
return ChooseWalletScreen(
|
|
||||||
pin: pin ?? myWalletProvider.pinCode);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: Container(
|
onChanged: (WalletData? newSelectedWallet) async {
|
||||||
width: double.infinity,
|
defaultWallet = newSelectedWallet!;
|
||||||
decoration: BoxDecoration(
|
await sub.setCurrentWallet(newSelectedWallet);
|
||||||
border: Border.all(
|
sub.reload();
|
||||||
color: Colors.blueAccent.shade200, width: 2),
|
amountFocus.requestFocus();
|
||||||
borderRadius:
|
setState(() {});
|
||||||
const BorderRadius.all(Radius.circular(10.0)),
|
},
|
||||||
),
|
items: myWalletProvider.listWallets
|
||||||
padding: const EdgeInsets.all(10),
|
.map((WalletData wallet) {
|
||||||
child: Row(children: [
|
return DropdownMenuItem(
|
||||||
Text(g1WalletsBox
|
value: wallet,
|
||||||
.get(defaultWallet.address)
|
child: Container(
|
||||||
?.username ??
|
color: const Color(0xffffeed1),
|
||||||
defaultWallet.name!),
|
width: 408,
|
||||||
const Spacer(),
|
height: 80,
|
||||||
Balance(address: defaultWallet.address, size: 20),
|
padding: const EdgeInsets.all(10),
|
||||||
]),
|
child: Row(children: [
|
||||||
),
|
Text(g1WalletsBox
|
||||||
|
.get(wallet.address)
|
||||||
|
?.username ??
|
||||||
|
wallet.name!),
|
||||||
|
const Spacer(),
|
||||||
|
Balance(address: wallet.address, size: 20),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
@ -252,6 +274,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
|
||||||
key: keyAmountField,
|
key: keyAmountField,
|
||||||
controller: walletViewProvider.payAmount,
|
controller: walletViewProvider.payAmount,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
focusNode: amountFocus,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
keyboardType: const TextInputType.numberWithOptions(
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
|
|
Loading…
Reference in New Issue