fix: null username on payments
This commit is contained in:
parent
5b04c5b19e
commit
c316c0d630
|
@ -344,7 +344,11 @@ class _WalletsHomeState extends State<WalletsHome> {
|
||||||
.getWalletDataByAddress(senderAddress);
|
.getWalletDataByAddress(senderAddress);
|
||||||
await sub.setCurrentWallet(walletData!);
|
await sub.setCurrentWallet(walletData!);
|
||||||
sub.reload();
|
sub.reload();
|
||||||
paymentPopup(context, repository.address);
|
paymentPopup(
|
||||||
|
context,
|
||||||
|
repository.address,
|
||||||
|
g1WalletsBox.get(repository.address)!.username ??
|
||||||
|
repository.name!);
|
||||||
},
|
},
|
||||||
onMove: (details) {
|
onMove: (details) {
|
||||||
if (repository.address != myWalletProvider.lastFlyBy) {
|
if (repository.address != myWalletProvider.lastFlyBy) {
|
||||||
|
|
|
@ -53,6 +53,8 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
walletProfile.address = address;
|
walletProfile.address = address;
|
||||||
sub.setCurrentWallet(defaultWallet);
|
sub.setCurrentWallet(defaultWallet);
|
||||||
|
|
||||||
|
log.d("username: $username");
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
resizeToAvoidBottomInset: true,
|
resizeToAvoidBottomInset: true,
|
||||||
|
@ -359,7 +361,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
splashColor: yellowC,
|
splashColor: yellowC,
|
||||||
onTap: sub.nodeConnected
|
onTap: sub.nodeConnected
|
||||||
? () {
|
? () {
|
||||||
paymentPopup(context, address);
|
paymentPopup(context, address, username);
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: const Padding(
|
child: const Padding(
|
||||||
|
@ -418,7 +420,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void paymentPopup(BuildContext context, String toAddress) {
|
void paymentPopup(BuildContext context, String toAddress, String username) {
|
||||||
final walletViewProvider =
|
final walletViewProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
|
||||||
|
@ -426,13 +428,11 @@ void paymentPopup(BuildContext context, String toAddress) {
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
const double shapeSize = 20;
|
const double shapeSize = 20;
|
||||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
final defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
log.d(defaultWallet.address);
|
log.d(defaultWallet.address);
|
||||||
|
|
||||||
bool canValidate = false;
|
bool canValidate = false;
|
||||||
|
|
||||||
final toWalletData = myWalletProvider.getWalletDataByAddress(toAddress);
|
|
||||||
|
|
||||||
Future executeTransfert() async {
|
Future executeTransfert() async {
|
||||||
String? pin;
|
String? pin;
|
||||||
if (myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
|
@ -582,7 +582,10 @@ void paymentPopup(BuildContext context, String toAddress) {
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(10),
|
padding: const EdgeInsets.all(10),
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
Text(defaultWallet.name!),
|
Text(g1WalletsBox
|
||||||
|
.get(defaultWallet.address)
|
||||||
|
?.username ??
|
||||||
|
defaultWallet.name!),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Balance(address: defaultWallet.address, size: 20),
|
Balance(address: defaultWallet.address, size: 20),
|
||||||
]),
|
]),
|
||||||
|
@ -604,9 +607,9 @@ void paymentPopup(BuildContext context, String toAddress) {
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
Text(
|
Text(
|
||||||
toWalletData == null
|
username == ''
|
||||||
? getShortPubkey(toAddress)
|
? getShortPubkey(toAddress)
|
||||||
: toWalletData.name!,
|
: username,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 21,
|
fontSize: 21,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
|
|
@ -124,7 +124,7 @@ class SearchIdentityQuery extends StatelessWidget {
|
||||||
walletsProfiles.address = profile['pubkey'];
|
walletsProfiles.address = profile['pubkey'];
|
||||||
return WalletViewScreen(
|
return WalletViewScreen(
|
||||||
address: profile['pubkey'],
|
address: profile['pubkey'],
|
||||||
username: name,
|
username: profile['name'] ?? '',
|
||||||
avatar:
|
avatar:
|
||||||
g1WalletsBox.get(profile['pubkey'])?.avatar,
|
g1WalletsBox.get(profile['pubkey'])?.avatar,
|
||||||
);
|
);
|
||||||
|
|
|
@ -100,8 +100,7 @@ class SearchResult extends StatelessWidget {
|
||||||
walletsProfilesClass.address = g1Wallet.address;
|
walletsProfilesClass.address = g1Wallet.address;
|
||||||
return WalletViewScreen(
|
return WalletViewScreen(
|
||||||
address: g1Wallet.address,
|
address: g1Wallet.address,
|
||||||
username:
|
username: g1WalletsBox.get(g1Wallet)!.username ?? '',
|
||||||
duniterIndexer.walletNameIndexer[g1Wallet.address] ?? '',
|
|
||||||
avatar: g1WalletsBox.get(g1Wallet.address)?.avatar,
|
avatar: g1WalletsBox.get(g1Wallet.address)?.avatar,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue