SSE: Stopping/Cancelling implementation

This commit is contained in:
Manas Hejmadi
2025-06-26 00:36:12 +05:30
parent 97db38a42d
commit 882b393fdd
8 changed files with 119 additions and 95 deletions

View File

@@ -5,11 +5,13 @@ import 'package:apidash/consts.dart';
class SendButton extends StatelessWidget {
const SendButton({
super.key,
required this.isStreaming,
required this.isWorking,
required this.onTap,
this.onCancel,
});
final bool isStreaming;
final bool isWorking;
final void Function() onTap;
final void Function()? onCancel;
@@ -17,13 +19,13 @@ class SendButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ADFilledButton(
onPressed: isWorking ? onCancel : onTap,
isTonal: isWorking ? true : false,
items: isWorking
? const [
onPressed: (isWorking || isStreaming) ? onCancel : onTap,
isTonal: (isWorking || isStreaming),
items: (isWorking || isStreaming)
? [
kHSpacer8,
Text(
kLabelCancel,
isStreaming ? 'Stop' : kLabelCancel,
style: kTextStyleButton,
),
kHSpacer6,