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

FlexLayout.Grow="1" not respecting Frame WidthRequest for Frames with images inside them. #20379

Open
mikeysouthwell opened this issue Feb 6, 2024 · 6 comments
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/android 🤖 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@mikeysouthwell
Copy link

mikeysouthwell commented Feb 6, 2024

Description

Example:

<FlexLayout     x:Name="TopNavigationLayout" 
                         Direction="Row" 
                        JustifyContent="SpaceBetween" 
                        Wrap="NoWrap" BackgroundColor="Green" Margin="24,24,24,12">

     <Frame  x:Name="LogoFrame" 
                   HeightRequest="48" 
                   WidthRequest="120" 
                   BackgroundColor="Red">

          <Image  Source="logo.png" HeightRequest="24" WidthRequest="120" \>

     </Frame>

     <Frame FlexLayout.Grow="1" 
                  BackgroundColor="Transparent" 
                  BorderColor="Transparent" />

     <FlexLayout	Direction="Row" 
                                FlexLayout.Grow="1">


          <Frame  x:Name="SearchIconFrame" 
                        HeightRequest="48" 
                        WidthRequest="48" 
                       BackgroundColor="Red">

               <Image  Source="search_icon.png" 
                              HeightRequest="24" 
                              WidthRequest="24" />

         </Frame>

          <Frame  x:Name="ImageIconFrame" 
                        HeightRequest="48" 
                        WidthRequest="48" 
                        BackgroundColor="Yellow">

               <Image  Source="image_icon.png" 
                             HeightRequest="24" 
                             WidthRequest="24" />

         </Frame>

          <Frame  x:Name="NotificationsIconFrame" 
                        HeightRequest="48" 
                        WidthRequest="48" 
                        BackgroundColor="Blue">

               <Image  Source="notifications_icon.png" 
                             HeightRequest="24" 
                             WidthRequest="24" />

         </Frame>

     </FlexLayout>

</FlexLayout>

Steps to Reproduce

image

I've blurred out the logo, but it doesn't matter as the issue is with the icons on the right.

Each of the Frames is aligned with the icon to its left, rather than the frame around the icon.

The icon images are set to 24 height and 24 width and the frames are set to 48 height and 48 width. FlexLayout.Grow=1 should align each of the frames inside the FlexLayout with each other, not align each of the frames with the image (icon) inside the frame next to it.

Unless I'm doing it wrong?

The only way I have seen to fix this is by using FlexLayout.Basis="144"
Which is 48x3=144, but I don't want to have to manually enter a fixed width for the FlexLayout. I want it to "hug" the contents, like an Auto Layout in Figma.

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 34.0.43

Did you find any workaround?

No response

Relevant log output

No response

@mikeysouthwell mikeysouthwell added the t/bug Something isn't working label Feb 6, 2024
@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Feb 7, 2024
@PureWeen PureWeen added the s/needs-repro Attach a solution or code which reproduces the issue label Feb 9, 2024
@ghost
Copy link

ghost commented Feb 9, 2024

Hi @mikeysouthwell. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@PureWeen
Copy link
Member

PureWeen commented Feb 9, 2024

Does it work if you use Border instead?

@mikeysouthwell
Copy link
Author

MSFTBOT there is a sample of code above in the original post description that you can use to reproduce the issue.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Feb 10, 2024
@mikeysouthwell
Copy link
Author

mikeysouthwell commented Feb 10, 2024

Does it work if you use Border instead?

@PureWeen same issue using Border instead of Frame unfortunately :(

@mikeysouthwell
Copy link
Author

mikeysouthwell commented Apr 29, 2024

This issue is still tagged as "needs repro". I have the code required to reproduce the issue in the post. Please let me know if you are unable to reproduce this.

@RoiChen001 RoiChen001 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels May 11, 2024
@RoiChen001
Copy link
Collaborator

Can repro this issue at Android platform on the latest 17.10 Preview 7(8.0.3&8.0.21).
20379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/android 🤖 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants