Properly handle empty usernames

This commit is contained in:
krawieck 2020-09-09 11:19:12 +02:00
parent 1fe1562ef2
commit d1cb84ba29
2 changed files with 8 additions and 2 deletions

View File

@ -351,7 +351,10 @@ class _AboutTab extends HookWidget {
),
),
...site.admins.map((e) => ListTile(
title: Text(e.preferredUsername ?? '@${e.name}'),
title: Text((e.preferredUsername == null ||
e.preferredUsername.isEmpty)
? '@${e.name}'
: e.preferredUsername),
subtitle: e.bio != null ? MarkdownText(e.bio) : null,
onTap: () => goToUser(e.id),
leading: e.avatar != null

View File

@ -28,7 +28,10 @@ class UsersListPage extends StatelessWidget {
),
body: ListView.builder(
itemBuilder: (context, i) => ListTile(
title: Text(users[i].preferredUsername ?? '@${users[i].name}'),
title: Text((users[i].preferredUsername == null ||
users[i].preferredUsername.isEmpty)
? '@${users[i].name}'
: users[i].preferredUsername),
subtitle: users[i].bio != null
? Opacity(
opacity: 0.5,