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

View File

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