Responsive Design
#1257
-
Hi, I want to design responsive but i dont know how to make it in cogent. I occured with a scenerio like bellow. I show the content of a frame in 4 columns, but this value can be 3 or 5 depending on the size of the window. How can I adjust this? colsNum := 4
grids := core.NewFrame(fr)
grids.Styler(func(s *styles.Style) {
s.Max.X = units.Dp(1000)
s.Min.X = units.Dp(400)
s.Grow.X = 1
s.Display = styles.Grid
s.Columns = colsNum // this line
s.Gap.Set(units.Dp(10))
}) or what is the idiomatic way to do this? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
kkoreilly
Oct 14, 2024
Replies: 1 comment 4 replies
-
Does something like this work for you? grids.Styler(func(s *styles.Style) {
s.Max.X = units.Dp(1000)
s.Min.X = units.Dp(400)
s.Grow.X = 1
s.Display = styles.Grid
if grids.SizeClass() == core.SizeExpanded {
s.Columns = 5
} else {
s.Columns = 3
}
s.Gap.Set(units.Dp(10))
}) |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
ksckaan1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does something like this work for you?