revert auto-fill safe area

This commit is contained in:
Tommy Chow 2026-01-09 01:04:09 -05:00
parent 5963a0ab3c
commit f383c447f5
4 changed files with 105 additions and 111 deletions

View file

@ -10,12 +10,12 @@ import 'package:frosty/screens/channel/video/stream_info_bar.dart';
import 'package:frosty/screens/channel/video/video.dart'; import 'package:frosty/screens/channel/video/video.dart';
import 'package:frosty/screens/channel/video/video_overlay.dart'; import 'package:frosty/screens/channel/video/video_overlay.dart';
import 'package:frosty/screens/channel/video/video_store.dart'; import 'package:frosty/screens/channel/video/video_store.dart';
import 'package:frosty/screens/settings/stores/settings_store.dart';
import 'package:frosty/theme.dart'; import 'package:frosty/theme.dart';
import 'package:frosty/utils/context_extensions.dart'; import 'package:frosty/utils/context_extensions.dart';
import 'package:frosty/widgets/blurred_container.dart'; import 'package:frosty/widgets/blurred_container.dart';
import 'package:frosty/widgets/draggable_divider.dart'; import 'package:frosty/widgets/draggable_divider.dart';
import 'package:frosty/widgets/frosty_notification.dart'; import 'package:frosty/widgets/frosty_notification.dart';
import 'package:native_device_orientation/native_device_orientation.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:simple_pip_mode/actions/pip_actions_layout.dart'; import 'package:simple_pip_mode/actions/pip_actions_layout.dart';
import 'package:simple_pip_mode/pip_widget.dart'; import 'package:simple_pip_mode/pip_widget.dart';
@ -536,37 +536,17 @@ class _VideoChatState extends State<VideoChat>
), ),
], ],
) )
: NativeDeviceOrientationReader( : SafeArea(
builder: (context) { bottom: false,
final orientation = left: settingsStore.landscapeCutout !=
NativeDeviceOrientationReader.orientation( LandscapeCutoutType.left &&
context, settingsStore.landscapeCutout !=
); LandscapeCutoutType.both,
right: settingsStore.landscapeCutout !=
// Determine which edges to fill based on orientation LandscapeCutoutType.right &&
// Auto mode fills the physical bottom (opposite of notch): settingsStore.landscapeCutout !=
// landscapeLeft = notch on left -> fill right LandscapeCutoutType.both,
// landscapeRight = notch on right -> fill left child: LayoutBuilder(
final bool fillLeft;
final bool fillRight;
if (settingsStore.landscapeFillAllEdges) {
fillLeft = true;
fillRight = true;
} else {
fillLeft =
orientation ==
NativeDeviceOrientation.landscapeRight;
fillRight =
orientation ==
NativeDeviceOrientation.landscapeLeft;
}
return SafeArea(
bottom: false,
left: !fillLeft,
right: !fillRight,
child: LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
final availableWidth = final availableWidth =
constraints.maxWidth; constraints.maxWidth;
@ -667,9 +647,7 @@ class _VideoChatState extends State<VideoChat>
); );
}, },
), ),
); )
},
)
: SafeArea(child: chat), : SafeArea(child: chat),
); );
} }

View file

@ -232,14 +232,17 @@ class _ChatSettingsState extends State<ChatSettings> {
onChanged: (newValue) => onChanged: (newValue) =>
settingsStore.landscapeForceVerticalChat = newValue, settingsStore.landscapeForceVerticalChat = newValue,
), ),
SettingsListSwitch( SettingsListSelect(
title: 'Fill all edges', title: 'Fill notch side',
subtitle: const Text( subtitle:
'Fills both edges instead of just the bottom edge.', 'Overrides and fills the available space in devices with a display notch.',
), selectedOption:
value: settingsStore.landscapeFillAllEdges, landscapeCutoutNames[settingsStore.landscapeCutout.index],
onChanged: (newValue) => options: landscapeCutoutNames,
settingsStore.landscapeFillAllEdges = newValue, onChanged: (newValue) => settingsStore.landscapeCutout =
LandscapeCutoutType.values[landscapeCutoutNames.indexOf(
newValue,
)],
), ),
SettingsListSlider( SettingsListSlider(
title: 'Chat overlay opacity', title: 'Chat overlay opacity',

View file

@ -135,7 +135,7 @@ abstract class _SettingsStoreBase with Store {
// Landscape mode defaults // Landscape mode defaults
static const defaultLandscapeChatLeftSide = false; static const defaultLandscapeChatLeftSide = false;
static const defaultLandscapeForceVerticalChat = false; static const defaultLandscapeForceVerticalChat = false;
static const defaultLandscapeFillAllEdges = false; static const defaultLandscapeCutout = LandscapeCutoutType.none;
static const defaultChatWidth = 0.2; static const defaultChatWidth = 0.2;
static const defaultFullScreenChatOverlayOpacity = 0.5; static const defaultFullScreenChatOverlayOpacity = 0.5;
@ -231,9 +231,9 @@ abstract class _SettingsStoreBase with Store {
@observable @observable
var landscapeForceVerticalChat = defaultLandscapeForceVerticalChat; var landscapeForceVerticalChat = defaultLandscapeForceVerticalChat;
@JsonKey(defaultValue: defaultLandscapeFillAllEdges) @JsonKey(defaultValue: defaultLandscapeCutout)
@observable @observable
var landscapeFillAllEdges = defaultLandscapeFillAllEdges; var landscapeCutout = defaultLandscapeCutout;
@JsonKey(defaultValue: defaultChatWidth) @JsonKey(defaultValue: defaultChatWidth)
@observable @observable
@ -321,7 +321,7 @@ abstract class _SettingsStoreBase with Store {
landscapeChatLeftSide = defaultLandscapeChatLeftSide; landscapeChatLeftSide = defaultLandscapeChatLeftSide;
landscapeForceVerticalChat = defaultLandscapeForceVerticalChat; landscapeForceVerticalChat = defaultLandscapeForceVerticalChat;
landscapeFillAllEdges = defaultLandscapeFillAllEdges; landscapeCutout = defaultLandscapeCutout;
chatWidth = defaultChatWidth; chatWidth = defaultChatWidth;
fullScreenChatOverlayOpacity = defaultFullScreenChatOverlayOpacity; fullScreenChatOverlayOpacity = defaultFullScreenChatOverlayOpacity;
@ -398,3 +398,7 @@ const timestampNames = ['Disabled', '12-hour', '24-hour'];
enum TimestampType { disabled, twelve, twentyFour } enum TimestampType { disabled, twelve, twentyFour }
const landscapeCutoutNames = ['None', 'Left', 'Right', 'Both'];
enum LandscapeCutoutType { none, left, right, both }

View file

@ -49,7 +49,12 @@ SettingsStore _$SettingsStoreFromJson(
..landscapeChatLeftSide = json['landscapeChatLeftSide'] as bool? ?? false ..landscapeChatLeftSide = json['landscapeChatLeftSide'] as bool? ?? false
..landscapeForceVerticalChat = ..landscapeForceVerticalChat =
json['landscapeForceVerticalChat'] as bool? ?? false json['landscapeForceVerticalChat'] as bool? ?? false
..landscapeFillAllEdges = json['landscapeFillAllEdges'] as bool? ?? false ..landscapeCutout =
$enumDecodeNullable(
_$LandscapeCutoutTypeEnumMap,
json['landscapeCutout'],
) ??
LandscapeCutoutType.none
..chatWidth = (json['chatWidth'] as num?)?.toDouble() ?? 0.2 ..chatWidth = (json['chatWidth'] as num?)?.toDouble() ?? 0.2
..fullScreenChatOverlayOpacity = ..fullScreenChatOverlayOpacity =
(json['fullScreenChatOverlayOpacity'] as num?)?.toDouble() ?? 0.5 (json['fullScreenChatOverlayOpacity'] as num?)?.toDouble() ?? 0.5
@ -84,55 +89,56 @@ SettingsStore _$SettingsStoreFromJson(
.toList() ?? .toList() ??
[]; [];
Map<String, dynamic> _$SettingsStoreToJson(SettingsStore instance) => Map<String, dynamic> _$SettingsStoreToJson(
<String, dynamic>{ SettingsStore instance,
'themeType': _$ThemeTypeEnumMap[instance.themeType]!, ) => <String, dynamic>{
'accentColor': instance.accentColor, 'themeType': _$ThemeTypeEnumMap[instance.themeType]!,
'showThumbnails': instance.showThumbnails, 'accentColor': instance.accentColor,
'largeStreamCard': instance.largeStreamCard, 'showThumbnails': instance.showThumbnails,
'launchUrlExternal': instance.launchUrlExternal, 'largeStreamCard': instance.largeStreamCard,
'showVideo': instance.showVideo, 'launchUrlExternal': instance.launchUrlExternal,
'defaultToHighestQuality': instance.defaultToHighestQuality, 'showVideo': instance.showVideo,
'useTextureRendering': instance.useTextureRendering, 'defaultToHighestQuality': instance.defaultToHighestQuality,
'showOverlay': instance.showOverlay, 'useTextureRendering': instance.useTextureRendering,
'toggleableOverlay': instance.toggleableOverlay, 'showOverlay': instance.showOverlay,
'showLatency': instance.showLatency, 'toggleableOverlay': instance.toggleableOverlay,
'badgeScale': instance.badgeScale, 'showLatency': instance.showLatency,
'emoteScale': instance.emoteScale, 'badgeScale': instance.badgeScale,
'messageScale': instance.messageScale, 'emoteScale': instance.emoteScale,
'messageSpacing': instance.messageSpacing, 'messageScale': instance.messageScale,
'fontSize': instance.fontSize, 'messageSpacing': instance.messageSpacing,
'showDeletedMessages': instance.showDeletedMessages, 'fontSize': instance.fontSize,
'showChatMessageDividers': instance.showChatMessageDividers, 'showDeletedMessages': instance.showDeletedMessages,
'timestampType': _$TimestampTypeEnumMap[instance.timestampType]!, 'showChatMessageDividers': instance.showChatMessageDividers,
'autoSyncChatDelay': instance.autoSyncChatDelay, 'timestampType': _$TimestampTypeEnumMap[instance.timestampType]!,
'chatDelay': instance.chatDelay, 'autoSyncChatDelay': instance.autoSyncChatDelay,
'highlightFirstTimeChatter': instance.highlightFirstTimeChatter, 'chatDelay': instance.chatDelay,
'showUserNotices': instance.showUserNotices, 'highlightFirstTimeChatter': instance.highlightFirstTimeChatter,
'emoteMenuButtonOnLeft': instance.emoteMenuButtonOnLeft, 'showUserNotices': instance.showUserNotices,
'landscapeChatLeftSide': instance.landscapeChatLeftSide, 'emoteMenuButtonOnLeft': instance.emoteMenuButtonOnLeft,
'landscapeForceVerticalChat': instance.landscapeForceVerticalChat, 'landscapeChatLeftSide': instance.landscapeChatLeftSide,
'landscapeFillAllEdges': instance.landscapeFillAllEdges, 'landscapeForceVerticalChat': instance.landscapeForceVerticalChat,
'chatWidth': instance.chatWidth, 'landscapeCutout': _$LandscapeCutoutTypeEnumMap[instance.landscapeCutout]!,
'fullScreenChatOverlayOpacity': instance.fullScreenChatOverlayOpacity, 'chatWidth': instance.chatWidth,
'autocomplete': instance.autocomplete, 'fullScreenChatOverlayOpacity': instance.fullScreenChatOverlayOpacity,
'showTwitchEmotes': instance.showTwitchEmotes, 'autocomplete': instance.autocomplete,
'showTwitchBadges': instance.showTwitchBadges, 'showTwitchEmotes': instance.showTwitchEmotes,
'show7TVEmotes': instance.show7TVEmotes, 'showTwitchBadges': instance.showTwitchBadges,
'showBTTVEmotes': instance.showBTTVEmotes, 'show7TVEmotes': instance.show7TVEmotes,
'showBTTVBadges': instance.showBTTVBadges, 'showBTTVEmotes': instance.showBTTVEmotes,
'showFFZEmotes': instance.showFFZEmotes, 'showBTTVBadges': instance.showBTTVBadges,
'showFFZBadges': instance.showFFZBadges, 'showFFZEmotes': instance.showFFZEmotes,
'showRecentMessages': instance.showRecentMessages, 'showFFZBadges': instance.showFFZBadges,
'persistChatTabs': instance.persistChatTabs, 'showRecentMessages': instance.showRecentMessages,
'secondaryTabs': instance.secondaryTabs, 'persistChatTabs': instance.persistChatTabs,
'mutedWords': instance.mutedWords, 'secondaryTabs': instance.secondaryTabs,
'matchWholeWord': instance.matchWholeWord, 'mutedWords': instance.mutedWords,
'shareCrashLogsAndAnalytics': instance.shareCrashLogsAndAnalytics, 'matchWholeWord': instance.matchWholeWord,
'fullScreen': instance.fullScreen, 'shareCrashLogsAndAnalytics': instance.shareCrashLogsAndAnalytics,
'fullScreenChatOverlay': instance.fullScreenChatOverlay, 'fullScreen': instance.fullScreen,
'pinnedChannelIds': instance.pinnedChannelIds, 'fullScreenChatOverlay': instance.fullScreenChatOverlay,
}; 'pinnedChannelIds': instance.pinnedChannelIds,
};
const _$ThemeTypeEnumMap = { const _$ThemeTypeEnumMap = {
ThemeType.system: 'system', ThemeType.system: 'system',
@ -146,6 +152,13 @@ const _$TimestampTypeEnumMap = {
TimestampType.twentyFour: 'twentyFour', TimestampType.twentyFour: 'twentyFour',
}; };
const _$LandscapeCutoutTypeEnumMap = {
LandscapeCutoutType.none: 'none',
LandscapeCutoutType.left: 'left',
LandscapeCutoutType.right: 'right',
LandscapeCutoutType.both: 'both',
};
// ************************************************************************** // **************************************************************************
// StoreGenerator // StoreGenerator
// ************************************************************************** // **************************************************************************
@ -645,26 +658,22 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
); );
} }
late final _$landscapeFillAllEdgesAtom = Atom( late final _$landscapeCutoutAtom = Atom(
name: '_SettingsStoreBase.landscapeFillAllEdges', name: '_SettingsStoreBase.landscapeCutout',
context: context, context: context,
); );
@override @override
bool get landscapeFillAllEdges { LandscapeCutoutType get landscapeCutout {
_$landscapeFillAllEdgesAtom.reportRead(); _$landscapeCutoutAtom.reportRead();
return super.landscapeFillAllEdges; return super.landscapeCutout;
} }
@override @override
set landscapeFillAllEdges(bool value) { set landscapeCutout(LandscapeCutoutType value) {
_$landscapeFillAllEdgesAtom.reportWrite( _$landscapeCutoutAtom.reportWrite(value, super.landscapeCutout, () {
value, super.landscapeCutout = value;
super.landscapeFillAllEdges, });
() {
super.landscapeFillAllEdges = value;
},
);
} }
late final _$chatWidthAtom = Atom( late final _$chatWidthAtom = Atom(
@ -1127,7 +1136,7 @@ showUserNotices: ${showUserNotices},
emoteMenuButtonOnLeft: ${emoteMenuButtonOnLeft}, emoteMenuButtonOnLeft: ${emoteMenuButtonOnLeft},
landscapeChatLeftSide: ${landscapeChatLeftSide}, landscapeChatLeftSide: ${landscapeChatLeftSide},
landscapeForceVerticalChat: ${landscapeForceVerticalChat}, landscapeForceVerticalChat: ${landscapeForceVerticalChat},
landscapeFillAllEdges: ${landscapeFillAllEdges}, landscapeCutout: ${landscapeCutout},
chatWidth: ${chatWidth}, chatWidth: ${chatWidth},
fullScreenChatOverlayOpacity: ${fullScreenChatOverlayOpacity}, fullScreenChatOverlayOpacity: ${fullScreenChatOverlayOpacity},
autocomplete: ${autocomplete}, autocomplete: ${autocomplete},