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

Add size(w,h) + 9 alignment options: center(), centerLeft() etc #32

Closed
esDotDev opened this issue Mar 3, 2020 · 6 comments
Closed

Add size(w,h) + 9 alignment options: center(), centerLeft() etc #32

esDotDev opened this issue Mar 3, 2020 · 6 comments

Comments

@esDotDev
Copy link

esDotDev commented Mar 3, 2020

I often find myself having to chain both width and height,
width(50).height(50) would read better as size(50,50)

Additionally, when alignment things, it can be overly verbose:
.alignment(Alignment.center) could just be center()

@ReinBentdal
Copy link
Owner

ReinBentdal commented Mar 3, 2020

As for width and height you can use constraints. For center() I think we are better of not including it. I think it then again would be too little verbose. What I am dreaming about is the possibility to omit the classname/enum if it's expected through the dart language to enable this: . alignment (.center).
dart-lang/language#357

@esDotDev
Copy link
Author

esDotDev commented Mar 3, 2020

Ooh that would be nice :)

Still I center stuff a lot, would be really handy to just have center(). All of the other ones are less important imo.

Another option would be to allow us to enter the raw values, like this would be really flexible:
alignmentRaw(0,0)

@ReinBentdal
Copy link
Owner

For now i wont add this. I want to keep the package simple. What i mean by that is to keep the package verbose and to have as few special cases as possible, like center. The same goes for alignmentRaw since you can already write alignment(Alignment(x,y))

I will keep this issue open for now.

@esDotDev
Copy link
Author

esDotDev commented Mar 3, 2020

Ok, I understand that philosophy, but in a library that is all about syntactic sugar, I'd argue, just pour on the sugar! It's not like its complex enough to be confusing, the align 'shortcuts' could all just serve as proxies for the main align call, so there wouldn't really be any extra maintenance or testing required.

Regarding constraints, I'm getting an error that the function is not defined:
image

It seems to be trying to use the .constraints property instead of the extension. Which affects at Container, IconButton, and probably many others.

fwiw, I'm on latest master.

@ReinBentdal
Copy link
Owner

ReinBentdal commented Mar 4, 2020

You should have opened a new issue regarding the bug. Anyways the problem is sorted in a upcoming release!

@ReinBentdal
Copy link
Owner

In v. 0.2.1 center is added, but as an Center() widget, not Align(alignment: Alignment.center)

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

2 participants