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 the ability to define custom screen definitions #4

Closed AzMoza closed 5 years ago

AzMoza commented 5 years ago

Added the ability to define custom screen resolutions via the ScreenTypeLayout widget or the ResponsiveBuilder widget.

When supplying the definitions argument the values of desktop, tablet and watch are all required.

An example implementation with ScreenTypeLayout:

return ScreenTypeLayout(
      definitions: ScreenDefinitions(
        desktop: 950,
        tablet: 600,
        watch: 300
      ),
      mobile: OrientationLayoutBuilder(
        portrait: (context) => HomeMobilePortrait(),
        landscape: (context) => HomeMobileLandscape(),
      ),
      tablet: HomeViewTablet(),
    );

This enables fine tuning of when the UI is updated to match a specific device type. The mobile UI depends on the size value of the tablet and watch.

FilledStacks commented 5 years ago

Yeeaaaah! Thanks dude. Gonna pull now, test and update the example and then push a new update. Thanks for the contribution. It's much appreciated.

AzMoza commented 5 years ago

No problem those changes have been made. I also changed the class name so it didn't get confusing. It's my first time contributing to an open-source repository so no idea on general rules and conventions 😂

FilledStacks commented 5 years ago

Awesome man! @AzMoza Merged, I'll update the version and make a release on pub.dev