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

fix: [ANDROAPP-6744] correct bottom sheet issues and adapt for android 35 #347

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

xavimolloy
Copy link
Contributor

No description provided.

@xavimolloy xavimolloy requested a review from andresmr January 17, 2025 10:45
@xavimolloy xavimolloy changed the base branch from release/0.4.1-SNAPSHOT to develop January 21, 2025 07:11
@xavimolloy xavimolloy force-pushed the ANDROAPP-6744-Review-BottomSheet-Issues-2 branch from 7bb9783 to d29a16b Compare January 23, 2025 11:42
@Composable
fun Legend(
legendData: LegendData,
modifier: Modifier = Modifier,
windowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.windowInsets },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing new params documentation

@@ -81,6 +87,8 @@ fun OrgBottomSheet(
clearAllButtonText: String = provideStringResource("clear_all"),
doneButtonText: String? = null,
doneButtonIcon: ImageVector = Icons.Filled.Check,
windowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.windowInsets },
bottomSheetLowerPadding: Dp = Spacing0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing bottomSheetLowerPadding docs

@xavimolloy xavimolloy requested a review from Balcan January 24, 2025 07:51
@@ -157,7 +165,10 @@ fun BottomSheetShell(
subtitle: String? = null,
description: String? = null,
searchQuery: String? = null,
showSectionDivider: Boolean = true,
showTopSectionDivider: Boolean = true,
showBottomSectionDivider: Boolean = true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't you create a UIState class like:

data class BottomSheetShellUIState(
    val title: String? = null,
    val subtitle: String? = null,
    val description: String? = null,
    val searchQuery: String? = null,
    val showTopSectionDivider: Boolean = true,
    val showBottomSectionDivider: Boolean = true,
    val bottomPadding: Dp = Spacing0,
    val headerTextAlignment: TextAlign = TextAlign.Center,
    val scrollableContainerMinHeight: Dp = Spacing0,
    val scrollableContainerMaxHeight: Dp = InternalSizeValues.Size386,
    val animateHeaderOnKeyboardAppearance: Boolean = true
)

Modify the BottomSheet sheel like:

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun BottomSheetShell(
    uiState: BottomSheetShellUIState,
    content: @Composable (() -> Unit)? = null,
    windowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.windowInsets },
    contentScrollState: ScrollableState = rememberScrollState(),
    icon: @Composable (() -> Unit)? = null,
    buttonBlock: @Composable (() -> Unit)? = null,
    modifier: Modifier = Modifier,
    onSearchQueryChanged: ((String) -> Unit)? = null,
    onSearch: ((String) -> Unit)? = null,
    onDismiss: () -> Unit
) {
   
}

And then we can use it like:

val uiState = BottomSheetShellUIState(
    title = "Title",
    subtitle = "Subtitle",
    description = "Description",
    searchQuery = "Search",
    showTopSectionDivider = true,
    showBottomSectionDivider = true,
    bottomPadding = Spacing0,
    headerTextAlignment = TextAlign.Center,
    scrollableContainerMinHeight = Spacing0,
    scrollableContainerMaxHeight = InternalSizeValues.Size386,
    animateHeaderOnKeyboardAppearance = true
)

BottomSheetShell(
    uiState = uiState,
    content = { },
    onDismiss = { }
)

In this way we could add or remove parameters without generating breaking changes. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a great idea, I have updated the PR and usages with this, as well as deprecating the old one to avoid breaking changes

@xavimolloy xavimolloy requested a review from andresmr January 24, 2025 12:05
@xavimolloy xavimolloy force-pushed the ANDROAPP-6744-Review-BottomSheet-Issues-2 branch from 6e2f39e to f23f386 Compare January 24, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants