All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/discovery Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/gateway_mntx Pipeline was successful
ci/woodpecker/push/gateway_chain Pipeline was successful
ci/woodpecker/push/gateway_tgsettle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
58 lines
1.4 KiB
Dart
58 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pweb/models/visibility.dart';
|
|
|
|
|
|
class BalanceRefreshButton extends StatelessWidget {
|
|
final bool isBusy;
|
|
final bool enabled;
|
|
final VoidCallback onPressed;
|
|
final VisibilityState iconOnly;
|
|
final String label;
|
|
final String tooltip;
|
|
final double iconSize;
|
|
|
|
const BalanceRefreshButton({
|
|
super.key,
|
|
required this.isBusy,
|
|
required this.enabled,
|
|
required this.onPressed,
|
|
required this.iconOnly,
|
|
required this.label,
|
|
required this.tooltip,
|
|
this.iconSize = 18,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final canPress = enabled && !isBusy;
|
|
|
|
if (iconOnly == VisibilityState.hidden) {
|
|
return IconButton(
|
|
tooltip: tooltip,
|
|
onPressed: canPress ? onPressed : null,
|
|
icon: isBusy
|
|
? SizedBox(
|
|
width: iconSize,
|
|
height: iconSize,
|
|
child: const CircularProgressIndicator(strokeWidth: 2),
|
|
)
|
|
: const Icon(Icons.refresh),
|
|
);
|
|
}
|
|
|
|
return TextButton.icon(
|
|
onPressed: canPress ? onPressed : null,
|
|
icon: isBusy
|
|
? SizedBox(
|
|
width: iconSize,
|
|
height: iconSize,
|
|
child: const CircularProgressIndicator(strokeWidth: 2),
|
|
)
|
|
: const Icon(Icons.refresh),
|
|
label: Text(label),
|
|
style: TextButton.styleFrom(visualDensity: VisualDensity.compact),
|
|
);
|
|
}
|
|
}
|