mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: show name on _UserNameInput
This commit is contained in:
parent
db165f7006
commit
29ce171783
@ -16,28 +16,36 @@ class SettingsUserView extends StatelessWidget {
|
|||||||
builder: (context, state) => SingleChildScrollView(
|
builder: (context, state) => SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: const [_UserNameInput()],
|
children: [_renderUserNameInput(context)],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _renderUserNameInput(BuildContext context) {
|
||||||
|
String name = context.read<SettingsUserViewBloc>().state.userProfile.name;
|
||||||
|
debugPrint(name);
|
||||||
|
return _UserNameInput(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _UserNameInput extends StatelessWidget {
|
class _UserNameInput extends StatelessWidget {
|
||||||
const _UserNameInput({
|
final String name;
|
||||||
|
const _UserNameInput(
|
||||||
|
this.name, {
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextField(
|
return TextField(
|
||||||
|
controller: TextEditingController()..text = name,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Name',
|
labelText: 'Name',
|
||||||
),
|
),
|
||||||
onSubmitted: (val) {
|
onSubmitted: (val) {
|
||||||
context.read<SettingsUserViewBloc>().add(SettingsUserEvent.updateUserName(val));
|
context.read<SettingsUserViewBloc>().add(SettingsUserEvent.updateUserName(val));
|
||||||
debugPrint("Value $val submitted");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user