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