JarekToro / responsive-layout

The layout to beat them all!
https://vaadin.com/directory#!addon/responsive-layout
57 stars 24 forks source link

More fluent API for margins #18

Closed bassmartin closed 7 years ago

bassmartin commented 7 years ago

It's great to have the possibility to set margins to be hidden on some screen sizes, but I think the withMargin should be more fluent, like the ResponsiveColumn visibility :

public ResponsiveRow withMargin(MarginSize size, boolean xs, boolean sm, boolean md, boolean lg)

That way you can have something like : row.withMargin(MarginSize.NORMAL, false, false, true, true).withMargin(MarginSize.SMALL, true, true, false, false)

What do you think?

JarekToro commented 7 years ago

Great thinking I love it

JarekToro commented 7 years ago

After some thinking I think going with this may be the best option. row.withMargin(Normal,Small,None,Small)

JarekToro commented 7 years ago

The boolean at the end of the margin calls have been replaced. Use MarginType.None for the margin instead

JarekToro commented 7 years ago
 setMargin(MarginType.Normal, ResponsiveColumn.DisplaySize.XS);
 setMargin(MarginType.Small, ResponsiveColumn.DisplaySize.SM);
 setMargin(MarginType.None, ResponsiveColumn.DisplaySize.MD);