mirror of
https://github.com/foss42/apidash.git
synced 2025-05-28 20:27:04 +08:00
feat: add request cancellation functionality
This commit is contained in:
@ -7,23 +7,30 @@ class SendButton extends StatelessWidget {
|
||||
super.key,
|
||||
required this.isWorking,
|
||||
required this.onTap,
|
||||
this.onCancel,
|
||||
});
|
||||
|
||||
final bool isWorking;
|
||||
final void Function() onTap;
|
||||
final void Function()? onCancel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FilledButton(
|
||||
onPressed: isWorking ? null : onTap,
|
||||
onPressed: isWorking ? onCancel : onTap,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: isWorking
|
||||
? const [
|
||||
Text(
|
||||
kLabelSending,
|
||||
kLabelCancel,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
kHSpacer10,
|
||||
Icon(
|
||||
size: 16,
|
||||
Icons.cancel,
|
||||
)
|
||||
]
|
||||
: const [
|
||||
Text(
|
||||
|
Reference in New Issue
Block a user