简体   繁体   中英

Flutter RenderFlex overflow crash

Is there a way to prevent RenderFlex overflow, if the canvas becomes too small? This does not only apply to web but all devices.

Say a user resizes a browser window to 0 height, the "app" will crash.

Edit: Looking for a global solution, something like:

runApp(IgnoreRenderFlexOverflowApp(child: SomeWidget));

class IgnoreRenderFlexOverflowApp extends StatelessWidget {
  final Widget child;

  IgnoreRenderFlexOverflowApp({this.child});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Some app title',
      home: LayoutBuilder(
        builder: (BuildContext context, BoxConstraints constraints) {
          return SizedOverflowBox(
            size: Size(constraints.maxWidth, constraints.maxHeight),
            child: child,
          );
        }
      )
    );
  }
}
sinkWrap :true 

Just Add this your problem will be solved by this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM