settings account tiles now showing nickname

This commit is contained in:
Kima 2023-10-08 12:44:45 +02:00
parent 69ea3e1a7f
commit 5776622276

View File

@ -87,7 +87,9 @@ class _SettingsScreenState extends State<SettingsScreen>
String _firstName; String _firstName;
List<String> _nameParts = account.displayName.split(" "); List<String> _nameParts =
(account.nickname != '' ? account.nickname : account.displayName)
.split(" ");
if (!settings.presentationMode) { if (!settings.presentationMode) {
_firstName = _nameParts.length > 1 ? _nameParts[1] : _nameParts[0]; _firstName = _nameParts.length > 1 ? _nameParts[1] : _nameParts[0];
} else { } else {
@ -96,7 +98,10 @@ class _SettingsScreenState extends State<SettingsScreen>
accountTiles.add( accountTiles.add(
AccountTile( AccountTile(
name: Text(!settings.presentationMode ? account.name : "János", name: Text(
!settings.presentationMode
? (account.nickname != '' ? account.nickname : account.name)
: "János",
style: const TextStyle(fontWeight: FontWeight.w500)), style: const TextStyle(fontWeight: FontWeight.w500)),
username: Text( username: Text(
!settings.presentationMode ? account.username : "01234567890"), !settings.presentationMode ? account.username : "01234567890"),
@ -275,7 +280,7 @@ class _SettingsScreenState extends State<SettingsScreen>
child: Panel( child: Panel(
child: Column( child: Column(
children: [ children: [
// Account list // account list
...accountTiles, ...accountTiles,
if (accountTiles.isNotEmpty) if (accountTiles.isNotEmpty)
@ -291,7 +296,7 @@ class _SettingsScreenState extends State<SettingsScreen>
), ),
), ),
// Account settings // account settings
PanelButton( PanelButton(
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(context)