fix: Null error in ClientChooserButton

pull/1754/head
krille-chan 4 months ago
parent 04dbd16095
commit 782d0577a2
No known key found for this signature in database

@ -99,28 +99,27 @@ class ClientChooserButton extends StatelessWidget {
], ],
), ),
), ),
...matrix.accountBundles[bundle]!.map( ...matrix.accountBundles[bundle]!
.whereType<Client>()
.where((client) => client.isLogged())
.map(
(client) => PopupMenuItem( (client) => PopupMenuItem(
value: client, value: client,
child: FutureBuilder<Profile?>( child: FutureBuilder<Profile?>(
// analyzer does not understand this type cast for error future: client.fetchOwnProfile(),
// handling
//
// ignore: unnecessary_cast
future: (client!.fetchOwnProfile() as Future<Profile?>)
.onError((e, s) => null),
builder: (context, snapshot) => Row( builder: (context, snapshot) => Row(
children: [ children: [
Avatar( Avatar(
mxContent: snapshot.data?.avatarUrl, mxContent: snapshot.data?.avatarUrl,
name: name: snapshot.data?.displayName ??
snapshot.data?.displayName ?? client.userID!.localpart, client.userID!.localpart,
size: 32, size: 32,
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded( Expanded(
child: Text( child: Text(
snapshot.data?.displayName ?? client.userID!.localpart!, snapshot.data?.displayName ??
client.userID!.localpart!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),

Loading…
Cancel
Save