androidx / constraintlayout

ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way
Apache License 2.0
1.06k stars 177 forks source link

[Row & Column feature parity] LastBaseline alignment experiment #805

Open jswong65 opened 1 year ago

jswong65 commented 1 year ago

This PR is created to experiment how to enable LastBaseline alignment. Currently, we only support FirstBaseline alignment in ConstraintLayout Compose.

Some examples can be seen below (based on LastBaselineDemo.kt).

Top to LastBaseline

image

Bottom to LastBaseline

image

Baseline to LastBaseline

image

jafu888 commented 1 year ago

This implies we need to expand the scope of the interface to "measure" lastBaselin alignment is not supported in the core of ConstraintLayout but it may not need to be. It has support for baseline we can add some side information as to the type of baseline So that when measure ask for the position of the baseline it returns the correct one.

Work with Oscar to define a correct sequence diagram (sort of like the one below) in your design document. Lets get to a clear understanding of the current approach and how it might be extended.

sequenceDiagram
    participant CL Compose
    participant Core
    CL Compose->>Core: Config ConstraintSet
    CL Compose->>Core: request layout
    loop till solver done
        Core->>CL Compose: Measure widget1
        Core->>CL Compose: Measure widget2
    end
     Core->>CL Compose: layout info widget1
     Core->>CL Compose: layout info widget2