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",
|
"enterNewChat": "Enter new chat",
|
||||||
"approve": "Approve",
|
"approve": "Approve",
|
||||||
"youHaveKnocked": "You have knocked",
|
"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 swipeRightToLeftToReply = true;
|
||||||
static bool? sendOnEnter;
|
static bool? sendOnEnter;
|
||||||
static bool showPresences = true;
|
static bool showPresences = true;
|
||||||
|
static bool displayNavigationRail = false;
|
||||||
static bool experimentalVoip = false;
|
static bool experimentalVoip = false;
|
||||||
static const bool hideTypingUsernames = false;
|
static const bool hideTypingUsernames = false;
|
||||||
static const bool hideAllStateEvents = false;
|
static const bool hideAllStateEvents = false;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ abstract class SettingKeys {
|
||||||
'chat.fluffy.swipeRightToLeftToReply';
|
'chat.fluffy.swipeRightToLeftToReply';
|
||||||
static const String experimentalVoip = 'chat.fluffy.experimental_voip';
|
static const String experimentalVoip = 'chat.fluffy.experimental_voip';
|
||||||
static const String showPresences = 'chat.fluffy.show_presences';
|
static const String showPresences = 'chat.fluffy.show_presences';
|
||||||
|
static const String displayNavigationRail =
|
||||||
|
'chat.fluffy.display_navigation_rail';
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AppSettings<T> {
|
enum AppSettings<T> {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,8 @@ class ChatListViewBody extends StatelessWidget {
|
||||||
ActiveFilter.groups,
|
ActiveFilter.groups,
|
||||||
ActiveFilter.unread,
|
ActiveFilter.unread,
|
||||||
if (spaceDelegateCandidates.isNotEmpty &&
|
if (spaceDelegateCandidates.isNotEmpty &&
|
||||||
!controller.widget.displayNavigationRail)
|
!AppConfig.displayNavigationRail &&
|
||||||
|
!FluffyThemes.isColumnMode(context))
|
||||||
ActiveFilter.spaces,
|
ActiveFilter.spaces,
|
||||||
]
|
]
|
||||||
.map(
|
.map(
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
import 'package:fluffychat/widgets/navigation_rail.dart';
|
import 'package:fluffychat/widgets/navigation_rail.dart';
|
||||||
|
|
@ -30,8 +31,8 @@ class ChatListView extends StatelessWidget {
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (FluffyThemes.isColumnMode(context) &&
|
if (FluffyThemes.isColumnMode(context) ||
|
||||||
controller.widget.displayNavigationRail) ...[
|
AppConfig.displayNavigationRail) ...[
|
||||||
SpacesNavigationRail(
|
SpacesNavigationRail(
|
||||||
activeSpaceId: controller.activeSpaceId,
|
activeSpaceId: controller.activeSpaceId,
|
||||||
onGoToChats: controller.clearActiveSpace,
|
onGoToChats: controller.clearActiveSpace,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ class SettingsView extends StatelessWidget {
|
||||||
?.tryGet<String>('account');
|
?.tryGet<String>('account');
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
if (FluffyThemes.isColumnMode(context)) ...[
|
if (FluffyThemes.isColumnMode(context) ||
|
||||||
|
AppConfig.displayNavigationRail) ...[
|
||||||
SpacesNavigationRail(
|
SpacesNavigationRail(
|
||||||
activeSpaceId: null,
|
activeSpaceId: null,
|
||||||
onGoToChats: () => context.go('/rooms'),
|
onGoToChats: () => context.go('/rooms'),
|
||||||
|
|
|
||||||
|
|
@ -359,6 +359,12 @@ class SettingsStyleView extends StatelessWidget {
|
||||||
storeKey: SettingKeys.separateChatTypes,
|
storeKey: SettingKeys.separateChatTypes,
|
||||||
defaultValue: AppConfig.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 =
|
AppConfig.showPresences =
|
||||||
store.getBool(SettingKeys.showPresences) ?? AppConfig.showPresences;
|
store.getBool(SettingKeys.showPresences) ?? AppConfig.showPresences;
|
||||||
|
|
||||||
|
AppConfig.displayNavigationRail =
|
||||||
|
store.getBool(SettingKeys.displayNavigationRail) ??
|
||||||
|
AppConfig.displayNavigationRail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue