freya
freya copied to clipboard
rfc: flex implementation for rect
Extension of rect with full flex properties
IMPOTANT: Children positioning
Any children positioning must respect the paddings of children and the container
Types
Alignment enum
-
"start"
- aligns children or an element to start -
"center"
- centers children or an element -
"end"
- aligns children or an element to end Note that"start"
is default
start here means:
top for y axis
left for x axis
end here means:
bottom for y axis
right for x axis
Note that the meaning of start and end can be changing the
direction
property
Added properties for positioning of children inside of container
align_main
:
Positions the children relative to the container main axis.
Possible values are of alignment enum
align_cross
:
Positions the children relative to the container cross axis.
Possible values are of alignment enum
spacing
:
Changes the spacing between and around children. Possible values are:
- Size Units - regulates spacing between the children, follows the alignment of the main axis(based on direction)
-
space-between
- spaces children in between evenly while spacing around children is none -
space-around
- spacing is equal around and between children Notes on spacing
-
space-between
andspace-around
override the alignment of main axis(based on direction) - when spacing is set the margins of children are not respected, but in the case of the
space-between
andspace-around
the margins are considered minimal possible spacing(to disable that behavior wrap the element in arect
without margins) - Default is 0 logical pixels(Size units)
Changed properties for positioning of children inside of container
direction
Can be the following:
-
vertical
-main axis
is set toy axis
andcross axis
is set tox axis
-
vertical-reversed
-main axis
is set toy axis
andcross axis
is set tox axis
, the start and end are reversed such so that children go from bottom to top -
horizontal
-main axis
is set tox axis
andcross axis
is set toy axis
-
horizontal-reversed
-main axis
is set tox axis
andcross axis
is set toy axis
, the start and end are reversed such so that children go from right to left -
both
- deprecated, since used only fordisplay: center
Notes on direction
- Default is
vertical
Deprecation of certain props
display
This property is deprecated as this proposal replaces it with alignment
This property can be repurposed to be something else.
Proposal is small Note that this proposal doesn’t include ability to grow elements and position individual children, because I think smaller proposals are easier to discuss and implement.
THIS PROPOSAL IS NOT WRITTEN BY A PROFESSIONAL The proposal is not worded like an RFC, so it should be reworded and clarified
I like the idea! I'll try to implement this asap
Perhaps instead of having align_x
and align_y
we could have something like Flutter https://docs.flutter.dev/ui/layout#aligning-widgets
-
align_main
-
align_cross
Thoughts?
Perhaps instead of having
align_x
andalign_y
we could have something like Flutter https://docs.flutter.dev/ui/layout#aligning-widgets
align_main
align_cross
Thoughts?
This would create complexity, because instead of thinking just about axis, I also need to remember the direction.
I like the idea! I'll try to implement this asap
I want to help with the implementation, but i am still reading the code for torin.
You are also creating complexity when the meaning of align_x
and align_y
changes when using one direction or another X)
I like the idea! I'll try to implement this asap
I want to help with the implementation, but i am still reading the code for torin.
It's fine, I can do it myself, it will probably require quite a few changes
You are also creating complexity when the meaning of
align_x
andalign_y
changes when using one direction or another X)
Yea, but here we are explicit about reversing.
I like the idea! I'll try to implement this asap
I want to help with the implementation, but i am still reading the code for torin.
It's fine, I can do it myself, it will probably require quite a few changes
But also it's okey to use flutter alignment instead, it also would help when changing direction, the alignment would be correct
I like the idea! I'll try to implement this asap
I want to help with the implementation, but i am still reading the code for torin.
It's fine, I can do it myself, it will probably require quite a few changes
But also it's okey to use flutter alignment instead, it also would help when changing direction, the alignment would be correct
I think I will edit the rfc with the flutter alignment
@marc2332 feat: Updated the rfc:
- Changed to the flutter alignment
- Clarified the defaults
- Reformatted the document a bit