bfccf39671
Claude's question forms now accept a free-text answer beside the offered options and can be dismissed. A dismissal tells Claude the operator will reply in the chat instead, the card's button reads Dismiss, and the composer takes the keyboard so the reply can be typed at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.3 KiB
Dart
40 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Submit and optional decline/cancel controls for a pending question.
|
|
///
|
|
/// The web shows `Confirm completion` when every field is external, otherwise
|
|
/// `Send answer`, and offers only the actions the form records. The labels are
|
|
/// passed in so this file stays layout only. Controls use Material widgets.
|
|
Widget chatQuestionControls({
|
|
required BuildContext context,
|
|
required Object? actions,
|
|
required String submitLabel,
|
|
required bool sending,
|
|
required VoidCallback onSubmit,
|
|
required void Function(String action) onAction,
|
|
String declineLabel = 'Decline',
|
|
}) {
|
|
final canDecline = actions is List && actions.contains('decline');
|
|
final canCancel = actions is List && actions.contains('cancel');
|
|
return Wrap(
|
|
spacing: 8,
|
|
runSpacing: 8,
|
|
children: [
|
|
FilledButton(
|
|
onPressed: sending ? null : onSubmit,
|
|
child: Text(sending ? 'Sending…' : submitLabel),
|
|
),
|
|
if (canDecline)
|
|
TextButton(
|
|
onPressed: sending ? null : () => onAction('decline'),
|
|
child: Text(declineLabel),
|
|
),
|
|
if (canCancel)
|
|
TextButton(
|
|
onPressed: sending ? null : () => onAction('cancel'),
|
|
child: const Text('Cancel question'),
|
|
),
|
|
],
|
|
);
|
|
}
|