refactor: Avatar widget

This commit is contained in:
Krille Fear 2021-11-20 10:42:23 +01:00
commit 53967eb1f0
20 changed files with 69 additions and 47 deletions

View file

@ -171,7 +171,11 @@ class ChatListItem extends StatelessWidget {
child: const Icon(Icons.check, color: Colors.white),
),
)
: Avatar(room.avatar, room.displayname, onTap: onLongPress),
: Avatar(
mxContent: room.avatar,
name: room.displayname,
onTap: onLongPress,
),
title: Row(
children: <Widget>[
Expanded(

View file

@ -48,8 +48,9 @@ class ClientChooserButton extends StatelessWidget {
builder: (context, snapshot) => Row(
children: [
Avatar(
snapshot.data?.avatarUrl,
snapshot.data?.displayName ?? client.userID.localpart,
mxContent: snapshot.data?.avatarUrl,
name: snapshot.data?.displayName ??
client.userID.localpart,
size: 28,
fontSize: 12,
),
@ -84,8 +85,8 @@ class ClientChooserButton extends StatelessWidget {
future: matrix.client.ownProfile,
builder: (context, snapshot) => PopupMenuButton<Object>(
child: Avatar(
snapshot.data?.avatarUrl,
snapshot.data?.displayName ?? matrix.client.userID.localpart,
mxContent: snapshot.data?.avatarUrl,
name: snapshot.data?.displayName ?? matrix.client.userID.localpart,
size: 28,
fontSize: 12,
),

View file

@ -59,8 +59,8 @@ class SpacesBottomBar extends StatelessWidget {
onLongPress: () =>
controller.editSpace(context, space.id),
child: Avatar(
space.avatar,
space.displayname,
mxContent: space.avatar,
name: space.displayname,
size: 24,
fontSize: 12,
),