Skip to content

Commit 3d0b845

Browse files
authored
Add option to force vertical chat in landscape mode (#196)
* Add option to force vertical chat in landscape * Set `isThreeLine` for new setting
1 parent d5e8d0c commit 3d0b845

File tree

4 files changed

+51
-23
lines changed

4 files changed

+51
-23
lines changed

lib/screens/channel/channel.dart

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ class _VideoChatState extends State<VideoChat> {
166166
final videoChat = Scaffold(
167167
body: OrientationBuilder(
168168
builder: (context, orientation) {
169-
if (orientation == Orientation.landscape) {
170-
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
169+
return Observer(
170+
builder: (_) {
171+
if (orientation == Orientation.landscape && !settingsStore.landscapeForceVerticalChat) {
172+
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
171173

172-
return Observer(
173-
builder: (context) {
174174
final landscapeChat = AnimatedContainer(
175175
duration: const Duration(milliseconds: 200),
176176
width: _chatStore.expandChat ? MediaQuery.of(context).size.width / 2 : MediaQuery.of(context).size.width * _chatStore.settings.chatWidth,
@@ -224,27 +224,21 @@ class _VideoChatState extends State<VideoChat> {
224224
),
225225
),
226226
);
227-
},
228-
);
229-
}
230-
231-
SystemChrome.setEnabledSystemUIMode(
232-
SystemUiMode.manual,
233-
overlays: SystemUiOverlay.values,
234-
);
235-
return SafeArea(
236-
child: Column(
237-
children: [
238-
Observer(
239-
builder: (_) {
240-
if (!settingsStore.showVideo) return appBar;
227+
}
241228

242-
return AspectRatio(aspectRatio: 16 / 9, child: video);
243-
},
229+
SystemChrome.setEnabledSystemUIMode(
230+
SystemUiMode.manual,
231+
overlays: SystemUiOverlay.values,
232+
);
233+
return SafeArea(
234+
child: Column(
235+
children: [
236+
if (!settingsStore.showVideo) appBar else AspectRatio(aspectRatio: 16 / 9, child: video),
237+
Expanded(child: chat),
238+
],
244239
),
245-
Expanded(child: chat),
246-
],
247-
),
240+
);
241+
},
248242
);
249243
},
250244
),

lib/screens/settings/chat_settings.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ class _ChatSettingsState extends State<ChatSettings> {
9999
value: settingsStore.landscapeChatLeftSide,
100100
onChanged: (newValue) => settingsStore.landscapeChatLeftSide = newValue,
101101
),
102+
SwitchListTile.adaptive(
103+
isThreeLine: true,
104+
title: const Text('Force vertical chat in landscape mode'),
105+
subtitle: const Text('Note: this option is intended for tablets and other larger displays.'),
106+
value: settingsStore.landscapeForceVerticalChat,
107+
onChanged: (newValue) => settingsStore.landscapeForceVerticalChat = newValue,
108+
),
102109
SwitchListTile.adaptive(
103110
isThreeLine: true,
104111
title: const Text('Notifications on bottom'),

lib/screens/settings/stores/settings_store.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ abstract class _SettingsStoreBase with Store {
9393
static const defaultShowBottomBar = true;
9494
static const defaultEmoteMenuButtonOnLeft = false;
9595
static const defaultLandscapeChatLeftSide = false;
96+
static const defaultLandscapeForceVerticalChat = false;
9697
static const defaultChatNotificationsOnBottom = false;
9798
static const defaultChatWidth = 0.3;
9899
static const defaultFullScreenChatOverlayOpacity = 0.5;
@@ -135,6 +136,10 @@ abstract class _SettingsStoreBase with Store {
135136
@observable
136137
var landscapeChatLeftSide = defaultLandscapeChatLeftSide;
137138

139+
@JsonKey(defaultValue: defaultLandscapeForceVerticalChat)
140+
@observable
141+
var landscapeForceVerticalChat = defaultLandscapeForceVerticalChat;
142+
138143
@JsonKey(defaultValue: defaultChatNotificationsOnBottom)
139144
@observable
140145
var chatNotificationsOnBottom = defaultChatNotificationsOnBottom;
@@ -203,6 +208,7 @@ abstract class _SettingsStoreBase with Store {
203208
showBottomBar = defaultShowBottomBar;
204209
emoteMenuButtonOnLeft = defaultEmoteMenuButtonOnLeft;
205210
landscapeChatLeftSide = defaultLandscapeChatLeftSide;
211+
landscapeForceVerticalChat = defaultLandscapeForceVerticalChat;
206212
chatNotificationsOnBottom = defaultChatNotificationsOnBottom;
207213
landscapeCutout = defaultLandscapeCutout;
208214
chatWidth = defaultChatWidth;

lib/screens/settings/stores/settings_store.g.dart

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)