MaterialScopeKt
public final class MaterialScopeKt
Summary
Public methods |
|
|---|---|
static final @NonNull LayoutElementBuilders.LayoutElement |
materialScope(Creates a top-level receiver scope |
static final @NonNull LayoutElementBuilders.LayoutElement |
materialScopeWithResources(Creates a top-level receiver scope |
Public methods
materialScope
public static final @NonNull LayoutElementBuilders.LayoutElement materialScope(
@NonNull Context context,
@NonNull DeviceParametersBuilders.DeviceParameters deviceConfiguration,
boolean allowDynamicTheme,
@NonNull ColorScheme defaultColorScheme,
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> layout
)
Creates a top-level receiver scope MaterialScope that calls the given layout to support for opinionated defaults and building Material3 components and layout, with default dynamic theme colors defined in dynamicColorScheme.
The colors of elements in this receiver scope will automatically follow colors from the system theme, including whenever user changes the theme. If dynamic color scheme is switched off by user or unavailable on device, defaults to static, default ColorScheme.
| Parameters | |
|---|---|
@NonNull Context context |
The Android Context for the Tile service |
@NonNull DeviceParametersBuilders.DeviceParameters deviceConfiguration |
The device parameters for where the components will be rendered |
boolean allowDynamicTheme |
Whether dynamic colors theme should be used on components, meaning that colors will follow the system theme if enabled on the device. If not set, defaults to using the system theme |
@NonNull ColorScheme defaultColorScheme |
Color Scheme with static colors. The color theme to be used, when |
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> layout |
Scoped slot for the content of layout to be displayed |
materialScopeWithResources
public static final @NonNull LayoutElementBuilders.LayoutElement materialScopeWithResources(
@NonNull Context context,
@NonNull ProtoLayoutScope protoLayoutScope,
@NonNull DeviceParametersBuilders.DeviceParameters deviceConfiguration,
boolean allowDynamicTheme,
@NonNull ColorScheme defaultColorScheme,
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> layout
)
Creates a top-level receiver scope MaterialScope that calls the given layout to support for opinionated defaults and building Material3 components and layout, with default dynamic theme colors defined in dynamicColorScheme and automatic resource registration for Image elements created with ProtoLayoutScope.
The colors of elements in this receiver scope will automatically follow colors from the system theme, including whenever user changes the theme. If dynamic color scheme is switched off by user or unavailable on device, defaults to static, default ColorScheme.
| Parameters | |
|---|---|
@NonNull Context context |
The Android Context for the Tile service |
@NonNull ProtoLayoutScope protoLayoutScope |
The |
@NonNull DeviceParametersBuilders.DeviceParameters deviceConfiguration |
The device parameters for where the components will be rendered |
boolean allowDynamicTheme |
Whether dynamic colors theme should be used on components, meaning that colors will follow the system theme if enabled on the device. If not set, defaults to using the system theme |
@NonNull ColorScheme defaultColorScheme |
Color Scheme with static colors. The color theme to be used, when |
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> layout |
Scoped slot for the content of layout to be displayed |