96de9f5bea
Keep the Material-only conversation implementation while preserving public Cupertino parameters for callers. Narrow affected tests to Material hosts so the dead platform paths are no longer exercised.
41 lines
1.3 KiB
Dart
41 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. `cupertino` is kept for existing
|
|
/// callers; the controls are always Material.
|
|
Widget chatQuestionControls({
|
|
required BuildContext context,
|
|
required bool cupertino,
|
|
required Object? actions,
|
|
required String submitLabel,
|
|
required bool sending,
|
|
required VoidCallback onSubmit,
|
|
required void Function(String action) onAction,
|
|
}) {
|
|
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: const Text('Decline'),
|
|
),
|
|
if (canCancel)
|
|
TextButton(
|
|
onPressed: sending ? null : () => onAction('cancel'),
|
|
child: const Text('Cancel question'),
|
|
),
|
|
],
|
|
);
|
|
}
|