Files
pipelines/app/lib/features/chat/ui/sessions/chat_prompt_chooser.dart
T
alan 9551eceaed Complete Material-only APIs and fixtures
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
2026-11-11 21:55:39 +00:00

62 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'chat_create_fields.dart';
/// Native platform controls for choosing what editable prompt to start with.
class ChatPromptChooser extends StatelessWidget {
const ChatPromptChooser({
super.key,
required this.enabled,
required this.choice,
required this.hasLastUsed,
required this.onEnabled,
required this.onChoice,
});
static const custom = 'custom';
static const careful = 'careful';
static const lastUsed = 'last-used';
final bool enabled;
final String choice;
final bool hasLastUsed;
final ValueChanged<bool> onEnabled;
final ValueChanged<String> onChoice;
@override
Widget build(BuildContext context) {
final choices = <String>[custom, careful, if (hasLastUsed) lastUsed];
String label(String value) => switch (value) {
custom => 'Custom',
careful => 'Careful coding',
lastUsed => 'Last used prompt',
_ => value,
};
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
const Expanded(child: Text('Start with a prompt')),
Switch(
key: const Key('chat-create-send-prompt'),
value: enabled,
onChanged: onEnabled,
),
],
),
if (enabled)
MaterialPickerField(
fieldKey: const Key('chat-create-prompt-choice'),
label: 'Prompt',
value: choices.contains(choice) ? choice : custom,
values: choices,
labelOf: label,
onSelected: onChoice,
),
],
);
}
}