mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
* feat: add Trezor auto connect * chore: update `trezor_flutter` * fix: correct method name for retrieving Trezor auto-pairing credentials * fix: update device connection prompt text across all languages [skip ci] * feat: add Trezor key image synchronization ui and improve hardware wallet UX * feat: add sync-balance icon asset for settings row visuals [skip ci] * feat: add sync-balance icon asset for settings row visuals [skip ci] * fix: remove unused Monero and sync key images settings actions from menus [skip ci] * fix: re-enable routing for UR QR Animated Page [skip ci]
58 lines
1.4 KiB
Dart
58 lines
1.4 KiB
Dart
import "package:cake_wallet/new-ui/widgets/new_primary_button.dart";
|
|
import "package:flutter/material.dart";
|
|
import "package:flutter_svg/flutter_svg.dart";
|
|
|
|
class NewFuturePrimaryButton extends StatefulWidget {
|
|
const NewFuturePrimaryButton({
|
|
required this.onPressed,
|
|
required this.text,
|
|
required this.color,
|
|
required this.textColor,
|
|
this.borderColor = Colors.transparent,
|
|
this.disabled = false,
|
|
this.image,
|
|
super.key,
|
|
});
|
|
|
|
final Future<void> Function() onPressed;
|
|
final bool disabled;
|
|
final SvgPicture? image;
|
|
final Color color;
|
|
final Color textColor;
|
|
final Color borderColor;
|
|
final String text;
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _NewFuturePrimaryButtonState();
|
|
}
|
|
|
|
class _NewFuturePrimaryButtonState extends State<NewFuturePrimaryButton> {
|
|
bool isLoading = false;
|
|
|
|
Future<void> _onPressed() async {
|
|
if (isLoading) {
|
|
return;
|
|
}
|
|
setState(() => isLoading = true);
|
|
try {
|
|
await widget.onPressed.call();
|
|
} finally {
|
|
if (mounted) {
|
|
setState(() => isLoading = false);
|
|
}
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) => NewPrimaryButton(
|
|
onPressed: _onPressed,
|
|
image: widget.image,
|
|
text: widget.text,
|
|
color: widget.color,
|
|
textColor: widget.textColor,
|
|
isLoading: isLoading,
|
|
borderColor: widget.borderColor,
|
|
disabled: widget.disabled,
|
|
);
|
|
}
|