Search code examples
androidandroid-jetpack-composeandroid-jetpack-compose-material3

Windows insect Modal Bottom sheet on Android Oreo and earlier wrong behaviour


Using Material 3 Version 1.3.0-beta04, and Modal bottom sheet but the bottom padding is too big and hide the content on android oreo 8.1 and earlier.

class MainActivity : ComponentActivity() {
    @OptIn(ExperimentalMaterial3Api::class)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MaterialTheme {
                Scaffold { _ ->
                    val bottomSheetState = rememberModalBottomSheetState(true)
                    ModalBottomSheet(sheetState = bottomSheetState, content = {
                        Text("Status")
                        OutlinedButton(onClick = {}) {
                            Text("Confirm")
                        }
                    }, onDismissRequest = {

                    })
                }
            }
        }
    }
}

I tried to use windows insect (0,0,0,0) but still same result, the different between old working version 1.2 and the latest one 1.3.0 beta that they are using ModalBottomSheetDialog instead of PopupDialog and they have added Box(modifier = Modifier.fillMaxSize().imePadding()) to the box content.

Actually, I want the way to remove padding which is applied internally in the beta version.

I expected to show the content in wrap height but the bottom padding overlap on content on Oreo 8.1 and earlier.


Solution

  • Fixed on version 1.3.0-beta05 with this commit

    Fixed here