mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 03:45:12 +00:00
style: Move chats to top
This commit is contained in:
parent
841c081e08
commit
fc675aebaa
3 changed files with 21 additions and 19 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue