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

Loading…
Cancel
Save