Skip to content

Commit 4689675

Browse files
authored
Fix alignment issues in DevToolsClearableTextField (#9054)
1 parent 8489292 commit 4689675

4 files changed

Lines changed: 20 additions & 20 deletions

File tree

3.17 KB
Loading
796 Bytes
Loading

packages/devtools_app_shared/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ getter.
99
* Move the `Disposable` class from the
1010
`package:devtools_app_shared/service.dart` library to the
1111
`package:devtools_app_shared/utils.dart` library.
12+
* Fix alignment issues in `DevToolsClearableTextField`.
1213

1314
## 0.3.1
1415
* Bump `vm_service` dependency to `>=13.0.0 <16.0.0`.

packages/devtools_app_shared/lib/src/ui/text_field.dart

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ final class DevToolsClearableTextField extends StatelessWidget {
3434
final bool? enabled;
3535
final bool roundedBorder;
3636

37-
static const _contentVerticalPadding = 6.0;
38-
3937
/// This is the default border radius used by the [OutlineInputBorder]
4038
/// constructor.
4139
static const _defaultInputBorderRadius =
@@ -45,8 +43,10 @@ final class DevToolsClearableTextField extends StatelessWidget {
4543
Widget build(BuildContext context) {
4644
final theme = Theme.of(context);
4745
return SizedBox(
48-
height: defaultTextFieldHeight,
46+
height: defaultTextFieldHeight + densePadding,
4947
child: TextField(
48+
textAlignVertical: TextAlignVertical.center,
49+
cursorHeight: defaultTextFieldHeight / 2,
5050
autofocus: autofocus,
5151
controller: controller,
5252
enabled: enabled,
@@ -56,10 +56,9 @@ final class DevToolsClearableTextField extends StatelessWidget {
5656
decoration: InputDecoration(
5757
isDense: true,
5858
contentPadding: const EdgeInsets.only(
59-
top: _contentVerticalPadding,
60-
bottom: _contentVerticalPadding,
59+
top: densePadding,
60+
bottom: densePadding,
6161
left: denseSpacing,
62-
right: densePadding,
6362
),
6463
constraints: BoxConstraints(
6564
minHeight: defaultTextFieldHeight,
@@ -75,20 +74,20 @@ final class DevToolsClearableTextField extends StatelessWidget {
7574
hintText: hintText,
7675
hintStyle: theme.subtleTextStyle,
7776
prefixIcon: prefixIcon,
78-
suffix: SizedBox(
79-
height: inputDecorationElementHeight,
80-
child: Row(
81-
mainAxisSize: MainAxisSize.min,
82-
children: [
83-
...additionalSuffixActions,
84-
InputDecorationSuffixButton.clear(
85-
onPressed: () {
86-
controller.clear();
87-
onChanged?.call('');
88-
},
89-
),
90-
],
91-
),
77+
suffixIcon: SizedBox(
78+
height: inputDecorationElementHeight,
79+
child: Row(
80+
mainAxisSize: MainAxisSize.min,
81+
children: [
82+
...additionalSuffixActions,
83+
InputDecorationSuffixButton.clear(
84+
onPressed: () {
85+
controller.clear();
86+
onChanged?.call('');
87+
},
88+
),
89+
],
90+
),
9291
),
9392
),
9493
),

0 commit comments

Comments
 (0)