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 doesn't account for children size #6826

Closed
byme8 opened this issue May 4, 2022 · 8 comments
Closed

FlexLayout doesn't account for children size #6826

byme8 opened this issue May 4, 2022 · 8 comments
Assignees
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@byme8
Copy link

byme8 commented May 4, 2022

Description

Started porting an application to MAUI and noticed that FlexLayout doesn't take to account size of the children. I was able to reproduce it on windows uwp and android.

Steps to Reproduce

Add next xaml to the page:

  <StackLayout>
        <StackLayout Background="Blue" Padding="5">
            <Label Text="Statuses"/>
            <FlexLayout Wrap="Wrap" BackgroundColor="Blue">
                <Label Text="Test 1" TextColor="Red"/>
                <Label Text="Test 2" TextColor="Red"/>
                <Label Text="Test 3" TextColor="Red"/>
                <Label Text="Test 4" TextColor="Red"/>
                <Label Text="Test 5" TextColor="Red"/>
                <Label Text="Test 6" TextColor="Red"/>
                <Label Text="Test 7" TextColor="Red"/>
            </FlexLayout>
        </StackLayout>

        <Grid RowDefinitions="40, Auto" Background="Green" Padding="5">
            <Label Grid.Row="0" Text="Statuses"/>
            <FlexLayout Grid.Row="1" Wrap="Wrap" BackgroundColor="Blue">
                <Label Text="Test 1" TextColor="Red"/>
                <Label Text="Test 2" TextColor="Red"/>
                <Label Text="Test 3" TextColor="Red"/>
                <Label Text="Test 4" TextColor="Red"/>
                <Label Text="Test 5" TextColor="Red"/>
                <Label Text="Test 6" TextColor="Red"/>
                <Label Text="Test 7" TextColor="Red"/>
            </FlexLayout>
        </Grid>
        
         <StackLayout Background="Gray" Padding="5">
            <Label Text="Statuses"/>
            <StackLayout BackgroundColor="Blue">
                <Label Text="Test 1" TextColor="Red"/>
                <Label Text="Test 2" TextColor="Red"/>
                <Label Text="Test 3" TextColor="Red"/>
                <Label Text="Test 4" TextColor="Red"/>
                <Label Text="Test 5" TextColor="Red"/>
                <Label Text="Test 6" TextColor="Red"/>
                <Label Text="Test 7" TextColor="Red"/>
            </StackLayout>
        </StackLayout>
 </StackLayout>

Windows UWP:
image

Android
image

Version with bug

Release Candidate 2 (current)

Last version that worked well

Release Candidate 2 (current)

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 10, Windows 10 22H1

Did you find any workaround?

No response

Relevant log output

No response

@byme8 byme8 added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels May 4, 2022
@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label May 4, 2022
@v-longmin v-longmin added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 5, 2022
@v-longmin
Copy link

Verified repro on Windows 10 & Android 12.0 with above project code.

@Redth Redth added this to the 6.0.300 milestone May 5, 2022
@Redth Redth added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label May 5, 2022
@kristinx0211
Copy link

still an issue on android and windows with 17.3.0 Preview 2.0 [32509.345.main].

@samhouts samhouts modified the milestones: 6.0.300, 6.0.300-servicing May 12, 2022
@Redth Redth modified the milestones: 6.0.300-servicing, 6.0.3xx-sr1 May 18, 2022
@byme8
Copy link
Author

byme8 commented May 24, 2022

Managed to reproduce on ios and maccatalyst

@Palku
Copy link

Palku commented May 24, 2022

Really interested in a workaround for this.
There must be as it is marked as "can ship without".

I just want a layout with buttons that wraps to a new line when it doesn't fit without manually have to create stackpanels with x items.

Psuedo code of what i want to achieve.

<Grid>
  <Row height = 80/> //Header with fixed height.
  <Row height = Auto/> //Navigation which can be multi-line if needed <- Here i try to use FlexLayout which doesnt work at all.
  <Row height = */> //Content which should have all remaining space.
</Grid>

@byme8
Copy link
Author

byme8 commented May 24, 2022

I was not able to figure out the workaround for this issue and I believe that there is no one. If you look at other issues associated with layout calculations you will find that there are hundreds of them.

@byme8
Copy link
Author

byme8 commented May 28, 2022

Looks like the issue is fixed. I can't reproduce it with the latest update.

@Palku
Copy link

Palku commented May 28, 2022

@byme8 : You're correct! :)
Now my app works in Android without my ugly forced size code.

@hartez
Copy link
Contributor

hartez commented May 31, 2022

I believe this was fixed by #6085.

@hartez hartez closed this as completed May 31, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jun 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 platform/windows 🪟 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

8 participants