style: Move chats to top

This commit is contained in:
Krille 2023-03-15 21:07:36 +01:00
parent 511dd41d30
commit 71eac7078e
3 changed files with 21 additions and 19 deletions

View File

@ -9,7 +9,10 @@ import 'app_config.dart';
abstract class FluffyThemes {
static const double columnWidth = 360.0;
static bool isColumnModeByWidth(double width) => width > columnWidth * 2 + 64;
static const double navRailWidth = 64.0;
static bool isColumnModeByWidth(double width) =>
width > columnWidth * 2 + navRailWidth;
static bool isColumnMode(BuildContext context) =>
isColumnModeByWidth(MediaQuery.of(context).size.width);

View File

@ -93,10 +93,9 @@ class ChatListController extends State<ChatList>
int get selectedIndex {
switch (activeFilter) {
case ActiveFilter.allChats:
case ActiveFilter.messages:
return 0;
case ActiveFilter.groups:
return 0;
case ActiveFilter.messages:
return 1;
case ActiveFilter.spaces:
return AppConfig.separateChatTypes ? 2 : 1;
@ -107,7 +106,7 @@ class ChatListController extends State<ChatList>
switch (i) {
case 1:
if (AppConfig.separateChatTypes) {
return ActiveFilter.messages;
return ActiveFilter.groups;
}
return ActiveFilter.spaces;
case 2:
@ -115,7 +114,7 @@ class ChatListController extends State<ChatList>
case 0:
default:
if (AppConfig.separateChatTypes) {
return ActiveFilter.groups;
return ActiveFilter.messages;
}
return ActiveFilter.allChats;
}

View File

@ -27,19 +27,6 @@ class ChatListView extends StatelessWidget {
final badgePosition = BadgePosition.topEnd(top: -12, end: -8);
return [
if (AppConfig.separateChatTypes) ...[
NavigationDestination(
icon: UnreadRoomsBadge(
badgePosition: badgePosition,
filter: controller.getRoomFilterByActiveFilter(ActiveFilter.groups),
child: const Icon(Icons.groups_outlined),
),
selectedIcon: UnreadRoomsBadge(
badgePosition: badgePosition,
filter: controller.getRoomFilterByActiveFilter(ActiveFilter.groups),
child: const Icon(Icons.groups),
),
label: L10n.of(context)!.groups,
),
NavigationDestination(
icon: UnreadRoomsBadge(
badgePosition: badgePosition,
@ -55,6 +42,19 @@ class ChatListView extends StatelessWidget {
),
label: L10n.of(context)!.messages,
),
NavigationDestination(
icon: UnreadRoomsBadge(
badgePosition: badgePosition,
filter: controller.getRoomFilterByActiveFilter(ActiveFilter.groups),
child: const Icon(Icons.groups_outlined),
),
selectedIcon: UnreadRoomsBadge(
badgePosition: badgePosition,
filter: controller.getRoomFilterByActiveFilter(ActiveFilter.groups),
child: const Icon(Icons.groups),
),
label: L10n.of(context)!.groups,
),
] else
NavigationDestination(
icon: UnreadRoomsBadge(
@ -124,7 +124,7 @@ class ChatListView extends StatelessWidget {
final destinations = getNavigationDestinations(context);
return SizedBox(
width: 64,
width: FluffyThemes.navRailWidth,
child: ListView.builder(
scrollDirection: Axis.vertical,
itemCount: rootSpaces.length + destinations.length,