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

Can't constraint two items horizontally with equal width #231

Open
ahmetcj4 opened this issue Apr 14, 2020 · 1 comment
Open

Can't constraint two items horizontally with equal width #231

ahmetcj4 opened this issue Apr 14, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@ahmetcj4
Copy link

I want to put two items in with the same with in constraint builder but currently it seems not working.

Sample Code:

    override fun createContentWidget() = with(theme) {
        constraint(size = WidgetSize.AsParent) {
            val loginButton = +button(
                size = Const(MatchConstraint, WrapContent),
                content = Text(Value.data("Login".desc() as StringDesc))
            ) { }

            val registerButton = +button(
                size = Const(MatchConstraint, WrapContent),
                content = Text(Value.data("Register".desc() as StringDesc))
            ) { }

            constraints {
                loginButton topToTop root
                loginButton leftToLeft root
                loginButton rightToLeft registerButton offset 8

                registerButton centerYToCenterY loginButton
                registerButton rightToRight root
                registerButton leftToRight loginButton offset 8
            }
        }
    }

Previews:

Android iOS
Screen Shot 2020-04-14 at 21 23 48 Screen Shot 2020-04-14 at 21 24 00
@Alex009 Alex009 added the enhancement New feature or request label Apr 19, 2020
@Alex009
Copy link
Member

Alex009 commented Apr 19, 2020

on both platforms we can create vertical/horizontal guidelines:
https://developer.android.com/reference/android/support/constraint/Guideline
https://developer.apple.com/documentation/uikit/uilayoutguide

if we add to common api guidelines support we support case from issue description

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

No branches or pull requests

2 participants