Gurupreet / ComposeCookBook

A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential
MIT License
6.3k stars 799 forks source link

App crashes when opening Widgets screen #10

Closed wajahatkarim3 closed 4 years ago

wajahatkarim3 commented 4 years ago

I just compiled the project and observed that the app crashes when I open Widgets screen. Its this exception thrown.

--------- beginning of crash
2020-10-06 00:57:00.480 7398-7398/com.guru.composecookbook E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.guru.composecookbook, PID: 7398
    java.lang.IllegalStateException: Surface can have only one direct measurable child!
        at androidx.compose.material.SurfaceKt$SurfaceLayout$1$1.invoke(Surface.kt:131)
        at androidx.compose.material.SurfaceKt$SurfaceLayout$1$1.invoke(Unknown Source:13)
        at androidx.compose.ui.LayoutKt$MeasuringIntrinsicsMeasureBlocks$1.measure-2MWCACw(Layout.kt:385)
        at androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0(InnerPlaceable.kt:48)
        at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:123)
        at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:104)
        at androidx.compose.ui.node.LayerWrapper.performMeasure-BRTryo0(LayerWrapper.kt:67)
        at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:123)
        at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:104)
        at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:123)
        at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:104)
        at androidx.compose.ui.node.LayerWrapper.performMeasure-BRTryo0(LayerWrapper.kt:67)
        at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:123)
        at androidx.compose.foundation.layout.FillModifier.measure-3Jkh9V0(LayoutSize.kt:464)
        at androidx.compose.ui.node.ModifiedLayoutNode.performMeasure-BRTryo0(ModifiedLayoutNode.kt:36)
        at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:123)
        at androidx.compose.foundation.layout.PaddingModifier.measure-3Jkh9V0(LayoutPadding.kt:169)
        at androidx.compose.ui.node.ModifiedLayoutNode.performMeasure-BRTryo0(ModifiedLayoutNode.kt:36)
        at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:123)
        at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt:90)
        at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(Unknown Source:0)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:133)
        at androidx.compose.ui.platform.AndroidComposeView.observeMeasureModelReads(AndroidComposeView.kt:430)
        at androidx.compose.ui.node.OuterMeasurablePlaceable.remeasure-BRTryo0(OuterMeasurablePlaceable.kt:89)
        at androidx.compose.ui.node.OuterMeasurablePlaceable.measure-BRTryo0(OuterMeasurablePlaceable.kt:62)
        at androidx.compose.ui.node.LayoutNode.measure-BRTryo0(LayoutNode.kt:1173)
        at androidx.compose.foundation.layout.RowColumnImplKt$rowColumnMeasureBlocks$1.invoke(RowColumnImpl.kt:88)
        at androidx.compose.foundation.layout.RowColumnImplKt$rowColumnMeasureBlocks$1.invoke(Unknown Source:13)
        at androidx.compose.ui.LayoutKt$measureBlocksOf$1.measure-2MWCACw(Layout.kt:147)
        at androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0(InnerPlaceable.kt:48)
        at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:123)
        at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt:90)
        at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(Unknown Source:0)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:133)
        at androidx.compose.ui.platform.AndroidComposeView.observeMeasureModelReads(AndroidComposeView.kt:430)
        at androidx.compose.ui.node.OuterMeasurablePlaceable.remeasure-BRTryo0(OuterMeasurablePlaceable.kt:89)
        at androidx.compose.ui.node.OuterMeasurablePlaceable.measure-BRTryo0(OuterMeasurablePlaceable.kt:62)
        at androidx.compose.ui.node.LayoutNode.measure-BRTryo0(LayoutNode.kt:1173)
        at androidx.compose.foundation.layout.RowColumnImplKt$rowColumnMeasureBlocks$1.invoke(RowColumnImpl.kt:88)
        at androidx.compose.foundation.layout.RowColumnImplKt$rowColumnMeasureBlocks$1.invoke(Unknown Source:13)
Gurupreet commented 4 years ago

Hey buddy Thanks for raising must be because of 04alpha update let me fix it πŸ‘πŸ‘

Gurupreet commented 4 years ago

@wajahatkarim3 pushed the fix. Thanks for raising πŸ‘

wajahatkarim3 commented 4 years ago

Cool. I was about to send you PR. But now its already fixed. Thanks :)

Gurupreet commented 4 years ago

hahah I was on laptop 🀣. Feel free to improve anything you feel like can be πŸ‘πŸ‘