简体   繁体   中英

Handling overflow in Flutter web

In Flutter web, there are limitless possibilities of what sizes may be forced upon the app by resizing the browser. For example, my sign in with Apple and sign in with Google buttons from the flutter_signin_button package overflow when the browser is shrunk too small:

在此处输入图像描述

In a case where the window is shrunk unreasonably small, is there a way that I can suppress the overflow message? Or is there a release version of Flutter web that will not have these?

Wrap your widget into the scroll view. This is the easiest way to resolve the issue. Provide the fixed constraints for the both button and wrap into the scrollview with Horizontal scroll direction. If the screen size comes under the constraints, it will be the scrollable.

Use MediaQuery.

For width - MediaQuery.of(context).size.width; For height - MediaQuery.of(context).size.height;

For size - MediaQuery.of(context).size

if(MediaQuery.of(context).size.width < 200px)
{
   return someWidget
}

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