9551eceaed
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.
172 lines
4.9 KiB
Dart
172 lines
4.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../run_pipeline_intent.dart';
|
|
import 'run_pipeline_wording.dart';
|
|
|
|
/// The dialog's three web fields in standard Material controls.
|
|
///
|
|
/// A confirmed launch locks every field: the request is immutable until its
|
|
/// admission is known, exactly like the browser's disabled inputs.
|
|
class RunPipelineFields extends StatelessWidget {
|
|
const RunPipelineFields({
|
|
super.key,
|
|
required this.prompt,
|
|
required this.workspace,
|
|
required this.directories,
|
|
required this.onChooseDirectory,
|
|
required this.notifyMode,
|
|
required this.outputFormat,
|
|
required this.locked,
|
|
required this.onNotifyChanged,
|
|
required this.onOutputFormatChanged,
|
|
});
|
|
|
|
final TextEditingController prompt;
|
|
final TextEditingController workspace;
|
|
final List<String> directories;
|
|
|
|
final ValueChanged<String> onChooseDirectory;
|
|
final RunNotifyMode notifyMode;
|
|
final RunOutputFormat outputFormat;
|
|
final bool locked;
|
|
final ValueChanged<RunNotifyMode> onNotifyChanged;
|
|
final ValueChanged<RunOutputFormat> onOutputFormatChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const _FieldLabel(runPipelinePromptLabel),
|
|
_promptField(),
|
|
const SizedBox(height: 12),
|
|
const _FieldLabel(runPipelineWorkspaceLabel),
|
|
_workspaceField(),
|
|
_helper(context, runPipelineWorkspaceHelper),
|
|
const SizedBox(height: 12),
|
|
const _FieldLabel(runPipelineNotifyLabel),
|
|
_notifyField(),
|
|
const SizedBox(height: 12),
|
|
const _FieldLabel(runPipelineOutputFormatLabel),
|
|
_outputFormatField(),
|
|
_helper(context, runPipelineOutputFormatHelper),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _promptField() {
|
|
return TextField(
|
|
key: runPipelinePromptKey,
|
|
controller: prompt,
|
|
enabled: !locked,
|
|
autofocus: !locked,
|
|
minLines: 3,
|
|
maxLines: 5,
|
|
textCapitalization: TextCapitalization.sentences,
|
|
decoration: const InputDecoration(
|
|
hintText: runPipelinePromptPlaceholder,
|
|
border: OutlineInputBorder(),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _workspaceField() {
|
|
return Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(child: _materialWorkspace()),
|
|
if (directories.isNotEmpty)
|
|
PopupMenuButton<String>(
|
|
key: runPipelineWorkspaceSuggestionsKey,
|
|
tooltip: runPipelineWorkspaceLabel,
|
|
enabled: !locked,
|
|
onSelected: onChooseDirectory,
|
|
itemBuilder: (_) => [
|
|
for (final path in directories)
|
|
PopupMenuItem(value: path, child: Text(path)),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _materialWorkspace() {
|
|
return TextField(
|
|
key: runPipelineWorkspaceKey,
|
|
controller: workspace,
|
|
enabled: !locked,
|
|
autocorrect: false,
|
|
decoration: const InputDecoration(
|
|
hintText: runPipelineWorkspacePlaceholder,
|
|
border: OutlineInputBorder(),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _notifyField() {
|
|
return DropdownButtonFormField<RunNotifyMode>(
|
|
key: runPipelineNotifyKey,
|
|
initialValue: notifyMode,
|
|
decoration: const InputDecoration(border: OutlineInputBorder()),
|
|
items: [
|
|
for (final mode in RunNotifyMode.values)
|
|
DropdownMenuItem(value: mode, child: Text(mode.label)),
|
|
],
|
|
onChanged: locked
|
|
? null
|
|
: (mode) {
|
|
if (mode != null) onNotifyChanged(mode);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _outputFormatField() {
|
|
return DropdownButtonFormField<RunOutputFormat>(
|
|
key: runPipelineOutputFormatKey,
|
|
initialValue: outputFormat,
|
|
decoration: const InputDecoration(border: OutlineInputBorder()),
|
|
items: [
|
|
for (final format in RunOutputFormat.values)
|
|
DropdownMenuItem(value: format, child: Text(format.label)),
|
|
],
|
|
onChanged: locked
|
|
? null
|
|
: (format) {
|
|
if (format != null) onOutputFormatChanged(format);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _helper(BuildContext context, String text) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(top: 4),
|
|
child: Text(text, style: _secondaryStyle(context)),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Secondary copy under a field: the theme's secondary role, never a borrowed
|
|
/// palette or invented point size.
|
|
TextStyle? _secondaryStyle(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return (theme.textTheme.bodySmall ?? const TextStyle()).copyWith(
|
|
color: theme.colorScheme.onSurfaceVariant,
|
|
);
|
|
}
|
|
|
|
/// The label above each field, using the web's exact words.
|
|
class _FieldLabel extends StatelessWidget {
|
|
const _FieldLabel(this.text);
|
|
|
|
final String text;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 4),
|
|
child: Text(text, style: Theme.of(context).textTheme.labelLarge),
|
|
);
|
|
}
|
|
}
|