fix safe area filll resetting when moving to portrait
This commit is contained in:
parent
ba7f68af1e
commit
bde322fd09
1 changed files with 114 additions and 100 deletions
|
|
@ -548,7 +548,10 @@ class _VideoChatState extends State<VideoChat>
|
|||
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<VideoChat>
|
|||
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<VideoChat>
|
|||
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,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue