簡體   English   中英

Flutter RenderFlex 溢出崩潰

[英]Flutter RenderFlex overflow crash

如果 canvas 變得太小,有沒有辦法防止 RenderFlex 溢出? 這不僅適用於 web,而且適用於所有設備。

假設用戶將瀏覽器 window 的大小調整為 0 高度,“應用程序”將崩潰。

編輯:尋找全球解決方案,例如:

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 

只需添加此您的問題將通過此解決

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM