|
|
|
@ -15,7 +15,7 @@ import 'chat_list.dart';
|
|
|
|
|
class ClientChooserButton extends StatelessWidget {
|
|
|
|
|
final ChatListController controller;
|
|
|
|
|
|
|
|
|
|
const ClientChooserButton(this.controller, {Key? key}) : super(key: key);
|
|
|
|
|
const ClientChooserButton(this.controller, {super.key});
|
|
|
|
|
|
|
|
|
|
List<PopupMenuEntry<Object>> _bundleMenuItems(BuildContext context) {
|
|
|
|
|
final matrix = Matrix.of(context);
|
|
|
|
@ -112,48 +112,45 @@ class ClientChooserButton extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
...matrix.accountBundles[bundle]!
|
|
|
|
|
.map(
|
|
|
|
|
(client) => PopupMenuItem(
|
|
|
|
|
value: client,
|
|
|
|
|
child: FutureBuilder<Profile?>(
|
|
|
|
|
// analyzer does not understand this type cast for error
|
|
|
|
|
// handling
|
|
|
|
|
//
|
|
|
|
|
// ignore: unnecessary_cast
|
|
|
|
|
future: (client!.fetchOwnProfile() as Future<Profile?>)
|
|
|
|
|
.onError((e, s) => null),
|
|
|
|
|
builder: (context, snapshot) => Row(
|
|
|
|
|
children: [
|
|
|
|
|
Avatar(
|
|
|
|
|
mxContent: snapshot.data?.avatarUrl,
|
|
|
|
|
name: snapshot.data?.displayName ??
|
|
|
|
|
client.userID!.localpart,
|
|
|
|
|
size: 32,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
...matrix.accountBundles[bundle]!.map(
|
|
|
|
|
(client) => PopupMenuItem(
|
|
|
|
|
value: client,
|
|
|
|
|
child: FutureBuilder<Profile?>(
|
|
|
|
|
// analyzer does not understand this type cast for error
|
|
|
|
|
// handling
|
|
|
|
|
//
|
|
|
|
|
// ignore: unnecessary_cast
|
|
|
|
|
future: (client!.fetchOwnProfile() as Future<Profile?>)
|
|
|
|
|
.onError((e, s) => null),
|
|
|
|
|
builder: (context, snapshot) => Row(
|
|
|
|
|
children: [
|
|
|
|
|
Avatar(
|
|
|
|
|
mxContent: snapshot.data?.avatarUrl,
|
|
|
|
|
name:
|
|
|
|
|
snapshot.data?.displayName ?? client.userID!.localpart,
|
|
|
|
|
size: 32,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
value: SettingsAction.addAccount,
|
|
|
|
|