Skip to content

Expect androidx.compose.material.AlertDialog in common#708

Merged
MatkovIvan merged 9 commits intojb-mainfrom
ivan.matkov/common-alertdialog
Aug 10, 2023
Merged

Expect androidx.compose.material.AlertDialog in common#708
MatkovIvan merged 9 commits intojb-mainfrom
ivan.matkov/common-alertdialog

Conversation

@MatkovIvan
Copy link
Copy Markdown
Collaborator

@MatkovIvan MatkovIvan commented Jul 26, 2023

Proposed Changes

  • Expect AlertDialog in common
  • Use Dialog from Expect Dialog in common #632
  • Remove experimental desktop-only AlertDialog and AlertDialogProvider

API Change

Added AlertDialog API to common source set:

fun AlertDialog(
    onDismissRequest: () -> Unit,
    confirmButton: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    dismissButton: @Composable (() -> Unit)? = null,
    title: @Composable (() -> Unit)? = null,
    text: @Composable (() -> Unit)? = null,
    shape: Shape = MaterialTheme.shapes.medium,
    backgroundColor: Color = MaterialTheme.colors.surface,
    contentColor: Color = contentColorFor(backgroundColor),
    properties: DialogProperties = DialogProperties()
)
@Composable
fun AlertDialog(
    onDismissRequest: () -> Unit,
    buttons: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    title: (@Composable () -> Unit)? = null,
    text: @Composable (() -> Unit)? = null,
    shape: Shape = MaterialTheme.shapes.medium,
    backgroundColor: Color = MaterialTheme.colors.surface,
    contentColor: Color = contentColorFor(backgroundColor),
    properties: DialogProperties = DialogProperties()
)

Please note that new overload might behave differently than previous desktop-only experimental API

Testing

Test: run test apps or try to use AlertDialog in common

Issues Fixed

@MatkovIvan MatkovIvan requested a review from m-sasha July 26, 2023 08:50
@MatkovIvan MatkovIvan force-pushed the ivan.matkov/common-alertdialog branch from ebda8b2 to 3020ef1 Compare July 31, 2023 10:23
@MatkovIvan MatkovIvan force-pushed the ivan.matkov/common-alertdialog branch 2 times, most recently from c3a1276 to fec2221 Compare August 3, 2023 15:03
@MatkovIvan MatkovIvan reopened this Aug 4, 2023
@MatkovIvan MatkovIvan marked this pull request as ready for review August 4, 2023 19:45
@MatkovIvan MatkovIvan force-pushed the ivan.matkov/common-alertdialog branch from 3b1e95e to 87da601 Compare August 8, 2023 09:54
# Conflicts:
#	compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopAlertDialogTest.kt
@MatkovIvan MatkovIvan merged commit 0bb1c8e into jb-main Aug 10, 2023
@MatkovIvan MatkovIvan deleted the ivan.matkov/common-alertdialog branch August 10, 2023 11:51
igordmn pushed a commit that referenced this pull request Nov 15, 2023
…log` in common (#708)

* Expect AlertDialog in common

* Remove experimental desktop-only AlertDialog

* Update DesktopAlertDialogTest

* Configure skikoMain

* Add AlertDialogWindow instead of UndecoratedWindowAlertDialogProvider

* Update comment

* Update button size in run3 app

* Revert AlertDialogWindow
copybara-service Bot pushed a commit to androidx/androidx that referenced this pull request May 23, 2024
It's upstreaming of JetBrains#708.
This API is already available from common since Compose Multiplatform 1.5.0

Test: N/A
Relnote: Make `androidx.compose.material.AlertDialog` available from common source set
Change-Id: If9fd3fe4a9d232e289df22cb9aee9e6430fc51af
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.

2 participants