Back next address button on receive screen

This commit is contained in:
M 2022-01-12 16:49:56 +02:00
parent 3b70cc91fe
commit 91ed52003b
3 changed files with 24 additions and 13 deletions

View file

@ -239,7 +239,7 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
}
final txb = bitcoin.TransactionBuilder(network: networkType);
final changeAddress = getChangeAddress();
final changeAddress = walletAddresses.addresses.last.address;
var leftAmount = totalAmount;
var totalInputAmount = 0;

View file

@ -35,24 +35,35 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
ObservableList<BitcoinAddressRecord> addresses;
List<BitcoinAddressRecord> get availableAddresses => addresses
.where((addr) => addr.isHidden)
.toList();
int accountIndex;
@override
Future<void> init() async {
await generateAddresses();
address = addresses[accountIndex].address;
final _availableAddresses = availableAddresses;
if (accountIndex >= _availableAddresses.length) {
accountIndex = 0;
}
address = _availableAddresses[accountIndex].address;
await updateAddressesInBox();
}
@action
Future<void> nextAddress() async {
accountIndex += 1;
final _availableAddresses = availableAddresses;
if (accountIndex >= addresses.length) {
if (accountIndex >= _availableAddresses.length) {
accountIndex = 0;
}
address = addresses[accountIndex].address;
address = _availableAddresses[accountIndex].address;
await updateAddressesInBox();
}

View file

@ -125,15 +125,15 @@ class AddressPage extends StatelessWidget {
],
),
),
) : Container();
//: PrimaryButton(
// onPressed: () => addressListViewModel.nextAddress(),
// text: 'Next address',
// color: Theme.of(context).buttonColor,
// textColor: Theme.of(context)
// .accentTextTheme
// .display3
// .backgroundColor);
)
: PrimaryButton(
onPressed: () => addressListViewModel.nextAddress(),
text: 'Next address',
color: Theme.of(context).buttonColor,
textColor: Theme.of(context)
.accentTextTheme
.display3
.backgroundColor);
})
],
),