Skip to content

Commit 1937f27

Browse files
authored
fix(ui): Avoid layout jumps when editing user name. (#8334)
1 parent f1dae73 commit 1937f27

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

packages/flutterfire_ui/lib/src/auth/widgets/editable_user_display_name.dart

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import 'package:flutterfire_ui/auth.dart';
44
import 'package:flutterfire_ui/i10n.dart';
55
import 'package:flutter/material.dart';
66

7+
import 'internal/subtitle.dart';
8+
79
class EditableUserDisplayName extends StatefulWidget {
810
final FirebaseAuth? auth;
911

@@ -78,24 +80,30 @@ class _EditableUserDisplayNameState extends State<EditableUserDisplayName> {
7880
}
7981

8082
if (!_editing) {
81-
return IntrinsicWidth(
82-
child: Row(
83-
children: [
84-
Text(displayName ?? 'Unknown'),
85-
iconButton,
86-
],
83+
return Padding(
84+
padding: const EdgeInsets.symmetric(vertical: 5.5),
85+
child: IntrinsicWidth(
86+
child: Row(
87+
children: [
88+
Subtitle(text: displayName ?? 'Unknown'),
89+
iconButton,
90+
],
91+
),
8792
),
8893
);
8994
}
9095

9196
late Widget textField;
9297

9398
if (isCupertino) {
94-
textField = CupertinoTextField(
95-
autofocus: true,
96-
controller: ctrl,
97-
placeholder: l.name,
98-
onSubmitted: (_) => _finishEditing(),
99+
textField = Padding(
100+
padding: const EdgeInsets.symmetric(vertical: 17.5),
101+
child: CupertinoTextField(
102+
autofocus: true,
103+
controller: ctrl,
104+
placeholder: l.name,
105+
onSubmitted: (_) => _finishEditing(),
106+
),
99107
);
100108
} else {
101109
textField = TextField(

0 commit comments

Comments
 (0)