mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 11:04:33 +00:00
multi select freeze/unfreeze utxos on desktop
This commit is contained in:
parent
da011543b8
commit
10c5575a9e
1 changed files with 29 additions and 2 deletions
|
@ -12,6 +12,7 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/format.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -316,8 +317,34 @@ class _DesktopCoinControlViewState
|
|||
buttonHeight: ButtonHeight.l,
|
||||
width: 200,
|
||||
label: _freezeLabel(_selectedUTXOs),
|
||||
onPressed: () {
|
||||
//
|
||||
onPressed: () async {
|
||||
switch (_freezeLabelCache) {
|
||||
case "Freeze":
|
||||
for (final e in _selectedUTXOs) {
|
||||
e.utxo = e.utxo.copyWith(isBlocked: true);
|
||||
}
|
||||
break;
|
||||
|
||||
case "Unfreeze":
|
||||
for (final e in _selectedUTXOs) {
|
||||
e.utxo = e.utxo.copyWith(isBlocked: false);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Logging.instance.log(
|
||||
"Unknown utxo method name found in $runtimeType",
|
||||
level: LogLevel.Fatal,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// final update utxo set in db
|
||||
await MainDB.instance
|
||||
.putUTXOs(_selectedUTXOs.map((e) => e.utxo).toList());
|
||||
|
||||
// change label of freeze/unfreeze button
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
crossFadeState: _selectedUTXOs.isEmpty
|
||||
|
|
Loading…
Reference in a new issue