mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-04-01 11:59:06 +00:00
fix: animation duration/period not set before calling repeat
This commit is contained in:
parent
e7ed01aad5
commit
d627f8e73c
2 changed files with 21 additions and 6 deletions
lib
|
@ -66,26 +66,38 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton> {
|
|||
widget.tokenContractAddress == null) {
|
||||
switch (event.newStatus) {
|
||||
case WalletSyncStatus.unableToSync:
|
||||
_spinController.stop?.call();
|
||||
if (_spinController.hasLoadedAnimation) {
|
||||
_spinController.stop?.call();
|
||||
}
|
||||
break;
|
||||
case WalletSyncStatus.synced:
|
||||
_spinController.stop?.call();
|
||||
if (_spinController.hasLoadedAnimation) {
|
||||
_spinController.stop?.call();
|
||||
}
|
||||
break;
|
||||
case WalletSyncStatus.syncing:
|
||||
_spinController.repeat?.call();
|
||||
if (_spinController.hasLoadedAnimation) {
|
||||
_spinController.repeat?.call();
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (widget.tokenContractAddress != null &&
|
||||
event.walletId == widget.walletId + widget.tokenContractAddress!) {
|
||||
switch (event.newStatus) {
|
||||
case WalletSyncStatus.unableToSync:
|
||||
_spinController.stop?.call();
|
||||
if (_spinController.hasLoadedAnimation) {
|
||||
_spinController.stop?.call();
|
||||
}
|
||||
break;
|
||||
case WalletSyncStatus.synced:
|
||||
_spinController.stop?.call();
|
||||
if (_spinController.hasLoadedAnimation) {
|
||||
_spinController.stop?.call();
|
||||
}
|
||||
break;
|
||||
case WalletSyncStatus.syncing:
|
||||
_spinController.repeat?.call();
|
||||
if (_spinController.hasLoadedAnimation) {
|
||||
_spinController.repeat?.call();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ class RotatingArrowsController {
|
|||
VoidCallback? forward;
|
||||
VoidCallback? repeat;
|
||||
VoidCallback? stop;
|
||||
|
||||
bool hasLoadedAnimation = false;
|
||||
}
|
||||
|
||||
class RotatingArrows extends StatefulWidget {
|
||||
|
@ -86,6 +88,7 @@ class _RotatingArrowsState extends State<RotatingArrows>
|
|||
),
|
||||
onLoaded: (composition) {
|
||||
animationController.duration = composition.duration;
|
||||
widget.controller?.hasLoadedAnimation = true;
|
||||
|
||||
// if controller was not set just assume continuous repeat
|
||||
if (widget.spinByDefault) {
|
||||
|
|
Loading…
Reference in a new issue