AskTextPopup

fun AskTextPopup(screen: BaseScreen, label: String = "Please enter some text", icon: IconCircleGroup = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(80f), defaultText: String = "", errorText: String = "Invalid input! Please enter a different string.", maxLength: Int = 32, validate: (input: String) -> Boolean = { true }, actionOnOk: (input: String) -> Unit = {})

Parameters

screen

The previous screen the user was on

label

A line of text shown to the user

icon

Icon at the top, should have size 80f

defaultText

The text that should be in the prompt at the start

errorText

Text that will be shown when an error is detected

maxLength

The maximal amount of characters the user may input

validate

Function that should return true when a valid input is entered, false otherwise

actionOnOk

Lambda that will be executed after pressing 'OK'. Gets the text the user inputted as a parameter.

Sources

jvm source
Link copied to clipboard