Skip to content

Commit

Permalink
Feature: Add missing parameters from MaterialTheme (#75)
Browse files Browse the repository at this point in the history
* Add missing parameters from MaterialTheme

* run apiDump
  • Loading branch information
jordond authored Jan 16, 2024
1 parent e8288cc commit 00f0a50
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
5 changes: 3 additions & 2 deletions material-kolor/api/android/material-kolor.api
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ public final class com/materialkolor/DynamicColorSchemeKt {
}

public final class com/materialkolor/DynamicMaterialThemeKt {
public static final fun AnimatedDynamicMaterialTheme-ZPw9REg (JZLcom/materialkolor/PaletteStyle;DLandroidx/compose/animation/core/AnimationSpec;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
public static final fun DynamicMaterialTheme-yWKOrZg (JZLcom/materialkolor/PaletteStyle;DLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
public static final fun AnimatedDynamicMaterialTheme-pzZJ40c (JZLcom/materialkolor/PaletteStyle;DLandroidx/compose/animation/core/AnimationSpec;Landroidx/compose/material3/Shapes;Landroidx/compose/material3/Typography;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
public static final fun DynamicMaterialTheme-Pd0R-II (JZLcom/materialkolor/PaletteStyle;DLandroidx/compose/material3/Shapes;Landroidx/compose/material3/Typography;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
}

public final class com/materialkolor/LocalDynamicMaterialThemeSeedKt {
Expand All @@ -22,6 +22,7 @@ public final class com/materialkolor/PaletteStyle : java/lang/Enum {
public static final field Rainbow Lcom/materialkolor/PaletteStyle;
public static final field TonalSpot Lcom/materialkolor/PaletteStyle;
public static final field Vibrant Lcom/materialkolor/PaletteStyle;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lcom/materialkolor/PaletteStyle;
public static fun values ()[Lcom/materialkolor/PaletteStyle;
}
Expand Down
5 changes: 3 additions & 2 deletions material-kolor/api/jvm/material-kolor.api
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ public final class com/materialkolor/DynamicColorSchemeKt {
}

public final class com/materialkolor/DynamicMaterialThemeKt {
public static final fun AnimatedDynamicMaterialTheme-ZPw9REg (JZLcom/materialkolor/PaletteStyle;DLandroidx/compose/animation/core/AnimationSpec;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
public static final fun DynamicMaterialTheme-yWKOrZg (JZLcom/materialkolor/PaletteStyle;DLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
public static final fun AnimatedDynamicMaterialTheme-pzZJ40c (JZLcom/materialkolor/PaletteStyle;DLandroidx/compose/animation/core/AnimationSpec;Landroidx/compose/material3/Shapes;Landroidx/compose/material3/Typography;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
public static final fun DynamicMaterialTheme-Pd0R-II (JZLcom/materialkolor/PaletteStyle;DLandroidx/compose/material3/Shapes;Landroidx/compose/material3/Typography;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
}

public final class com/materialkolor/LocalDynamicMaterialThemeSeedKt {
Expand All @@ -22,6 +22,7 @@ public final class com/materialkolor/PaletteStyle : java/lang/Enum {
public static final field Rainbow Lcom/materialkolor/PaletteStyle;
public static final field TonalSpot Lcom/materialkolor/PaletteStyle;
public static final field Vibrant Lcom/materialkolor/PaletteStyle;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lcom/materialkolor/PaletteStyle;
public static fun values ()[Lcom/materialkolor/PaletteStyle;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import androidx.compose.animation.core.spring
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Shapes
import androidx.compose.material3.Typography
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.derivedStateOf
Expand All @@ -20,6 +22,8 @@ public fun DynamicMaterialTheme(
useDarkTheme: Boolean = isSystemInDarkTheme(),
style: PaletteStyle = PaletteStyle.TonalSpot,
contrastLevel: Double = 0.0,
shapes: Shapes = MaterialTheme.shapes,
typography: Typography = MaterialTheme.typography,
content: @Composable () -> Unit,
) {
val colorScheme: ColorScheme by remember(seedColor, useDarkTheme, style, contrastLevel) {
Expand All @@ -34,7 +38,12 @@ public fun DynamicMaterialTheme(
}

CompositionLocalProvider(LocalDynamicMaterialThemeSeed provides seedColor) {
MaterialTheme(colorScheme = colorScheme, content = content)
MaterialTheme(
colorScheme = colorScheme,
shapes = shapes,
typography = typography,
content = content,
)
}
}

Expand All @@ -45,6 +54,8 @@ public fun AnimatedDynamicMaterialTheme(
style: PaletteStyle = PaletteStyle.TonalSpot,
contrastLevel: Double = 0.0,
animationSpec: AnimationSpec<Color> = spring(stiffness = Spring.StiffnessLow),
shapes: Shapes = MaterialTheme.shapes,
typography: Typography = MaterialTheme.typography,
content: @Composable () -> Unit,
) {
val colors: ColorScheme by remember(seedColor, useDarkTheme, style, contrastLevel) {
Expand Down Expand Up @@ -77,6 +88,11 @@ public fun AnimatedDynamicMaterialTheme(
)

CompositionLocalProvider(LocalDynamicMaterialThemeSeed provides seedColor) {
MaterialTheme(colorScheme = animatedColorScheme, content = content)
MaterialTheme(
colorScheme = animatedColorScheme,
shapes = shapes,
typography = typography,
content = content,
)
}
}

0 comments on commit 00f0a50

Please sign in to comment.