WIP: fusion progress provider

This commit is contained in:
ryleedavis 2023-09-20 16:14:34 -06:00
parent c898ffb30f
commit 0597e317ba
2 changed files with 75 additions and 0 deletions

View file

@ -0,0 +1,59 @@
import 'package:flutter/cupertino.dart';
import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart';
class FusionProgressUIState extends ChangeNotifier {
bool _ableToConnect = false;
bool get done {
if (!_ableToConnect) {
return false;
}
bool _done = (_connecting == CashFusionStatus.success) ||
(_connecting == CashFusionStatus.failed);
_done &= (_outputs == CashFusionStatus.success) ||
(_outputs == CashFusionStatus.failed);
_done &= (_peers == CashFusionStatus.success) ||
(_peers == CashFusionStatus.failed);
_done &= (_fusing == CashFusionStatus.success) ||
(_fusing == CashFusionStatus.failed);
_done &= (_complete == CashFusionStatus.success) ||
(_complete == CashFusionStatus.failed);
return _done;
}
CashFusionStatus _connecting = CashFusionStatus.waiting;
CashFusionStatus get connecting => _connecting;
set connecting(CashFusionStatus state) {
_connecting = state;
notifyListeners();
}
CashFusionStatus _outputs = CashFusionStatus.waiting;
CashFusionStatus get outputs => _outputs;
set outputs(CashFusionStatus state) {
_outputs = state;
notifyListeners();
}
CashFusionStatus _peers = CashFusionStatus.waiting;
CashFusionStatus get peers => _peers;
set peers(CashFusionStatus state) {
_peers = state;
notifyListeners();
}
CashFusionStatus _fusing = CashFusionStatus.waiting;
CashFusionStatus get fusing => _fusing;
set fusing(CashFusionStatus state) {
_fusing = state;
notifyListeners();
}
CashFusionStatus _complete = CashFusionStatus.waiting;
CashFusionStatus get complete => _complete;
set complete(CashFusionStatus state) {
_complete = state;
notifyListeners();
}
}

View file

@ -0,0 +1,16 @@
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/models/fusion_progress_ui_state.dart';
final fusionProgressUIStateProvider =
ChangeNotifierProvider<FusionProgressUIState>(
(ref) => FusionProgressUIState());