Reputation: 1471
I understand alignment: Alignment(-1, 0),
and alignment: Aignment.topLeft,
etc. but what are AlignmentDirectional
, AlignmentGeometry
. I can't understand the docs very well.
Upvotes: 3
Views: 5021
Reputation: 413
AlignmentGeometry
is the abstract type which Alignment
and AlignmentDirectional
implement. The whole idea is to define the relative positioning of two widgets (mostly a child and its parent). It has abstract methods to calculate result of interactions between two, scaling, adding, .... These methods are implemented by Alignment
and AlignmentDirectional
.
Alignment
adds more details and helper functions, like the ones you mentioned: Alignment(-1, 0)
, Aignment.topLeft
, .... And this is what we most of the times use.
AlignmentDirectional
is just like Alignment
but is aware of TextDirection. It is useful in Left-to-Right languages where you want the horizontal direction to be automatically based on the TextDirection without you having to do any more calculations. As the doc says:
This can be used to indicate an offset from the left in TextDirection.ltr text and an offset from the right in TextDirection.rtl text without having to be aware of the current text direction.
Upvotes: 2