Use the .displayName extension

This commit is contained in:
shilangyu 2021-01-27 19:50:28 +00:00
parent fa80da5c8f
commit ad6b28fdb1
2 changed files with 4 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import 'package:lemmy_api_client/v2.dart';
import 'package:url_launcher/url_launcher.dart' as ul;
import '../hooks/stores.dart';
import '../util/extensions/api.dart';
import '../util/goto.dart';
import '../util/more_icon.dart';
import '../util/text_color.dart';
@ -363,10 +364,7 @@ class _AboutTab extends HookWidget {
),
),
...site.admins.map((u) => ListTile(
title: Text((u.user.preferredUsername == null ||
u.user.preferredUsername.isEmpty)
? '@${u.user.name}'
: u.user.preferredUsername),
title: Text(u.user.displayName),
subtitle: u.user.bio != null
? MarkdownText(u.user.bio, instanceHost: instanceHost)
: null,

View File

@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:lemmy_api_client/v2.dart';
import '../util/extensions/api.dart';
import '../util/goto.dart';
import '../widgets/markdown_text.dart';
@ -42,10 +43,7 @@ class UsersListItem extends StatelessWidget {
@override
Widget build(BuildContext context) => ListTile(
title: Text((user.user.preferredUsername == null ||
user.user.preferredUsername.isEmpty)
? '@${user.user.name}'
: user.user.preferredUsername),
title: Text(user.user.displayName),
subtitle: user.user.bio != null
? Opacity(
opacity: 0.5,