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

Allow platform specific layouts #17

Closed
fotiDim opened this issue May 26, 2020 · 4 comments
Closed

Allow platform specific layouts #17

fotiDim opened this issue May 26, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@fotiDim
Copy link

fotiDim commented May 26, 2020

It would be nice to be able to provide a different layout for iOS, Android and web. Something like:

ScreenTypeLayout(
  // Platforms
  ios: Container(color:Colors.white)
  android: Container(color:Colors.black)
  web: Container(color:Colors.green)
  ...
  // Screen types
  mobile: Container(color:Colors.blue)
  tablet: Container(color: Colors.yellow),
  desktop: Container(color: Colors.red),
  watch: Container(color: Colors.purple),
);

There is some overlap with the existing screen types but the platform is another dimension of the layout and you can have any combination of "platform" and "screen type" there. It could even be more fine grained like:

desktopWeb: Container(color:Colors.red),
mobileWeb: Container(color:Colors.blue)
@FilledStacks
Copy link
Owner

I think having a separate builder widget would probably work better. That way you can Have

ScreenTypeLayout.builder(
mobile: (context) => PlatformLayoutBuilder(
   ios: (context) => IosMobileLayout(),
   web: (context) => WebMobileLayout(),
  )
)

Similar to how you can define orientation specific layouts and the ones that don't have it just stays the same. When I get some time I'll add something like that.

@FilledStacks FilledStacks added the enhancement New feature or request label May 27, 2020
@fotiDim
Copy link
Author

fotiDim commented May 29, 2020

@FilledStacks does it makes sense to use this package for the implementation?

@FilledStacks
Copy link
Owner

@fotiDim yes. That would work if you want platform specific design styles for widgets. In the case of for instance Web, Desktop, Mobile or Watch, that won't work. But it can definitely be used as well.

@FilledStacks
Copy link
Owner

We won't be adding this functionality at the moment. We might build a separate package for this if we see this is a required functionality in our client applications.

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