mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-05 19:49:29 +01:00
style: Move chats to top
This commit is contained in:
parent
511dd41d30
commit
71eac7078e
@ -9,7 +9,10 @@ import 'app_config.dart';
|
|||||||
abstract class FluffyThemes {
|
abstract class FluffyThemes {
|
||||||
static const double columnWidth = 360.0;
|
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) =>
|
static bool isColumnMode(BuildContext context) =>
|
||||||
isColumnModeByWidth(MediaQuery.of(context).size.width);
|
isColumnModeByWidth(MediaQuery.of(context).size.width);
|
||||||
|
@ -93,10 +93,9 @@ class ChatListController extends State<ChatList>
|
|||||||
int get selectedIndex {
|
int get selectedIndex {
|
||||||
switch (activeFilter) {
|
switch (activeFilter) {
|
||||||
case ActiveFilter.allChats:
|
case ActiveFilter.allChats:
|
||||||
|
case ActiveFilter.messages:
|
||||||
return 0;
|
return 0;
|
||||||
case ActiveFilter.groups:
|
case ActiveFilter.groups:
|
||||||
return 0;
|
|
||||||
case ActiveFilter.messages:
|
|
||||||
return 1;
|
return 1;
|
||||||
case ActiveFilter.spaces:
|
case ActiveFilter.spaces:
|
||||||
return AppConfig.separateChatTypes ? 2 : 1;
|
return AppConfig.separateChatTypes ? 2 : 1;
|
||||||
@ -107,7 +106,7 @@ class ChatListController extends State<ChatList>
|
|||||||
switch (i) {
|
switch (i) {
|
||||||
case 1:
|
case 1:
|
||||||
if (AppConfig.separateChatTypes) {
|
if (AppConfig.separateChatTypes) {
|
||||||
return ActiveFilter.messages;
|
return ActiveFilter.groups;
|
||||||
}
|
}
|
||||||
return ActiveFilter.spaces;
|
return ActiveFilter.spaces;
|
||||||
case 2:
|
case 2:
|
||||||
@ -115,7 +114,7 @@ class ChatListController extends State<ChatList>
|
|||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
if (AppConfig.separateChatTypes) {
|
if (AppConfig.separateChatTypes) {
|
||||||
return ActiveFilter.groups;
|
return ActiveFilter.messages;
|
||||||
}
|
}
|
||||||
return ActiveFilter.allChats;
|
return ActiveFilter.allChats;
|
||||||
}
|
}
|
||||||
|
@ -27,19 +27,6 @@ class ChatListView extends StatelessWidget {
|
|||||||
final badgePosition = BadgePosition.topEnd(top: -12, end: -8);
|
final badgePosition = BadgePosition.topEnd(top: -12, end: -8);
|
||||||
return [
|
return [
|
||||||
if (AppConfig.separateChatTypes) ...[
|
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(
|
NavigationDestination(
|
||||||
icon: UnreadRoomsBadge(
|
icon: UnreadRoomsBadge(
|
||||||
badgePosition: badgePosition,
|
badgePosition: badgePosition,
|
||||||
@ -55,6 +42,19 @@ class ChatListView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
label: L10n.of(context)!.messages,
|
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
|
] else
|
||||||
NavigationDestination(
|
NavigationDestination(
|
||||||
icon: UnreadRoomsBadge(
|
icon: UnreadRoomsBadge(
|
||||||
@ -124,7 +124,7 @@ class ChatListView extends StatelessWidget {
|
|||||||
final destinations = getNavigationDestinations(context);
|
final destinations = getNavigationDestinations(context);
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 64,
|
width: FluffyThemes.navRailWidth,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
itemCount: rootSpaces.length + destinations.length,
|
itemCount: rootSpaces.length + destinations.length,
|
||||||
|
Loading…
Reference in New Issue
Block a user