2

I want to build a grid with some images and captions in Flutter Web. I want that in mobile it will show 2 column and in desktop 4. How can I build this.

1 Answer 1

0

Use LayoutBuilder to establish a cut point at your desired width. Inside LayoutBuilder, set the number of columns for the grid with something like:

final columns = constraints.width > 500 ? 4 : 2;

Then build your grid within that. You could even make it a formula, like divide the width by 250 and truncate to an int.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.