# GraphicDataCardDefaults

Artifact: [androidx.wear.protolayout:protolayout-material3](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/material3/GraphicDataCardDefaults.kt+class:androidx.wear.protolayout.material3.GraphicDataCardDefaults) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

*** ** * ** ***


```
public static class GraphicDataCardDefaults
```

<br />

*** ** * ** ***

## Summary

| ### Public fields |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults` | `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#INSTANCE()` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement` | `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/MaterialScope receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/MaterialScope, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Box> mainContent, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/MaterialScope, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement> iconContent, float iconSizeRatio )` Helper to construct a graphic content with a `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)` and an `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)` in its center, that can be passed into the `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).graphicDataCard(androidx.wear.protolayout.ModifiersBuilders.Clickable,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.modifiers.LayoutModifier,kotlin.Function1,androidx.wear.protolayout.DimensionBuilders.ContainerDimension,androidx.wear.protolayout.ModifiersBuilders.Corner,androidx.wear.protolayout.material3.CardColors,androidx.wear.protolayout.material3.GraphicDataCardStyle,kotlin.Int,androidx.wear.protolayout.ModifiersBuilders.Padding)`. |

## Public fields

### INSTANCE

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

```
public static @NonNull GraphicDataCardDefaults INSTANCE
```

## Public methods

### constructGraphic

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

Helper to construct a graphic content with a `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)` and an `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)` in its center, that can be passed into the `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).graphicDataCard(androidx.wear.protolayout.ModifiersBuilders.Clickable,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.modifiers.LayoutModifier,kotlin.Function1,androidx.wear.protolayout.DimensionBuilders.ContainerDimension,androidx.wear.protolayout.ModifiersBuilders.Corner,androidx.wear.protolayout.material3.CardColors,androidx.wear.protolayout.material3.GraphicDataCardStyle,kotlin.Int,androidx.wear.protolayout.ModifiersBuilders.Padding)`.

It is highly recommended for the `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)` to take a `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).circularProgressIndicator(kotlin.Float,androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat,androidx.wear.protolayout.modifiers.LayoutModifier,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.wear.protolayout.material3.ProgressIndicatorColors,androidx.wear.protolayout.DimensionBuilders.ContainerDimension)` or `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).segmentedCircularProgressIndicator(kotlin.Int,kotlin.Float,androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat,androidx.wear.protolayout.modifiers.LayoutModifier,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.wear.protolayout.material3.ProgressIndicatorColors,androidx.wear.protolayout.DimensionBuilders.ContainerDimension)` and keep its default size as `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders#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 `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).graphicDataCard(androidx.wear.protolayout.ModifiersBuilders.Clickable,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.modifiers.LayoutModifier,kotlin.Function1,androidx.wear.protolayout.DimensionBuilders.ContainerDimension,androidx.wear.protolayout.ModifiersBuilders.Corner,androidx.wear.protolayout.material3.CardColors,androidx.wear.protolayout.material3.GraphicDataCardStyle,kotlin.Int,androidx.wear.protolayout.ModifiersBuilders.Padding)` with one of the predefined colors in `https://developer.android.com/reference/androidx/wear/protolayout/material3/CardDefaults`, it is also highly recommended to leave its `https://developer.android.com/reference/androidx/wear/protolayout/material3/ProgressIndicatorColors` to default, which will automatically match to the card colors.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/MaterialScope, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Box> mainContent` | The main content of the graphic slot. The main content is required to be wrapped in a `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Box`. This helper is specially designed to supports well with main content as `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).circularProgressIndicator(kotlin.Float,androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat,androidx.wear.protolayout.modifiers.LayoutModifier,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.wear.protolayout.material3.ProgressIndicatorColors,androidx.wear.protolayout.DimensionBuilders.ContainerDimension)` or `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).segmentedCircularProgressIndicator(kotlin.Int,kotlin.Float,androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat,androidx.wear.protolayout.modifiers.LayoutModifier,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.wear.protolayout.material3.ProgressIndicatorColors,androidx.wear.protolayout.DimensionBuilders.ContainerDimension)` to be placed in the graphics slot. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/MaterialScope, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement> iconContent` | The icon to be placed at the center of the main content. It is highly recommended to provide it by calling `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).icon(androidx.wear.protolayout.ResourceBuilders.ImageResource,kotlin.String,androidx.wear.protolayout.DimensionBuilders.ImageDimension,androidx.wear.protolayout.DimensionBuilders.ImageDimension,androidx.wear.protolayout.types.LayoutColor)` 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 `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)`'s width , and matching color to the card. |
| `float iconSizeRatio` | The ratio of the icon size to the `https://developer.android.com/reference/androidx/wear/protolayout/material3/GraphicDataCardDefaults#(androidx.wear.protolayout.material3.MaterialScope).constructGraphic(kotlin.Function1,kotlin.Function1,kotlin.Float)`'s width. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | When the mainContent has size of `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.WrappedDimensionProp`. |