Skip to content

Widget Gallery

Aleksey Mikhailov edited this page Feb 13, 2020 · 4 revisions

InputWidget

SystemInputViewFactory

code:

val theme = Theme {
    factory[InputWidget.DefaultCategory] = SystemInputViewFactory(
        background = Background(
            fill = null, // Fill
            border = null, // Border
            shape = null // Shape
        ),
        margins = null, // MarginValues
        padding = null, // PaddingValues
        textStyle = TextStyle(
            size = null, // Int
            color = null, // Color
            fontStyle = null // FontStyle
        ),
        labelTextColor = null, // Color
        textHorizontalAlignment = null, // TextHorizontalAlignment
        textVerticalAlignment = null, // TextVerticalAlignment
        iosFieldBorderStyle = null // IOSFieldBorderStyle
    )
}

val input = with(theme) {
    input(
        size = WidgetSize.WidthAsParentHeightWrapContent,
        id = Id.NickNameInput,
        label = const("Никнейм*"),
        field = viewModel.nicknameField,
        enabled = null, // LiveData<Boolean>
        inputType = null, // InputType
        maxLines = null // LiveData<Int?>
    )
}

preview:

Android iOS

FloatingLabelInputViewFactory

code:

val theme = Theme {
    factory[InputWidget.DefaultCategory] = FloatingLabelInputViewFactory(
        background = Background(
            fill = null, // Fill
            border = null, // Border
            shape = null // Shape
        ),
        margins = null, // MarginValues
        padding = null, // PaddingValues
        textStyle = TextStyle(
            size = null, // Int
            color = null, // Color
            fontStyle = null // FontStyle
        ),
        labelTextStyle = TextStyle(
            size = null, // Int
            color = null, // Color
            fontStyle = null // FontStyle
        ),
        errorTextStyle = TextStyle(
            size = null, // Int
            color = null, // Color
            fontStyle = null // FontStyle
        ),
        textHorizontalAlignment = null, // TextHorizontalAlignment
        underLineColor = null, // Color
        underLineFocusedColor = null // Color
    )
}

val input = with(theme) {
    input(
        size = WidgetSize.WidthAsParentHeightWrapContent,
        id = Id.NickNameInput,
        label = const("Никнейм*"),
        field = viewModel.nicknameField,
        enabled = null, // LiveData<Boolean>
        inputType = null, // InputType
        maxLines = null // LiveData<Int?>
    )
}

preview:

Android iOS

FlatInputViewFactory

code:

val theme = Theme {
    factory[InputWidget.DefaultCategory] = FlatInputViewFactory(
        backgroundColor = null, // Color
        margins = null, // MarginValues
        textStyle = TextStyle(
            size = null, // Int
            color = null, // Color
            fontStyle = null // FontStyle
        )
    )
}

val input = with(theme) {
    input(
        size = WidgetSize.WidthAsParentHeightWrapContent,
        id = Id.NickNameInput,
        label = const("Никнейм*"),
        field = viewModel.nicknameField,
        enabled = null, // LiveData<Boolean>
        inputType = null, // InputType
        maxLines = null // LiveData<Int?>
    )
}

preview:

Android iOS