Skip to content

Improve Gutter #4

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

Merged
merged 24 commits into from
Aug 2, 2024
Merged

Improve Gutter #4

merged 24 commits into from
Aug 2, 2024

Conversation

martijn00
Copy link
Contributor

@martijn00 martijn00 commented Jul 31, 2024

Add optional size and scaleFactor parameters

const Gutter(size: 20, scaleFactor: 3, type: GutterType.large)

Introduce constructors on Gutter for types like small, large, etc

const Gutter.tiny();
const Gutter.small();
const Gutter.medium();
const Gutter.large();
const Gutter.extraLarge();

Add Gutter.expand

const Gutter.expand()

Add extension to add Gutter on Lists

<Widget>[
    const Text('Test1'),
    const Text('Test2'),
    const Text('Test3'),
  ].withGutter() // Optional parameter to set which Gutter size you want to use

Add AdaptiveGutter that switches Gutter size based on the current breakpoint

const AdaptiveGutter(
    small: Gutter.tiny(),
    medium: Gutter.large(),
    large: Gutter.extraLarge(),
  )

Migrate to flutter_adaptive_scaffold to remove deprecated package

flutter_adaptive_scaffold: ^0.1.11+1

@Ladegeraet
Copy link

Ladegeraet commented Jul 31, 2024

Love this PR! I just visit the repo to fork it and implement this 👍 Thanks :-)

@martijn00
Copy link
Contributor Author

What do you mean by "visit the repo to fork it and implement this"? Is there any changes needed, or do you want to merge this?

@Ladegeraet
Copy link

I meant that I was start to working on implementing similar improvements when I stumbled upon your PR. 😁 u just saved me some time 👍

Copy link
Owner

@caseycrogers caseycrogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I had a handful of nits and one or two larger questions.

FYI I think I added a ruleset that enables the CI stuff you added, but not totally sure so let me know if that's not working.

@martijn00
Copy link
Contributor Author

@caseycrogers I'll get back to some more changes tomorrow. The CI still doesn't work so it would be great if you can fix that.

@caseycrogers
Copy link
Owner

I think your CI/CD won't work until after the PR is merged, no?

If you want you could send me a separate PR with just the CI/CD stuff and I can merge it and see if that fixes it.

@martijn00 martijn00 requested a review from caseycrogers August 1, 2024 20:07
@martijn00
Copy link
Contributor Author

@caseycrogers I've fixed the issues and made a separate PR for CI in case you want to merge that one in first.

Let me know if you have any other feedback.

@martijn00
Copy link
Contributor Author

@caseycrogers you need to enable CD in pub dev for deployment to work. Go to https://pub.dev/packages/flutter_gutter/admin

Select: Enable publishing from GitHub Actions
Set repo: caseycrogers/flutter_gutter
Tag pattern: v{{version}}
Enable both:
Enable publishing from push events
Enable publishing from workflow_dispatch events

@caseycrogers
Copy link
Owner

I left one final review comment on AdaptiveGutter, I'm still not totally getting the point (see relevant comment), but otherwise ready to ship.

@martijn00
Copy link
Contributor Author

Sounds good! We use SlotLayout quite a bit in our apps, especially to scale things on web or windowed screens that can resize on the fly. That's probably why i would like to use it this way, but it is just a small wrapper and could be done in our app code as well. I thought it would be useful to others as well maybe.

@martijn00
Copy link
Contributor Author

The build works now! After you've fixed the admin access things on pub you can merge this, make a v2.0.0 tag on the repo and it will do the work for you.

Copy link
Owner

@caseycrogers caseycrogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'll ship this later today, thanks a lot of the contribution I really appreciate it!!

materialSpacing * Gutter.scaleFactorMediumDefault,
GutterType.expand => double.infinity,
}
..floor();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding the floor here? Shouldn't Flutter handle any non-pixel boundaries when it converts to physical pixels?

Also, if we DO want to keep the floor in, shouldn't it apply after multiplying by scale factor?

Either way I'll just merge and ship this now and if we want to pull the floor back out I'll handle that in a patch version because I don't want to leave you stuck in async review h*ll.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm making some more changes right now. Just found some stuff. I'll also add some tests

@caseycrogers caseycrogers merged commit 8bfc95a into caseycrogers:main Aug 2, 2024
3 checks passed
@martijn00 martijn00 mentioned this pull request Aug 2, 2024
4 tasks
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

Successfully merging this pull request may close these issues.

3 participants