diff --git a/lib/screens/channel/channel.dart b/lib/screens/channel/channel.dart index 4a9a8f97..1ab7360f 100644 --- a/lib/screens/channel/channel.dart +++ b/lib/screens/channel/channel.dart @@ -548,7 +548,10 @@ class _VideoChatState extends State context, ); - // Determine which side to fill based on setting + // Determine which edges to fill based on orientation + // Auto mode fills the physical bottom (opposite of notch): + // landscapeLeft = notch on left -> fill right + // landscapeRight = notch on right -> fill left final bool fillLeft; final bool fillRight; @@ -556,15 +559,19 @@ class _VideoChatState extends State fillLeft = true; fillRight = true; } else { - // Auto mode: fill the physical bottom side (opposite of notch) - // landscapeLeft = notch on left → fill right - // landscapeRight = notch on right → fill left - fillLeft = - orientation == - NativeDeviceOrientation.landscapeRight; - fillRight = - orientation == - NativeDeviceOrientation.landscapeLeft; + switch (orientation) { + case NativeDeviceOrientation + .landscapeRight: + fillLeft = true; + fillRight = false; + case NativeDeviceOrientation + .landscapeLeft: + fillLeft = false; + fillRight = true; + default: + fillLeft = false; + fillRight = false; + } } return SafeArea( @@ -572,99 +579,106 @@ class _VideoChatState extends State left: !fillLeft, right: !fillRight, child: LayoutBuilder( - builder: (context, constraints) { - final availableWidth = constraints.maxWidth; - final chatWidth = _chatStore.expandChat - ? 0.5 - : settingsStore.chatWidth; + builder: (context, constraints) { + final availableWidth = + constraints.maxWidth; + final chatWidth = _chatStore.expandChat + ? 0.5 + : settingsStore.chatWidth; - // Create the landscape chat container with proper styling - final chatContainer = AnimatedContainer( - curve: Curves.ease, - duration: _isDividerDragging - ? Duration.zero - : const Duration(milliseconds: 200), - width: availableWidth * chatWidth, - color: settingsStore.fullScreen - ? Colors.black.withValues( - alpha: settingsStore - .fullScreenChatOverlayOpacity, - ) - : context.scaffoldColor, - child: chat, - ); + // Create the landscape chat container with proper styling + final chatContainer = AnimatedContainer( + curve: Curves.ease, + duration: _isDividerDragging + ? Duration.zero + : const Duration( + milliseconds: 200, + ), + width: availableWidth * chatWidth, + color: settingsStore.fullScreen + ? Colors.black.withValues( + alpha: settingsStore + .fullScreenChatOverlayOpacity, + ) + : context.scaffoldColor, + child: chat, + ); - final draggableDivider = Observer( - builder: (_) => DraggableDivider( - currentWidth: chatWidth, - maxWidth: 0.6, - isResizableOnLeft: - settingsStore.landscapeChatLeftSide, - showHandle: _videoStore.overlayVisible, - onDragStart: () { - setState(() { - _isDividerDragging = true; - }); - }, - onDrag: (newWidth) { - if (!_chatStore.expandChat) { - settingsStore.chatWidth = newWidth; - } - }, - onDragEnd: () { - setState(() { - _isDividerDragging = false; - }); - }, - ), - ); + final draggableDivider = Observer( + builder: (_) => DraggableDivider( + currentWidth: chatWidth, + maxWidth: 0.6, + isResizableOnLeft: settingsStore + .landscapeChatLeftSide, + showHandle: + _videoStore.overlayVisible, + onDragStart: () { + setState(() { + _isDividerDragging = true; + }); + }, + onDrag: (newWidth) { + if (!_chatStore.expandChat) { + settingsStore.chatWidth = + newWidth; + } + }, + onDragEnd: () { + setState(() { + _isDividerDragging = false; + }); + }, + ), + ); - return Stack( - children: [ - Row( - children: - settingsStore - .landscapeChatLeftSide - ? [ - chatContainer, - Expanded( - child: - _buildPipGestureWrapper( - child: video, - ), - ), - ] - : [ - Expanded( - child: - _buildPipGestureWrapper( - child: video, - ), - ), - chatContainer, - ], - ), - Positioned( - top: 0, - bottom: 0, - left: - settingsStore - .landscapeChatLeftSide - ? (availableWidth * chatWidth) - - 12 - : null, - right: - !settingsStore - .landscapeChatLeftSide - ? (availableWidth * chatWidth) - - 12 - : null, - child: draggableDivider, - ), - ], - ); - }, - ), + return Stack( + children: [ + Row( + children: + settingsStore + .landscapeChatLeftSide + ? [ + chatContainer, + Expanded( + child: + _buildPipGestureWrapper( + child: video, + ), + ), + ] + : [ + Expanded( + child: + _buildPipGestureWrapper( + child: video, + ), + ), + chatContainer, + ], + ), + Positioned( + top: 0, + bottom: 0, + left: + settingsStore + .landscapeChatLeftSide + ? (availableWidth * + chatWidth) - + 12 + : null, + right: + !settingsStore + .landscapeChatLeftSide + ? (availableWidth * + chatWidth) - + 12 + : null, + child: draggableDivider, + ), + ], + ); + }, + ), ); }, )