Skip to content

Commit

Permalink
Merge pull request #148 from Syer10/patch-1
Browse files Browse the repository at this point in the history
Fix input import and docs
  • Loading branch information
PranavMaganti authored May 24, 2022
2 parents 71903f9 + 3113f29 commit 589eacf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.text.input.ImeAction
import com.vanpra.composematerialdialogdemos.DialogAndShowButton
import com.vanpra.composematerialdialogdemos.R
import com.vanpra.composematerialdialogs.TextFieldStyle
import com.vanpra.composematerialdialogs.iconTitle
import com.vanpra.composematerialdialogs.input
import com.vanpra.composematerialdialogs.message
import com.vanpra.composematerialdialogs.title
import input

/**
* @brief Basic Dialog Demos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.test.performTextClearance
import androidx.compose.ui.test.performTextInput
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vanpra.composematerialdialogs.MaterialDialogScope
import com.vanpra.composematerialdialogs.input
import com.vanpra.composematerialdialogs.rememberMaterialDialogState
import com.vanpra.composematerialdialogs.test.R
import com.vanpra.composematerialdialogs.test.utils.DialogWithContent
Expand All @@ -20,7 +21,6 @@ import com.vanpra.composematerialdialogs.test.utils.extensions.onDialogInput
import com.vanpra.composematerialdialogs.test.utils.extensions.onDialogInputError
import com.vanpra.composematerialdialogs.test.utils.extensions.onPositiveButton
import com.vanpra.composematerialdialogs.title
import input
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package com.vanpra.composematerialdialogs.test.screenshot
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.karumi.shot.ScreenshotTest
import com.vanpra.composematerialdialogs.TextFieldStyle
import com.vanpra.composematerialdialogs.input
import com.vanpra.composematerialdialogs.test.R
import com.vanpra.composematerialdialogs.test.utils.DialogWithContent
import com.vanpra.composematerialdialogs.test.utils.extensions.onDialog
import com.vanpra.composematerialdialogs.test.utils.extensions.setContentAndWaitForIdle
import com.vanpra.composematerialdialogs.title
import input
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.vanpra.composematerialdialogs

import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -26,31 +28,31 @@ import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.vanpra.composematerialdialogs.MaterialDialogScope

enum class TextFieldStyle {
Filled,
Outlined/**
* Adds an input field with the given parameters to the dialog
* @param label string to be shown in the input field before selection eg. Username
* @param hint hint to be shown in the input field when it is selected but empty eg. Joe
* @param prefill string to be input into the text field by default
* @param waitForPositiveButton if true the [onInput] callback will only be called when the
* positive button is pressed, otherwise it will be called when the input value is changed
* @param visualTransformation a visual transformation of the content of the text field
* @param keyboardOptions software keyboard options which can be used to customize parts
* of the keyboard
* @param errorMessage a message to be shown to the user when the input is not valid
* @param focusRequester a [FocusRequester] which can be used to control the focus state of the
* text field
* @param focusOnShow if set to true this will auto focus the text field when the input
* field is shown
* @param isTextValid a function which is called to check if the user input is valid
* @param onInput a function which is called with the user input. The timing of this call is
* dictated by [waitForPositiveButton]
*/
Outlined
}

/**
* Adds an input field with the given parameters to the dialog
* @param label string to be shown in the input field before selection eg. Username
* @param placeholder hint to be shown in the input field when it is selected but empty eg. Joe
* @param prefill string to be input into the text field by default
* @param waitForPositiveButton if true the [onInput] callback will only be called when the
* positive button is pressed, otherwise it will be called when the input value is changed
* @param visualTransformation a visual transformation of the content of the text field
* @param keyboardOptions software keyboard options which can be used to customize parts
* of the keyboard
* @param errorMessage a message to be shown to the user when the input is not valid
* @param focusRequester a [FocusRequester] which can be used to control the focus state of the
* text field
* @param focusOnShow if set to true this will auto focus the text field when the input
* field is shown
* @param isTextValid a function which is called to check if the user input is valid
* @param onInput a function which is called with the user input. The timing of this call is
* dictated by [waitForPositiveButton]
*/
@Composable
fun MaterialDialogScope.input(
modifier: Modifier = Modifier,
Expand Down

0 comments on commit 589eacf

Please sign in to comment.