FilledStacks / responsive_builder

A set of widgets to make responsive UI building in flutter more readable
MIT License
504 stars 81 forks source link

Added Desktop platform checks. #37

Closed disparta closed 1 year ago

disparta commented 2 years ago

Fixes #31

36 requires the developer to parse a variable to the ResponsiveBuilder.

On Desktop (Windows and macOS - I did not test Linux), the tablet builder would be used even when in full-screen mode. This however did not happen in Web.

I added the following because I did not want to depend on universal_io. This uses dart:io (which is not supported on the web). It is only called when the app is compiled for desktop, mobile, and not web.

if (kIsWeb) { deviceWidth = size.width; } else { //Check if the device is a desktop, should not be web if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) { deviceWidth = size.width; } }

disparta commented 1 year ago

It works. I've been using it in production on Web and haven't seen an issue.