Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass SizingInformation to the ScreenTypeLayout builders #45

Open
BenjiFarquhar opened this issue Aug 6, 2022 · 0 comments
Open

Pass SizingInformation to the ScreenTypeLayout builders #45

BenjiFarquhar opened this issue Aug 6, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@BenjiFarquhar
Copy link

BenjiFarquhar commented Aug 6, 2022

Hi,

I see in the build method of ScreenTypeLayout, that we have access to the SizingInformation but are not passing it to each builder:

  @override
  Widget build(BuildContext context) {
    return ResponsiveBuilder(
      breakpoints: breakpoints,
      builder: (context, sizingInformation) {
        // If we're at desktop size
        if (sizingInformation.deviceScreenType == DeviceScreenType.desktop) {
          // If we have supplied the desktop layout then display that
          if (desktop != null) return desktop!(context);
          // If no desktop layout is supplied we want to check if we have the size below it and display that
          if (tablet != null) return tablet!(context);
        }

        if (sizingInformation.deviceScreenType == DeviceScreenType.tablet) {
          if (tablet != null) return tablet!(context);
        }

        if (sizingInformation.deviceScreenType == DeviceScreenType.watch &&
            watch != null) {
          return watch!(context);
        }

        // If none of the layouts above are supplied or we're on the mobile layout then we show the mobile layout
        return mobile(context);
      },

Please pass it to the passed in builders, as right now we need to add our own ResponsiveBuilder to get the SizingInformation while the build method of ScreenTypeLayout is already doing that.

P.S. You may as well do the same for RefinedLayoutBuilder.

BTW, I've done it in a fork.

@BenjiFarquhar BenjiFarquhar changed the title Pass SizingInformation to the builders to the ScreenTypeLayout builders Pass SizingInformation to the ScreenTypeLayout builders Aug 6, 2022
@Eimen2018 Eimen2018 added the enhancement New feature or request label Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants