Files
apidash/lib/widgets/button_send.dart
Ankit Mahato d1fe07ac8d Add 'Stop' label constant and use in SendButton
Introduces kLabelStop to consts.dart and updates SendButton to use the new constant when isStreaming is true, improving consistency in label management.
2025-08-05 19:50:13 +05:30

47 lines
1.1 KiB
Dart

import 'package:apidash_design_system/apidash_design_system.dart';
import 'package:flutter/material.dart';
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;
@override
Widget build(BuildContext context) {
return ADFilledButton(
onPressed: (isWorking || isStreaming) ? onCancel : onTap,
isTonal: (isWorking || isStreaming),
items: (isWorking || isStreaming)
? [
kHSpacer8,
Text(
isStreaming ? kLabelStop : kLabelCancel,
style: kTextStyleButton,
),
kHSpacer6,
]
: const [
Text(
kLabelSend,
style: kTextStyleButton,
),
kHSpacer10,
Icon(
size: 16,
Icons.send,
),
],
);
}
}