public static class GraphicDataCardDefaults


Summary

Public fields

static @NonNull GraphicDataCardDefaults

Public methods

final @NonNull LayoutElementBuilders.LayoutElement
constructGraphic(
    @NonNull MaterialScope receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.Box> mainContent,
    @ExtensionFunctionType @NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> iconContent,
    float iconSizeRatio
)

Helper to construct a graphic content with a mainContent and an iconContent in its center, that can be passed into the graphicDataCard.

Public fields

INSTANCE

Added in 1.3.0-alpha08
public static @NonNull GraphicDataCardDefaults INSTANCE

Public methods

constructGraphic

public final @NonNull LayoutElementBuilders.LayoutElement constructGraphic(
    @NonNull MaterialScope receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.Box> mainContent,
    @ExtensionFunctionType @NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> iconContent,
    float iconSizeRatio
)

Helper to construct a graphic content with a mainContent and an iconContent in its center, that can be passed into the graphicDataCard.

It is highly recommended for the mainContent to take a circularProgressIndicator or segmentedCircularProgressIndicator and keep its default size as expand in order to fill the available space for the best results across different screen sizes. To have contrasting content colors, when using this constructed graphic inside a graphicDataCard with one of the predefined colors in CardDefaults, it is also highly recommended to leave its ProgressIndicatorColors to default, which will automatically match to the card colors.

Parameters
@ExtensionFunctionType @NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.Box> mainContent

The main content of the graphic slot. The main content is required to be wrapped in a Box. This helper is specially designed to supports well with main content as circularProgressIndicator or segmentedCircularProgressIndicator to be placed in the graphics slot.

@ExtensionFunctionType @NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> iconContent

The icon to be placed at the center of the main content. It is highly recommended to provide it by calling icon with only the resource ID, so that the returned layout would take advantage of the default styling functions provided by this helper, with equal width and height which are proportional to the mainContent's width , and matching color to the card.

float iconSizeRatio

The ratio of the icon size to the mainContent's width.

Throws
kotlin.IllegalArgumentException

When the mainContent has size of WrappedDimensionProp.