fluttercommunity / chewie

The video player for Flutter with a heart of gold
MIT License
1.93k stars 989 forks source link

Crush when full screen mode with flutter_webview in the same screen. Only iOS #751

Open dfdgsdfg opened 1 year ago

dfdgsdfg commented 1 year ago
Failed to change device orientation: Error Domain=UISceneErrorDomain Code=101 "None of the requested orientations are supported by the view controller. Requested: landscapeLeft, landscapeRight; Supported: portrait" UserInfo={NSLocalizedDescription=None of the requested orientations are supported by the view controller. Requested: landscapeLeft, landscapeRight; Supported: portrait}
[app] πŸ‘»  INFO 2023-07-06 15:42:51.936894 AppNavigationObserver> didPush: route(null: null), previousRoute= route(secret: {id: 14})

════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during layout:
A RenderFlex overflowed by 167 pixels on the bottom.

The relevant error-causing widget was
Column
secret_screen.dart:129
To inspect this widget in Flutter DevTools, visit: http://127.0.0.1:9101/#/inspector?uri=http%3A%2F%2F127.0.0.1%3A52242%2Fkh5nJlrHW-Q%3D%2F&inspectorRef=inspector-0
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.

Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.

The specific RenderFlex in question is: RenderFlex#82c63 relayoutBoundary=up4 OVERFLOWING
════════════════════════════════════════════════════════════════════════════════
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010cde932c Flutter`flutter::IOSExternalViewEmbedder::CompositeEmbeddedView(long long) + 1828
Flutter`flutter::IOSExternalViewEmbedder::CompositeEmbeddedView:
->  0x10cde932c <+1828>: ldr    x8, [x0]
    0x10cde9330 <+1832>: ldr    x8, [x8, #0x30]
    0x10cde9334 <+1836>: blr    x8
    0x10cde9338 <+1840>: cbz    x0, 0x10cde951c           ; <+2324>
Target 0: (Runner) stopped.
Lost connection to device.
Exited
dfdgsdfg commented 1 year ago

Maybe releated

https://github.com/fluttercommunity/chewie/issues/750

dfdgsdfg commented 1 year ago

Workaround.

Wrap your page 'OrientationBuilder' then ignore unnecessary orientation.

class _PageState extends State<Page> {
  bool isFullScreen = false;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        ChewiePlayer(),
        OrientationBuilder(
          builder: (context, snapshot) {
            if (snapshot == Orientation.landscape) {
              isFullScreen = true;
              return Container();
            }

            return isFullScreen
                ? FutureBuilder(
                    future: Future.delayed(const Duration(milliseconds: 300)),
                    builder: (context, snapshot) {
                      if (snapshot.connectionState == ConnectionState.waiting)
                        return Container();
                      isFullScreen = false;
                      return WebViewWidget();
                    })
                : WebViewWidget();
          },
        ),
      ],
    );
  }
}
rubgeax commented 1 year ago

@dfdgsdfg Thank you, the issue persist