mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-22 09:10:44 +01:00
feat: Display bundles
This commit is contained in:
parent
d619fefa62
commit
33e606eefe
@ -21,21 +21,22 @@ class ChatListView extends StatelessWidget {
|
||||
|
||||
List<BottomNavigationBarItem> getBottomBarItems(BuildContext context) {
|
||||
final items = Matrix.of(context)
|
||||
.widget
|
||||
.clients
|
||||
.map((client) => BottomNavigationBarItem(
|
||||
label: client.userID,
|
||||
icon: FutureBuilder<Profile>(
|
||||
future: client.ownProfile,
|
||||
builder: (context, snapshot) {
|
||||
return Avatar(
|
||||
snapshot.data?.avatarUrl,
|
||||
snapshot.data?.displayName ?? client.userID.localpart,
|
||||
size: 32,
|
||||
);
|
||||
}),
|
||||
))
|
||||
.toList();
|
||||
.accountBundles[Matrix.of(context).activeBundle]
|
||||
.map((clientId) {
|
||||
final client = Matrix.of(context).widget.clients[clientId];
|
||||
return BottomNavigationBarItem(
|
||||
label: client.userID,
|
||||
icon: FutureBuilder<Profile>(
|
||||
future: client.ownProfile,
|
||||
builder: (context, snapshot) {
|
||||
return Avatar(
|
||||
snapshot.data?.avatarUrl,
|
||||
snapshot.data?.displayName ?? client.userID.localpart,
|
||||
size: 32,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}).toList();
|
||||
|
||||
if (Matrix.of(context).hasComplexBundles) {
|
||||
items.insert(
|
||||
@ -47,10 +48,15 @@ class ChatListView extends StatelessWidget {
|
||||
Icons.menu,
|
||||
color: Theme.of(context).textTheme.bodyText1.color,
|
||||
),
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem(child: Text('Arbeit')),
|
||||
PopupMenuItem(child: Text('Privat')),
|
||||
],
|
||||
itemBuilder: (context) => Matrix.of(context)
|
||||
.accountBundles
|
||||
.keys
|
||||
.map(
|
||||
(bundle) => PopupMenuItem(
|
||||
child: Text(bundle),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
)));
|
||||
}
|
||||
return items;
|
||||
|
@ -77,7 +77,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||
return activeClient;
|
||||
}
|
||||
|
||||
Map<String, List<Client>> getBundles() {
|
||||
Map<String, List<int>> get accountBundles {
|
||||
final resBundles = <String, List<_AccountBundleWithClient>>{};
|
||||
for (var i = 0; i < widget.clients.length; i++) {
|
||||
final bundles = widget.clients[i].accountBundles;
|
||||
@ -103,7 +103,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||
.map((k, v) => MapEntry(k, v.map((vv) => vv.client).toList()));
|
||||
}
|
||||
|
||||
bool get hasComplexBundles => getBundles().values.any((v) => v.length > 1);
|
||||
bool get hasComplexBundles => accountBundles.values.any((v) => v.length > 1);
|
||||
|
||||
Client _loginClientCandidate;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user