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

How to combine Gap with Expanded/Flexible widgets #11

Open
migalv opened this issue Nov 9, 2022 · 0 comments
Open

How to combine Gap with Expanded/Flexible widgets #11

migalv opened this issue Nov 9, 2022 · 0 comments

Comments

@migalv
Copy link

migalv commented Nov 9, 2022

Hello. I'm very familiar with the Expanded/Flexible widgets that help me a lot to position my widgets how I want in the Columns & Rows. But when I use them with Gap it doesn't seem to work as I would expect it.

Sample code

Column(
  children: [
    MaxGap(32),
    Text("Some title"),
    MaxGap(16),
    Text("Some subtitle"),
    Expanded(
      child: PageView(
        children: [
          CarouselSlide(),
          CarouselSlide(),
          CarouselSlide(),
        ],
      )
    ),
    MaxGap(24),
    TextButton(child: Text("A button")),
  ],
);

Expected outcome:

  1. The gaps between widgets don't exceed the value given to the MaxGap widget. While getting smaller if there is not enough space.
  2. The PageView (carousel in this example) expands and takes as much space as possible.

What I get:

For each MaxGap widget that I add the Expanded widget reduces its size to half.

How can I can use the Gap widget while still being able to utilize widgets like Expanded, Flexible or Spacer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant