Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

enhancement: Make implicit layout available to child views #40

Open
bennythomps opened this issue Dec 6, 2014 · 9 comments
Open

enhancement: Make implicit layout available to child views #40

bennythomps opened this issue Dec 6, 2014 · 9 comments

Comments

@bennythomps
Copy link

Might get a bit crazy/unmanageable with multiple layers of nesting, but it would be great for type-checking on things like LayoutParams, to have an implicit layout available.

@stanch
Copy link
Collaborator

stanch commented Dec 6, 2014

What would be the syntax? Something like this?

l[LinearLayout](
  implicit l  w[Button] <~ lp(...),
  implicit l  w[TextView] <~ lp(...)
)

@stanch
Copy link
Collaborator

stanch commented Dec 6, 2014

Also see this comment for an alternative idea.

@bennythomps
Copy link
Author

l[LinearLayout]( implicit layout =>
  w[Button] <~ margin(all = 10 dp)
)

@stanch
Copy link
Collaborator

stanch commented Dec 6, 2014

So this is the same as in my first comment, right?

@bennythomps
Copy link
Author

Simliar, but maybe even just a signature like

def l[L <: ViewGroup](op: L => Seq[Ui[View]])

@stanch
Copy link
Collaborator

stanch commented Dec 6, 2014

Then you’ll have to wrap your views into a Seq — I don’t think it will look very nice :(

@bennythomps
Copy link
Author

Agreed, but for things like margin, there isn't a much cleaner way is there? Overloading it at least make it an option.

@stanch
Copy link
Collaborator

stanch commented Dec 6, 2014

I see your point — will have to think about this. Feel free to make a PR with a solution of your own :)

@bennythomps
Copy link
Author

Sounds good. Will do!

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

No branches or pull requests

2 participants