From 95e1e463082ad61f32db4e72c877b0897405e909 Mon Sep 17 00:00:00 2001 From: tommyxchow Date: Mon, 23 May 2022 22:12:56 -0400 Subject: [PATCH 1/4] Add option to resize chat in landscape (#116) --- .../channel/chat/widgets/chat_bottom_bar.dart | 75 +++++++++++-------- lib/screens/channel/stores/chat_store.dart | 5 ++ lib/screens/channel/stores/chat_store.g.dart | 18 ++++- lib/screens/channel/video_chat.dart | 19 +++-- .../settings/sections/chat_settings.dart | 16 ++++ .../settings/stores/settings_store.dart | 7 ++ .../settings/stores/settings_store.g.dart | 20 +++++ 7 files changed, 117 insertions(+), 43 deletions(-) diff --git a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart index 2efc169a..a0cc8332 100644 --- a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart +++ b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart @@ -73,42 +73,53 @@ class ChatBottomBar extends StatelessWidget { ), ), ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0), - child: TextField( - textInputAction: TextInputAction.send, - focusNode: chatStore.textFieldFocusNode, - minLines: 1, - maxLines: 5, - enabled: chatStore.auth.isLoggedIn ? true : false, - decoration: InputDecoration( - suffixIcon: IconButton( - color: chatStore.assetsStore.showEmoteMenu ? Colors.deepPurple : null, - tooltip: 'Emote Menu', - icon: const Icon(Icons.emoji_emotions_outlined), - onPressed: () { - FocusScope.of(context).unfocus(); - chatStore.assetsStore.showEmoteMenu = !chatStore.assetsStore.showEmoteMenu; - }, + if (!chatStore.expandChat && + chatStore.settings.landscapeChatWidth < 0.3 && + MediaQuery.of(context).orientation == Orientation.landscape) + IconButton( + onPressed: () { + chatStore.expandChat = true; + chatStore.textFieldFocusNode.requestFocus(); + }, + icon: const Icon(Icons.chat)) + else + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0), + child: TextField( + textInputAction: TextInputAction.send, + focusNode: chatStore.textFieldFocusNode, + minLines: 1, + maxLines: 5, + enabled: chatStore.auth.isLoggedIn ? true : false, + decoration: InputDecoration( + suffixIcon: IconButton( + color: chatStore.assetsStore.showEmoteMenu ? Colors.deepPurple : null, + tooltip: 'Emote Menu', + icon: const Icon(Icons.emoji_emotions_outlined), + onPressed: () { + FocusScope.of(context).unfocus(); + chatStore.assetsStore.showEmoteMenu = !chatStore.assetsStore.showEmoteMenu; + }, + ), + hintMaxLines: 1, + contentPadding: const EdgeInsets.all(10.0), + border: const OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ), + labelText: chatStore.auth.isLoggedIn ? 'Send a message' : 'Log in to chat', ), - hintMaxLines: 1, - contentPadding: const EdgeInsets.all(10.0), - border: const OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(15.0)), - ), - labelText: chatStore.auth.isLoggedIn ? 'Send a message' : 'Log in to chat', + controller: chatStore.textController, + onSubmitted: chatStore.sendMessage, ), - controller: chatStore.textController, - onSubmitted: chatStore.sendMessage, ), ), - ), - IconButton( - tooltip: 'Send', - icon: const Icon(Icons.send), - onPressed: chatStore.auth.isLoggedIn ? () => chatStore.sendMessage(chatStore.textController.text) : null, - ) + if (chatStore.settings.landscapeChatWidth > 0.3 || chatStore.expandChat || MediaQuery.of(context).orientation == Orientation.portrait) + IconButton( + tooltip: 'Send', + icon: const Icon(Icons.send), + onPressed: chatStore.auth.isLoggedIn ? () => chatStore.sendMessage(chatStore.textController.text) : null, + ) ], ), ], diff --git a/lib/screens/channel/stores/chat_store.dart b/lib/screens/channel/stores/chat_store.dart index 442d8079..2595daeb 100644 --- a/lib/screens/channel/stores/chat_store.dart +++ b/lib/screens/channel/stores/chat_store.dart @@ -78,6 +78,9 @@ abstract class ChatStoreBase with Store { @readonly var _userState = const USERSTATE(); + @observable + var expandChat = false; + final reactions = []; ChatStoreBase({ @@ -116,6 +119,8 @@ abstract class ChatStoreBase with Store { // Add a listener to the textfield focus that will hide the emote menu if it is currently shown. textFieldFocusNode.addListener(() { if (textFieldFocusNode.hasFocus && assetsStore.showEmoteMenu) assetsStore.showEmoteMenu = false; + + if (!textFieldFocusNode.hasFocus) expandChat = false; }); // Add a listener to the textfield that will show/hide the autocomplete bar if focused. diff --git a/lib/screens/channel/stores/chat_store.g.dart b/lib/screens/channel/stores/chat_store.g.dart index 26670a84..f363ce6d 100644 --- a/lib/screens/channel/stores/chat_store.g.dart +++ b/lib/screens/channel/stores/chat_store.g.dart @@ -81,6 +81,22 @@ mixin _$ChatStore on ChatStoreBase, Store { }); } + late final _$expandChatAtom = + Atom(name: 'ChatStoreBase.expandChat', context: context); + + @override + bool get expandChat { + _$expandChatAtom.reportRead(); + return super.expandChat; + } + + @override + set expandChat(bool value) { + _$expandChatAtom.reportWrite(value, super.expandChat, () { + super.expandChat = value; + }); + } + late final _$ChatStoreBaseActionController = ActionController(name: 'ChatStoreBase', context: context); @@ -142,7 +158,7 @@ mixin _$ChatStore on ChatStoreBase, Store { @override String toString() { return ''' - +expandChat: ${expandChat} '''; } } diff --git a/lib/screens/channel/video_chat.dart b/lib/screens/channel/video_chat.dart index ec7c9bd4..e87ffd63 100644 --- a/lib/screens/channel/video_chat.dart +++ b/lib/screens/channel/video_chat.dart @@ -172,16 +172,15 @@ class _VideoChatState extends State { ) : Row( children: [ - Flexible( - flex: 2, - child: video, - ), - Flexible( - flex: 1, - child: ColoredBox( - color: Theme.of(context).scaffoldBackgroundColor, - child: chat, - ), + Expanded(child: video), + AnimatedContainer( + duration: const Duration(milliseconds: 200), + width: _chatStore.expandChat + ? MediaQuery.of(context).size.width / 2 + : MediaQuery.of(context).size.width * _chatStore.settings.landscapeChatWidth, + curve: Curves.ease, + color: Theme.of(context).scaffoldBackgroundColor, + child: chat, ), ], ) diff --git a/lib/screens/settings/sections/chat_settings.dart b/lib/screens/settings/sections/chat_settings.dart index 4723b70f..e74f025e 100644 --- a/lib/screens/settings/sections/chat_settings.dart +++ b/lib/screens/settings/sections/chat_settings.dart @@ -90,6 +90,22 @@ class _ChatSettingsState extends State { .toList(), ), ), + ListTile( + title: Row( + children: [ + const Text('Landscape Chat Width'), + const Spacer(), + Text('${(settingsStore.landscapeChatWidth * 100).toInt()}%'), + ], + ), + subtitle: Slider.adaptive( + value: settingsStore.landscapeChatWidth, + min: 0.2, + max: 0.8, + divisions: 12, + onChanged: (newValue) => settingsStore.landscapeChatWidth = newValue, + ), + ), const SizedBox(height: 10.0), const SectionHeader('Message Appearance'), ExpansionTile( diff --git a/lib/screens/settings/stores/settings_store.dart b/lib/screens/settings/stores/settings_store.dart index 10aa31d4..49f912b4 100644 --- a/lib/screens/settings/stores/settings_store.dart +++ b/lib/screens/settings/stores/settings_store.dart @@ -87,6 +87,8 @@ abstract class _SettingsStoreBase with Store { static const defaultEmoteAutocomplete = true; + static const defaultLandscapeChatWidth = 0.35; + @JsonKey(defaultValue: defaultShowBottomBar) @observable var showBottomBar = defaultShowBottomBar; @@ -135,6 +137,10 @@ abstract class _SettingsStoreBase with Store { @observable var emoteAutocomplete = defaultEmoteAutocomplete; + @JsonKey(defaultValue: defaultLandscapeChatWidth) + @observable + var landscapeChatWidth = defaultLandscapeChatWidth; + // * Other settings static const defaultSendCrashLogs = true; @@ -182,6 +188,7 @@ abstract class _SettingsStoreBase with Store { badgeScale = defaultBadgeScale; emoteScale = defaultEmoteScale; emoteAutocomplete = defaultEmoteAutocomplete; + landscapeChatWidth = defaultLandscapeChatWidth; // * Other settings sendCrashLogs = defaultSendCrashLogs; diff --git a/lib/screens/settings/stores/settings_store.g.dart b/lib/screens/settings/stores/settings_store.g.dart index 74d81b66..e825c985 100644 --- a/lib/screens/settings/stores/settings_store.g.dart +++ b/lib/screens/settings/stores/settings_store.g.dart @@ -34,6 +34,8 @@ SettingsStore _$SettingsStoreFromJson(Map json) => ..badgeScale = (json['badgeScale'] as num?)?.toDouble() ?? 1.0 ..emoteScale = (json['emoteScale'] as num?)?.toDouble() ?? 1.0 ..emoteAutocomplete = json['emoteAutocomplete'] as bool? ?? true + ..landscapeChatWidth = + (json['landscapeChatWidth'] as num?)?.toDouble() ?? 0.35 ..sendCrashLogs = json['sendCrashLogs'] as bool? ?? true ..fullScreen = json['fullScreen'] as bool? ?? false ..expandInfo = json['expandInfo'] as bool? ?? true; @@ -60,6 +62,7 @@ Map _$SettingsStoreToJson(SettingsStore instance) => 'badgeScale': instance.badgeScale, 'emoteScale': instance.emoteScale, 'emoteAutocomplete': instance.emoteAutocomplete, + 'landscapeChatWidth': instance.landscapeChatWidth, 'sendCrashLogs': instance.sendCrashLogs, 'fullScreen': instance.fullScreen, 'expandInfo': instance.expandInfo, @@ -406,6 +409,22 @@ mixin _$SettingsStore on _SettingsStoreBase, Store { }); } + late final _$landscapeChatWidthAtom = + Atom(name: '_SettingsStoreBase.landscapeChatWidth', context: context); + + @override + double get landscapeChatWidth { + _$landscapeChatWidthAtom.reportRead(); + return super.landscapeChatWidth; + } + + @override + set landscapeChatWidth(double value) { + _$landscapeChatWidthAtom.reportWrite(value, super.landscapeChatWidth, () { + super.landscapeChatWidth = value; + }); + } + late final _$sendCrashLogsAtom = Atom(name: '_SettingsStoreBase.sendCrashLogs', context: context); @@ -491,6 +510,7 @@ messageScale: ${messageScale}, badgeScale: ${badgeScale}, emoteScale: ${emoteScale}, emoteAutocomplete: ${emoteAutocomplete}, +landscapeChatWidth: ${landscapeChatWidth}, sendCrashLogs: ${sendCrashLogs}, fullScreen: ${fullScreen}, expandInfo: ${expandInfo} From 4517b04038459f6bb9eac37d2ab6cef0611b2a56 Mon Sep 17 00:00:00 2001 From: tommyxchow Date: Tue, 24 May 2022 00:21:01 -0400 Subject: [PATCH 2/4] Add ability to overlay chat in fullscreen (#116) --- lib/screens/channel/chat/chat.dart | 2 +- .../channel/chat/widgets/chat_bottom_bar.dart | 1 + lib/screens/channel/stores/video_store.dart | 4 + lib/screens/channel/video/video_overlay.dart | 7 ++ lib/screens/channel/video_chat.dart | 84 ++++++++++--------- .../settings/stores/settings_store.dart | 6 ++ .../settings/stores/settings_store.g.dart | 24 +++++- 7 files changed, 87 insertions(+), 41 deletions(-) diff --git a/lib/screens/channel/chat/chat.dart b/lib/screens/channel/chat/chat.dart index b8f7765e..4af73766 100644 --- a/lib/screens/channel/chat/chat.dart +++ b/lib/screens/channel/chat/chat.dart @@ -108,7 +108,7 @@ class Chat extends StatelessWidget { ), ), ), - if (chatStore.settings.showBottomBar) ChatBottomBar(chatStore: chatStore), + if (chatStore.settings.showBottomBar && !chatStore.settings.fullScreen) ChatBottomBar(chatStore: chatStore), if (chatStore.assetsStore.showEmoteMenu) SizedBox( height: MediaQuery.of(context).size.height / 3, diff --git a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart index a0cc8332..7b8235b1 100644 --- a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart +++ b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart @@ -77,6 +77,7 @@ class ChatBottomBar extends StatelessWidget { chatStore.settings.landscapeChatWidth < 0.3 && MediaQuery.of(context).orientation == Orientation.landscape) IconButton( + tooltip: 'Send a Message', onPressed: () { chatStore.expandChat = true; chatStore.textFieldFocusNode.requestFocus(); diff --git a/lib/screens/channel/stores/video_store.dart b/lib/screens/channel/stores/video_store.dart index f33b38da..15731507 100644 --- a/lib/screens/channel/stores/video_store.dart +++ b/lib/screens/channel/stores/video_store.dart @@ -105,6 +105,10 @@ abstract class VideoStoreBase with Store { _streamInfo = await twitchApi.getStream(userLogin: userLogin, headers: authStore.headersTwitch); } catch (e) { debugPrint(e.toString()); + + _streamInfo = null; + _overlayTimer.cancel(); + _overlayVisible = true; } } diff --git a/lib/screens/channel/video/video_overlay.dart b/lib/screens/channel/video/video_overlay.dart index 4249d176..79d9306e 100644 --- a/lib/screens/channel/video/video_overlay.dart +++ b/lib/screens/channel/video/video_overlay.dart @@ -117,6 +117,11 @@ class VideoOverlay extends StatelessWidget { ), ); + final chatOverlayButton = IconButton( + tooltip: 'Toggle Chat Overlay', + onPressed: () => videoStore.settingsStore.fullScreenChatOverlay = !videoStore.settingsStore.fullScreenChatOverlay, + icon: const Icon(Icons.chat_bubble_outline)); + final refreshButton = IconButton( tooltip: 'Refresh', icon: const Icon( @@ -167,6 +172,7 @@ class VideoOverlay extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ + if (videoStore.settingsStore.fullScreen) chatOverlayButton, refreshButton, if (orientation == Orientation.landscape) fullScreenButton, ], @@ -292,6 +298,7 @@ class VideoOverlay extends StatelessWidget { ), ), ), + if (videoStore.settingsStore.fullScreen) chatOverlayButton, refreshButton, if (Platform.isIOS && videoStore.settingsStore.pictureInPicture) IconButton( diff --git a/lib/screens/channel/video_chat.dart b/lib/screens/channel/video_chat.dart index e87ffd63..8a03ab5c 100644 --- a/lib/screens/channel/video_chat.dart +++ b/lib/screens/channel/video_chat.dart @@ -154,44 +154,52 @@ class _VideoChatState extends State { SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); return Observer( - builder: (context) => ColoredBox( - color: settingsStore.showVideo ? Colors.black : Theme.of(context).scaffoldBackgroundColor, - child: SafeArea( - bottom: false, - child: settingsStore.showVideo - ? settingsStore.fullScreen - ? Stack( - children: [ - Visibility( - visible: false, - maintainState: true, - child: chat, - ), - video, - ], - ) - : Row( - children: [ - Expanded(child: video), - AnimatedContainer( - duration: const Duration(milliseconds: 200), - width: _chatStore.expandChat - ? MediaQuery.of(context).size.width / 2 - : MediaQuery.of(context).size.width * _chatStore.settings.landscapeChatWidth, - curve: Curves.ease, - color: Theme.of(context).scaffoldBackgroundColor, - child: chat, - ), - ], - ) - : Column( - children: [ - appBar, - Expanded(child: chat), - ], - ), - ), - ), + builder: (context) { + final landscapeChat = AnimatedContainer( + duration: const Duration(milliseconds: 200), + width: _chatStore.expandChat + ? MediaQuery.of(context).size.width / 2 + : MediaQuery.of(context).size.width * _chatStore.settings.landscapeChatWidth, + curve: Curves.ease, + color: _chatStore.settings.fullScreen ? null : Theme.of(context).scaffoldBackgroundColor, + child: chat, + ); + + return ColoredBox( + color: settingsStore.showVideo ? Colors.black : Theme.of(context).scaffoldBackgroundColor, + child: SafeArea( + bottom: false, + child: settingsStore.showVideo + ? settingsStore.fullScreen + ? Stack( + alignment: Alignment.topRight, + children: [ + video, + IgnorePointer( + ignoring: _videoStore.overlayVisible, + child: Visibility( + visible: settingsStore.fullScreenChatOverlay, + maintainState: true, + child: landscapeChat, + ), + ), + ], + ) + : Row( + children: [ + Expanded(child: video), + landscapeChat, + ], + ) + : Column( + children: [ + appBar, + Expanded(child: chat), + ], + ), + ), + ); + }, ); } diff --git a/lib/screens/settings/stores/settings_store.dart b/lib/screens/settings/stores/settings_store.dart index 49f912b4..4bfdcdbc 100644 --- a/lib/screens/settings/stores/settings_store.dart +++ b/lib/screens/settings/stores/settings_store.dart @@ -153,6 +153,8 @@ abstract class _SettingsStoreBase with Store { static const defaultExpandInfo = true; + static const defaultFullScreenChatOverlay = false; + @JsonKey(defaultValue: defaultFullScreen) @observable var fullScreen = defaultFullScreen; @@ -161,6 +163,10 @@ abstract class _SettingsStoreBase with Store { @observable var expandInfo = defaultExpandInfo; + @JsonKey(defaultValue: defaultFullScreenChatOverlay) + @observable + var fullScreenChatOverlay = defaultFullScreenChatOverlay; + @action void reset() { // * General Settings diff --git a/lib/screens/settings/stores/settings_store.g.dart b/lib/screens/settings/stores/settings_store.g.dart index e825c985..15f778ec 100644 --- a/lib/screens/settings/stores/settings_store.g.dart +++ b/lib/screens/settings/stores/settings_store.g.dart @@ -38,7 +38,8 @@ SettingsStore _$SettingsStoreFromJson(Map json) => (json['landscapeChatWidth'] as num?)?.toDouble() ?? 0.35 ..sendCrashLogs = json['sendCrashLogs'] as bool? ?? true ..fullScreen = json['fullScreen'] as bool? ?? false - ..expandInfo = json['expandInfo'] as bool? ?? true; + ..expandInfo = json['expandInfo'] as bool? ?? true + ..fullScreenChatOverlay = json['fullScreenChatOverlay'] as bool? ?? false; Map _$SettingsStoreToJson(SettingsStore instance) => { @@ -66,6 +67,7 @@ Map _$SettingsStoreToJson(SettingsStore instance) => 'sendCrashLogs': instance.sendCrashLogs, 'fullScreen': instance.fullScreen, 'expandInfo': instance.expandInfo, + 'fullScreenChatOverlay': instance.fullScreenChatOverlay, }; const _$ThemeTypeEnumMap = { @@ -473,6 +475,23 @@ mixin _$SettingsStore on _SettingsStoreBase, Store { }); } + late final _$fullScreenChatOverlayAtom = + Atom(name: '_SettingsStoreBase.fullScreenChatOverlay', context: context); + + @override + bool get fullScreenChatOverlay { + _$fullScreenChatOverlayAtom.reportRead(); + return super.fullScreenChatOverlay; + } + + @override + set fullScreenChatOverlay(bool value) { + _$fullScreenChatOverlayAtom.reportWrite(value, super.fullScreenChatOverlay, + () { + super.fullScreenChatOverlay = value; + }); + } + late final _$_SettingsStoreBaseActionController = ActionController(name: '_SettingsStoreBase', context: context); @@ -513,7 +532,8 @@ emoteAutocomplete: ${emoteAutocomplete}, landscapeChatWidth: ${landscapeChatWidth}, sendCrashLogs: ${sendCrashLogs}, fullScreen: ${fullScreen}, -expandInfo: ${expandInfo} +expandInfo: ${expandInfo}, +fullScreenChatOverlay: ${fullScreenChatOverlay} '''; } } From 2755e32c29cac941f782621a2dbe30f2d4d52919 Mon Sep 17 00:00:00 2001 From: tommyxchow Date: Tue, 24 May 2022 00:43:16 -0400 Subject: [PATCH 3/4] Added option for landscape chat on left (#116) --- lib/screens/channel/video/video_overlay.dart | 2 +- lib/screens/channel/video_chat.dart | 15 +++++++++----- .../settings/sections/chat_settings.dart | 5 +++++ .../settings/stores/settings_store.dart | 7 +++++++ .../settings/stores/settings_store.g.dart | 20 +++++++++++++++++++ 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/lib/screens/channel/video/video_overlay.dart b/lib/screens/channel/video/video_overlay.dart index 79d9306e..8ed2d0c9 100644 --- a/lib/screens/channel/video/video_overlay.dart +++ b/lib/screens/channel/video/video_overlay.dart @@ -172,7 +172,7 @@ class VideoOverlay extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - if (videoStore.settingsStore.fullScreen) chatOverlayButton, + if (videoStore.settingsStore.fullScreen && orientation == Orientation.landscape) chatOverlayButton, refreshButton, if (orientation == Orientation.landscape) fullScreenButton, ], diff --git a/lib/screens/channel/video_chat.dart b/lib/screens/channel/video_chat.dart index 8a03ab5c..2d97b444 100644 --- a/lib/screens/channel/video_chat.dart +++ b/lib/screens/channel/video_chat.dart @@ -172,7 +172,7 @@ class _VideoChatState extends State { child: settingsStore.showVideo ? settingsStore.fullScreen ? Stack( - alignment: Alignment.topRight, + alignment: settingsStore.landscapeChatLeftSide ? Alignment.topLeft : Alignment.topRight, children: [ video, IgnorePointer( @@ -186,10 +186,15 @@ class _VideoChatState extends State { ], ) : Row( - children: [ - Expanded(child: video), - landscapeChat, - ], + children: settingsStore.landscapeChatLeftSide + ? [ + landscapeChat, + Expanded(child: video), + ] + : [ + Expanded(child: video), + landscapeChat, + ], ) : Column( children: [ diff --git a/lib/screens/settings/sections/chat_settings.dart b/lib/screens/settings/sections/chat_settings.dart index e74f025e..81478c1a 100644 --- a/lib/screens/settings/sections/chat_settings.dart +++ b/lib/screens/settings/sections/chat_settings.dart @@ -90,6 +90,11 @@ class _ChatSettingsState extends State { .toList(), ), ), + SwitchListTile.adaptive( + title: const Text('Landscape Chat on Left Side'), + value: settingsStore.landscapeChatLeftSide, + onChanged: (newValue) => settingsStore.landscapeChatLeftSide = newValue, + ), ListTile( title: Row( children: [ diff --git a/lib/screens/settings/stores/settings_store.dart b/lib/screens/settings/stores/settings_store.dart index 4bfdcdbc..f81832e4 100644 --- a/lib/screens/settings/stores/settings_store.dart +++ b/lib/screens/settings/stores/settings_store.dart @@ -89,6 +89,8 @@ abstract class _SettingsStoreBase with Store { static const defaultLandscapeChatWidth = 0.35; + static const defaultLandscapeChatLeftSide = false; + @JsonKey(defaultValue: defaultShowBottomBar) @observable var showBottomBar = defaultShowBottomBar; @@ -141,6 +143,10 @@ abstract class _SettingsStoreBase with Store { @observable var landscapeChatWidth = defaultLandscapeChatWidth; + @JsonKey(defaultValue: defaultLandscapeChatLeftSide) + @observable + var landscapeChatLeftSide = defaultLandscapeChatLeftSide; + // * Other settings static const defaultSendCrashLogs = true; @@ -195,6 +201,7 @@ abstract class _SettingsStoreBase with Store { emoteScale = defaultEmoteScale; emoteAutocomplete = defaultEmoteAutocomplete; landscapeChatWidth = defaultLandscapeChatWidth; + landscapeChatLeftSide = false; // * Other settings sendCrashLogs = defaultSendCrashLogs; diff --git a/lib/screens/settings/stores/settings_store.g.dart b/lib/screens/settings/stores/settings_store.g.dart index 15f778ec..1e7f78ef 100644 --- a/lib/screens/settings/stores/settings_store.g.dart +++ b/lib/screens/settings/stores/settings_store.g.dart @@ -36,6 +36,7 @@ SettingsStore _$SettingsStoreFromJson(Map json) => ..emoteAutocomplete = json['emoteAutocomplete'] as bool? ?? true ..landscapeChatWidth = (json['landscapeChatWidth'] as num?)?.toDouble() ?? 0.35 + ..landscapeChatLeftSide = json['landscapeChatLeftSide'] as bool? ?? false ..sendCrashLogs = json['sendCrashLogs'] as bool? ?? true ..fullScreen = json['fullScreen'] as bool? ?? false ..expandInfo = json['expandInfo'] as bool? ?? true @@ -64,6 +65,7 @@ Map _$SettingsStoreToJson(SettingsStore instance) => 'emoteScale': instance.emoteScale, 'emoteAutocomplete': instance.emoteAutocomplete, 'landscapeChatWidth': instance.landscapeChatWidth, + 'landscapeChatLeftSide': instance.landscapeChatLeftSide, 'sendCrashLogs': instance.sendCrashLogs, 'fullScreen': instance.fullScreen, 'expandInfo': instance.expandInfo, @@ -427,6 +429,23 @@ mixin _$SettingsStore on _SettingsStoreBase, Store { }); } + late final _$landscapeChatLeftSideAtom = + Atom(name: '_SettingsStoreBase.landscapeChatLeftSide', context: context); + + @override + bool get landscapeChatLeftSide { + _$landscapeChatLeftSideAtom.reportRead(); + return super.landscapeChatLeftSide; + } + + @override + set landscapeChatLeftSide(bool value) { + _$landscapeChatLeftSideAtom.reportWrite(value, super.landscapeChatLeftSide, + () { + super.landscapeChatLeftSide = value; + }); + } + late final _$sendCrashLogsAtom = Atom(name: '_SettingsStoreBase.sendCrashLogs', context: context); @@ -530,6 +549,7 @@ badgeScale: ${badgeScale}, emoteScale: ${emoteScale}, emoteAutocomplete: ${emoteAutocomplete}, landscapeChatWidth: ${landscapeChatWidth}, +landscapeChatLeftSide: ${landscapeChatLeftSide}, sendCrashLogs: ${sendCrashLogs}, fullScreen: ${fullScreen}, expandInfo: ${expandInfo}, From effabf53b91113cf1dc495ca5d1f3a39970d030d Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Tue, 24 May 2022 01:02:33 -0400 Subject: [PATCH 4/4] Fix chat overlay text color on light mode (#116) --- lib/screens/channel/video/video_overlay.dart | 8 +++++--- lib/screens/channel/video_chat.dart | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/screens/channel/video/video_overlay.dart b/lib/screens/channel/video/video_overlay.dart index 8ed2d0c9..e5562de8 100644 --- a/lib/screens/channel/video/video_overlay.dart +++ b/lib/screens/channel/video/video_overlay.dart @@ -118,9 +118,11 @@ class VideoOverlay extends StatelessWidget { ); final chatOverlayButton = IconButton( - tooltip: 'Toggle Chat Overlay', - onPressed: () => videoStore.settingsStore.fullScreenChatOverlay = !videoStore.settingsStore.fullScreenChatOverlay, - icon: const Icon(Icons.chat_bubble_outline)); + tooltip: 'Toggle Chat Overlay', + onPressed: () => videoStore.settingsStore.fullScreenChatOverlay = !videoStore.settingsStore.fullScreenChatOverlay, + icon: const Icon(Icons.chat_bubble_outline), + color: Colors.white, + ); final refreshButton = IconButton( tooltip: 'Refresh', diff --git a/lib/screens/channel/video_chat.dart b/lib/screens/channel/video_chat.dart index 2d97b444..b0c88e8a 100644 --- a/lib/screens/channel/video_chat.dart +++ b/lib/screens/channel/video_chat.dart @@ -180,7 +180,10 @@ class _VideoChatState extends State { child: Visibility( visible: settingsStore.fullScreenChatOverlay, maintainState: true, - child: landscapeChat, + child: DefaultTextStyle( + style: const TextStyle(color: Colors.white), + child: landscapeChat, + ), ), ), ],