1db273894c
Keep the Material-only template implementation and narrow its tests to the runtime path. Retain public Cupertino parameters for compatibility while removing unreachable hosts, widgets, and test variants.
55 lines
1.5 KiB
Dart
55 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'template_create_wording.dart';
|
|
|
|
/// Full wrapping native label, not a clipped placeholder/floating field label.
|
|
class TemplateCreateNameField extends StatelessWidget {
|
|
const TemplateCreateNameField({
|
|
super.key,
|
|
required this.cupertino,
|
|
required this.controller,
|
|
required this.enabled,
|
|
required this.onSubmit,
|
|
});
|
|
|
|
/// Retained for callers that still pass it; the field is always the
|
|
/// Material one whether this is set or not.
|
|
final bool cupertino;
|
|
final TextEditingController controller;
|
|
final bool enabled;
|
|
final VoidCallback onSubmit;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => MergeSemantics(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const Text(templateCreateNameLabel),
|
|
const SizedBox(height: 8),
|
|
TextField(
|
|
key: templateCreateNameKey,
|
|
controller: controller,
|
|
enabled: enabled,
|
|
autofocus: true,
|
|
textInputAction: TextInputAction.done,
|
|
onSubmitted: (_) => onSubmit(),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget templateCreateDialogAction({
|
|
required Key key,
|
|
required bool cupertino,
|
|
required VoidCallback? onPressed,
|
|
required Widget child,
|
|
bool primary = false,
|
|
}) {
|
|
if (primary) {
|
|
return FilledButton(key: key, onPressed: onPressed, child: child);
|
|
}
|
|
return TextButton(key: key, onPressed: onPressed, child: child);
|
|
}
|