feat: add setting for whether to show space navigation rail on mobile
This commit is contained in:
parent
12320d4198
commit
4b926935bd
8 changed files with 22 additions and 5 deletions
|
|
@ -3236,5 +3236,6 @@
|
|||
"enterNewChat": "Enter new chat",
|
||||
"approve": "Approve",
|
||||
"youHaveKnocked": "You have knocked",
|
||||
"pleaseWaitUntilInvited": "Please wait now, until someone from the room invites you."
|
||||
"pleaseWaitUntilInvited": "Please wait now, until someone from the room invites you.",
|
||||
"displayNavigationRail": "Show navigation rail on mobile"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ abstract class AppConfig {
|
|||
static bool swipeRightToLeftToReply = true;
|
||||
static bool? sendOnEnter;
|
||||
static bool showPresences = true;
|
||||
static bool displayNavigationRail = false;
|
||||
static bool experimentalVoip = false;
|
||||
static const bool hideTypingUsernames = false;
|
||||
static const bool hideAllStateEvents = false;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ abstract class SettingKeys {
|
|||
'chat.fluffy.swipeRightToLeftToReply';
|
||||
static const String experimentalVoip = 'chat.fluffy.experimental_voip';
|
||||
static const String showPresences = 'chat.fluffy.show_presences';
|
||||
static const String displayNavigationRail =
|
||||
'chat.fluffy.display_navigation_rail';
|
||||
}
|
||||
|
||||
enum AppSettings<T> {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||
ActiveFilter.groups,
|
||||
ActiveFilter.unread,
|
||||
if (spaceDelegateCandidates.isNotEmpty &&
|
||||
!controller.widget.displayNavigationRail)
|
||||
!AppConfig.displayNavigationRail &&
|
||||
!FluffyThemes.isColumnMode(context))
|
||||
ActiveFilter.spaces,
|
||||
]
|
||||
.map(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||
import 'package:fluffychat/widgets/navigation_rail.dart';
|
||||
|
|
@ -30,8 +31,8 @@ class ChatListView extends StatelessWidget {
|
|||
},
|
||||
child: Row(
|
||||
children: [
|
||||
if (FluffyThemes.isColumnMode(context) &&
|
||||
controller.widget.displayNavigationRail) ...[
|
||||
if (FluffyThemes.isColumnMode(context) ||
|
||||
AppConfig.displayNavigationRail) ...[
|
||||
SpacesNavigationRail(
|
||||
activeSpaceId: controller.activeSpaceId,
|
||||
onGoToChats: controller.clearActiveSpace,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ class SettingsView extends StatelessWidget {
|
|||
?.tryGet<String>('account');
|
||||
return Row(
|
||||
children: [
|
||||
if (FluffyThemes.isColumnMode(context)) ...[
|
||||
if (FluffyThemes.isColumnMode(context) ||
|
||||
AppConfig.displayNavigationRail) ...[
|
||||
SpacesNavigationRail(
|
||||
activeSpaceId: null,
|
||||
onGoToChats: () => context.go('/rooms'),
|
||||
|
|
|
|||
|
|
@ -359,6 +359,12 @@ class SettingsStyleView extends StatelessWidget {
|
|||
storeKey: SettingKeys.separateChatTypes,
|
||||
defaultValue: AppConfig.separateChatTypes,
|
||||
),
|
||||
SettingsSwitchListTile.adaptive(
|
||||
title: L10n.of(context).displayNavigationRail,
|
||||
onChanged: (b) => AppConfig.displayNavigationRail = b,
|
||||
storeKey: SettingKeys.displayNavigationRail,
|
||||
defaultValue: AppConfig.displayNavigationRail,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -436,6 +436,10 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
|
||||
AppConfig.showPresences =
|
||||
store.getBool(SettingKeys.showPresences) ?? AppConfig.showPresences;
|
||||
|
||||
AppConfig.displayNavigationRail =
|
||||
store.getBool(SettingKeys.displayNavigationRail) ??
|
||||
AppConfig.displayNavigationRail;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue