Added Last Name display and made it editable

This commit is contained in:
Arseni
2025-12-24 18:48:33 +03:00
parent 964e90767d
commit 4453dab366
8 changed files with 118 additions and 43 deletions

View File

@@ -9,11 +9,13 @@ class AccountNameText extends StatelessWidget {
const AccountNameText({
super.key,
required this.hintText,
required this.lastNameHint,
required this.inputWidth,
required this.borderWidth,
});
final String hintText;
final String lastNameHint;
final double inputWidth;
final double borderWidth;
@@ -25,29 +27,55 @@ class AccountNameText extends StatelessWidget {
if (state.isEditing) {
return SizedBox(
width: inputWidth,
child: TextFormField(
controller: state.controller,
style: theme.textTheme.headlineMedium?.copyWith(
fontWeight: FontWeight.bold,
),
autofocus: true,
enabled: !state.isBusy,
decoration: InputDecoration(
hintText: hintText,
isDense: true,
border: UnderlineInputBorder(
borderSide: BorderSide(
color: theme.colorScheme.primary,
width: borderWidth,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextFormField(
controller: state.firstNameController,
style: theme.textTheme.headlineMedium?.copyWith(
fontWeight: FontWeight.bold,
),
autofocus: true,
enabled: !state.isBusy,
decoration: InputDecoration(
hintText: hintText,
labelText: hintText,
isDense: true,
border: UnderlineInputBorder(
borderSide: BorderSide(
color: theme.colorScheme.primary,
width: borderWidth,
),
),
),
),
),
const SizedBox(height: 8),
TextFormField(
controller: state.lastNameController,
style: theme.textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w600,
),
enabled: !state.isBusy,
decoration: InputDecoration(
hintText: lastNameHint,
labelText: lastNameHint,
isDense: true,
border: UnderlineInputBorder(
borderSide: BorderSide(
color: theme.colorScheme.primary,
width: borderWidth,
),
),
),
),
],
),
);
}
final displayName = state.currentFullName.isNotEmpty ? state.currentFullName : hintText;
return Text(
state.currentName,
displayName,
style: theme.textTheme.headlineMedium?.copyWith(
fontWeight: FontWeight.bold,
),