mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-23 01:30:41 +01:00
fix: Bottombar design
This commit is contained in:
parent
f879708d42
commit
e227bb9200
@ -410,10 +410,10 @@ class ChatListController extends State<ChatList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setActiveClient(int i) => setState(() {
|
void setActiveClient(Client client) => setState(() {
|
||||||
_activeSpaceId = null;
|
_activeSpaceId = null;
|
||||||
selectedRoomIds.clear();
|
selectedRoomIds.clear();
|
||||||
Matrix.of(context).activeClient = i - (displayBundles ? 1 : 0);
|
Matrix.of(context).setActiveClient(client);
|
||||||
});
|
});
|
||||||
|
|
||||||
void setActiveBundle(String bundle) => setState(() {
|
void setActiveBundle(String bundle) => setState(() {
|
||||||
|
@ -25,9 +25,7 @@ class ChatListView extends StatelessWidget {
|
|||||||
|
|
||||||
List<BottomNavigationBarItem> getBottomBarItems(BuildContext context) {
|
List<BottomNavigationBarItem> getBottomBarItems(BuildContext context) {
|
||||||
final displayClients = Matrix.of(context).hasComplexBundles
|
final displayClients = Matrix.of(context).hasComplexBundles
|
||||||
? Matrix.of(context).accountBundles[Matrix.of(context).activeBundle ??
|
? Matrix.of(context).currentBundle
|
||||||
Matrix.of(context).client.accountBundles.first.name] ??
|
|
||||||
[]
|
|
||||||
: Matrix.of(context).widget.clients;
|
: Matrix.of(context).widget.clients;
|
||||||
if (displayClients.isEmpty) {
|
if (displayClients.isEmpty) {
|
||||||
displayClients.addAll(Matrix.of(context).widget.clients);
|
displayClients.addAll(Matrix.of(context).widget.clients);
|
||||||
@ -41,8 +39,7 @@ class ChatListView extends StatelessWidget {
|
|||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
borderRadius: BorderRadius.circular(32),
|
borderRadius: BorderRadius.circular(32),
|
||||||
onTap: () => controller.setActiveClient(
|
onTap: () => controller.setActiveClient(client),
|
||||||
Matrix.of(context).getClientIndexByMatrixId(client.userID)),
|
|
||||||
onLongPress: () =>
|
onLongPress: () =>
|
||||||
controller.editBundlesForAccount(client.userID),
|
controller.editBundlesForAccount(client.userID),
|
||||||
child: Avatar(
|
child: Avatar(
|
||||||
@ -55,7 +52,7 @@ class ChatListView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
if (controller.displayBundles) {
|
if (controller.displayBundles && false) {
|
||||||
items.insert(
|
items.insert(
|
||||||
0,
|
0,
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
@ -289,25 +286,79 @@ class ChatListView extends StatelessWidget {
|
|||||||
s.accountData != null &&
|
s.accountData != null &&
|
||||||
s.accountData
|
s.accountData
|
||||||
.any((e) => e.type == accountBundlesType)))),
|
.any((e) => e.type == accountBundlesType)))),
|
||||||
builder: (context, _) => SingleChildScrollView(
|
builder: (context, _) => Material(
|
||||||
scrollDirection: Axis.horizontal,
|
color: Theme.of(context)
|
||||||
child: SizedBox(
|
.bottomNavigationBarTheme
|
||||||
width: max(
|
.backgroundColor,
|
||||||
FluffyThemes.isColumnMode(context)
|
child: Column(
|
||||||
? FluffyThemes.columnWidth
|
mainAxisSize: MainAxisSize.min,
|
||||||
: MediaQuery.of(context).size.width,
|
children: [
|
||||||
Matrix.of(context).widget.clients.length * 84.0,
|
Divider(height: 1),
|
||||||
),
|
Builder(builder: (context) {
|
||||||
child: BottomNavigationBar(
|
final items = getBottomBarItems(context);
|
||||||
onTap: controller.setActiveClient,
|
if (items.length == 1) {
|
||||||
currentIndex: Matrix.of(context).activeClient +
|
return Padding(
|
||||||
(controller.displayBundles ? 1 : 0),
|
padding: const EdgeInsets.all(7.0),
|
||||||
showUnselectedLabels: false,
|
child: Column(
|
||||||
showSelectedLabels: true,
|
mainAxisSize: MainAxisSize.min,
|
||||||
type: BottomNavigationBarType.shifting,
|
children: [
|
||||||
selectedItemColor: Theme.of(context).primaryColor,
|
items.single.icon,
|
||||||
items: getBottomBarItems(context),
|
Text(items.single.label),
|
||||||
),
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: SizedBox(
|
||||||
|
width: max(
|
||||||
|
FluffyThemes.isColumnMode(context)
|
||||||
|
? FluffyThemes.columnWidth
|
||||||
|
: MediaQuery.of(context).size.width,
|
||||||
|
Matrix.of(context).widget.clients.length *
|
||||||
|
84.0,
|
||||||
|
),
|
||||||
|
child: BottomNavigationBar(
|
||||||
|
elevation: 0,
|
||||||
|
onTap: (i) => controller.setActiveClient(
|
||||||
|
Matrix.of(context).currentBundle[i]),
|
||||||
|
currentIndex: Matrix.of(context)
|
||||||
|
.currentBundle
|
||||||
|
.indexWhere(
|
||||||
|
(client) =>
|
||||||
|
client ==
|
||||||
|
Matrix.of(context).client,
|
||||||
|
),
|
||||||
|
showUnselectedLabels: false,
|
||||||
|
showSelectedLabels: true,
|
||||||
|
type: BottomNavigationBarType.shifting,
|
||||||
|
selectedItemColor:
|
||||||
|
Theme.of(context).primaryColor,
|
||||||
|
items: items,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
if (controller.displayBundles)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 4.0,
|
||||||
|
horizontal: 12,
|
||||||
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: CupertinoSlidingSegmentedControl(
|
||||||
|
groupValue: Matrix.of(context).activeBundle,
|
||||||
|
onValueChanged: controller.setActiveBundle,
|
||||||
|
children: Map.fromEntries(Matrix.of(context)
|
||||||
|
.accountBundles
|
||||||
|
.keys
|
||||||
|
.map((bundle) =>
|
||||||
|
MapEntry(bundle, Text(bundle)))),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user