Open erri120 opened 1 month ago
Figma designs expects flexbox, Avalonia doesnt have this, we use long solutions to get round this. Allow us to implement new designs twice as fast. Can help with dynamic scaling.
The investigation will be to figure out which solution we will use and then how to implement it. What is the effort involved?
Tested FlexPanel
from Avalonia.Labs.
Avalonia.Labs version was chosen as the most up to date version of the third party libraries available and the most likely to get future updates and eventually be integrated into Avalonia project proper.
FlexBox
from outside sources (e.g. FlexBox Specification)
Stretch
).
We are going to use Avalonia.Labs
FlexPanel
going forwards.
Define properties for children in Styles:
<!-- FlexPanel Styles -->
<Style Selector="panels|FlexPanel">
<Style Selector="^ > :is(Control)">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="panels:Flex.Grow" Value="1" />
</Style>
</Style>
It is possible to reference generic children using ^ > :is(Control)
. the :is()
syntax is necessary because targeting Control
directly would not actually work for subclasses that don't explicitly inherit the styling from Control
.
My own opinion after using and dealing with the initial issues of FlexPanel I'm quite inclined in using it going forward. It is making the implementations of the Designs much simpler and more accurate on top of better scaling behavior in different size conditions.
The problems all seem solvable and within our control to do so.
I would go for it.
Do we want an ADR for this or is this enough?
An ADR would be nice, but it can mostly be a copy of the text in this ticket
On Thu, Jul 11, 2024 at 9:42 AM Al @.***> wrote:
Do we want an ADR for this or is this enough?
— Reply to this email directly, view it on GitHub https://github.com/Nexus-Mods/NexusMods.App/issues/1451#issuecomment-2223280008, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE72HJT6OFEOY7GPASLCLDZL2RXBAVCNFSM6AAAAABILB65M6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGI4DAMBQHA . You are receiving this because you commented.Message ID: @.***>
WPF, and sadly Avalonia, are missing a very important panel type: a simple flex container.
See https://css-tricks.com/snippets/css/a-guide-to-flexbox/ for details on how this is used to style components in CSS.