fix(ui): align history search placeholder and prevent clipping

This commit is contained in:
Levi committed 2026-09-12 10:03:08 +08:00
1 parent 091e7b8936
commit 29675858f2
3 files changed
+101 -14

No files matched your search

@@ -37,6 +37,7 @@ import '../../../../shared/widgets/app_toast.dart';
import '../../../../l10n/l10n.dart';
import '../../../../util/util.dart';
import '../../application/pending_create_task.dart';
import '../widgets/history_search_field.dart';
import '../widgets/create_task_action_buttons.dart';
import '../widgets/resolve_file_tree.dart';
@@ -1247,20 +1248,9 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
height: screenSize.height < 560 ? screenSize.height * 0.55 : 360,
child: Column(
children: [
SizedBox(
height: 38,
child: AppTextField(
key: const ValueKey('create-history-filter'),
controller: filterController,
placeholder: Text(
dialogContext.l10n.searchHistory,
style: TextStyle(color: palette.searchHint, fontSize: 13),
),
features: [
InputFeature.leading(Icon(Icons.search_rounded, size: 15, color: palette.textMuted)),
],
onChanged: (value) => setDialogState(() => filterQuery = value),
),
HistorySearchField(
controller: filterController,
onChanged: (value) => setDialogState(() => filterQuery = value),
),
const SizedBox(height: 10),
Expanded(
@@ -0,0 +1,38 @@
import 'package:shadcn_flutter/shadcn_flutter.dart';
import '../../../../l10n/l10n.dart';
import '../../../../shared/theme/app_design_tokens.dart';
import '../../../../shared/theme/app_palette.dart';
import '../../../../shared/widgets/app_text_field.dart';
class HistorySearchField extends StatelessWidget {
const HistorySearchField({super.key, required this.controller, required this.onChanged});
final TextEditingController controller;
final ValueChanged<String> onChanged;
@override
Widget build(BuildContext context) {
final palette = AppPalette.of(context);
const textStyle = TextStyle(fontSize: 13);
return ConstrainedBox(
// Allow large accessibility text to grow instead of clipping the line.
constraints: const BoxConstraints(minHeight: 38),
child: AppTextField(
key: const ValueKey('create-history-filter'),
controller: controller,
style: textStyle,
padding: AppDesignTokens.compactTextFieldPadding,
placeholder: Text(
context.l10n.searchHistory,
// Match the editable text metrics so the cursor and hint align.
style: textStyle.copyWith(color: palette.searchHint),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
features: [InputFeature.leading(Icon(Icons.search_rounded, size: 15, color: palette.textMuted))],
onChanged: onChanged,
),
);
}
}