Code review suggestions
This commit is contained in:
parent
0a10d76d08
commit
92cdfdbc2c
|
@ -33,10 +33,8 @@ class HomeTab extends HookWidget {
|
|||
final theme = Theme.of(context);
|
||||
final instancesIcons = useMemoFuture(() async {
|
||||
final instances = accStore.instances.toList(growable: false);
|
||||
final sites = await Future.wait(
|
||||
instances
|
||||
.map((e) => LemmyApiV2(e).run(GetSite()).catchError((e) => null)),
|
||||
);
|
||||
final sites = await Future.wait(instances
|
||||
.map((e) => LemmyApiV2(e).run(GetSite()).catchError((e) => null)));
|
||||
|
||||
return {
|
||||
for (var i = 0; i < sites.length; i++)
|
||||
|
|
|
@ -363,28 +363,30 @@ class _AboutTab extends HookWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
...site.admins.map((u) => ListTile(
|
||||
title: Text(u.user.displayName),
|
||||
subtitle: u.user.bio != null
|
||||
? MarkdownText(u.user.bio, instanceHost: instanceHost)
|
||||
: null,
|
||||
onTap: () => goToUser.byId(context, instanceHost, u.user.id),
|
||||
leading: u.user.avatar != null
|
||||
? CachedNetworkImage(
|
||||
height: 50,
|
||||
width: 50,
|
||||
imageUrl: u.user.avatar,
|
||||
errorWidget: (_, __, ___) =>
|
||||
const SizedBox(width: 50, height: 50),
|
||||
imageBuilder: (context, imageProvider) => Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover, image: imageProvider),
|
||||
),
|
||||
))
|
||||
: const SizedBox(width: 50),
|
||||
)),
|
||||
for (final u in site.admins)
|
||||
ListTile(
|
||||
title: Text(u.user.originDisplayName),
|
||||
subtitle: u.user.bio != null
|
||||
? MarkdownText(u.user.bio, instanceHost: instanceHost)
|
||||
: null,
|
||||
onTap: () => goToUser.byId(context, instanceHost, u.user.id),
|
||||
leading: u.user.avatar != null
|
||||
? CachedNetworkImage(
|
||||
height: 50,
|
||||
width: 50,
|
||||
imageUrl: u.user.avatar,
|
||||
errorWidget: (_, __, ___) =>
|
||||
const SizedBox(width: 50, height: 50),
|
||||
imageBuilder: (context, imageProvider) => Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover, image: imageProvider),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(width: 50),
|
||||
),
|
||||
const _Divider(),
|
||||
ListTile(
|
||||
title: const Center(child: Text('Banned users')),
|
||||
|
|
|
@ -21,16 +21,17 @@ class UsersListPage extends StatelessWidget {
|
|||
|
||||
// TODO: change to infinite scroll
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(title ?? '', style: theme.textTheme.headline6),
|
||||
centerTitle: true,
|
||||
backgroundColor: theme.cardColor,
|
||||
iconTheme: theme.iconTheme,
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemBuilder: (context, i) => UsersListItem(user: users[i]),
|
||||
itemCount: users.length,
|
||||
));
|
||||
appBar: AppBar(
|
||||
title: Text(title ?? '', style: theme.textTheme.headline6),
|
||||
centerTitle: true,
|
||||
backgroundColor: theme.cardColor,
|
||||
iconTheme: theme.iconTheme,
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemBuilder: (context, i) => UsersListItem(user: users[i]),
|
||||
itemCount: users.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,7 @@ class UsersListItem extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) => ListTile(
|
||||
title: Text(user.user.displayName),
|
||||
title: Text(user.user.originDisplayName),
|
||||
subtitle: user.user.bio != null
|
||||
? Opacity(
|
||||
opacity: 0.5,
|
||||
|
@ -62,12 +63,13 @@ class UsersListItem extends StatelessWidget {
|
|||
errorWidget: (_, __, ___) =>
|
||||
const SizedBox(height: 50, width: 50),
|
||||
imageBuilder: (context, imageProvider) => Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover, image: imageProvider),
|
||||
),
|
||||
))
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover, image: imageProvider),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(width: 50),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ String _extract(String url) => urlHost(url);
|
|||
|
||||
extension DisplayNames on UserSafe {
|
||||
String get displayName {
|
||||
if (preferredUsername != null && preferredUsername != '') {
|
||||
if (preferredUsername != null && preferredUsername.isNotEmpty) {
|
||||
return preferredUsername;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue