Repository navigation
Description
Background
In Xamarin.AndroidX.Compose.Material3Android (verified against
1.4.0.3), the ShapesKt companion class only exposes the
LocalShapes CompositionLocal accessor — the public
Shapes(small, medium, large, extraSmall, extraLarge) builder
function is missing entirely:
// AndroidX.Compose.Material3.ShapesKt (full method list)
get_class_ref() -> IntPtr
get_JniPeerMembers() -> JniPeerMembers
get_ThresholdClass() -> IntPtr
get_ThresholdType() -> Type
get_LocalShapes() -> ProvidableCompositionLocal
.ctor(IntPtr, JniHandleOwnership) -> Void
.cctor() -> Void
// ^ no Shapes(...) builderUpstream Kotlin (androidx.compose.material3.ShapesKt):
fun Shapes(
extraSmall: CornerBasedShape = ShapeDefaults.ExtraSmall,
small: CornerBasedShape = ShapeDefaults.Small,
medium: CornerBasedShape = ShapeDefaults.Medium,
large: CornerBasedShape = ShapeDefaults.Large,
extraLarge: CornerBasedShape = ShapeDefaults.ExtraLarge,
): ShapesNotably none of the parameters are inline-class types — they're
all reference types (CornerBasedShape). So this is not the same
JVM-mangling story as Text--4IGK_g / Button-bWB7cM8 /
lightColorScheme(-...) from
dotnet/java-interop#1440. This looks like a real binder
bug or an overly broad <remove-node> rule in
material3-android/Transforms/Metadata.xml.
The same package does expose:
MaterialThemeKt.MaterialTheme(ColorScheme, Shapes, Typography, …)ColorSchemeKt.LightColorScheme(Int64×47)/
DarkColorScheme(Int64×47)MaterialTheme.GetShapes(IComposer, Int32)companion accessornew Shapes()parameterless ctor (so callers can take the
Compose default)
— so the type Shapes is fully bound and consumable; only the
factory function that lets you build a customized Shapes with
the standard defaults is missing. This blocks
jonathanpeppers/compose-net#61 (parameterizing
MaterialTheme).
Ask
Find and remove the <remove-node> (or equivalent
<remove-method>) in material3-android/Transforms/Metadata.xml
that's stripping the Shapes(...) static builder out of
ShapesKt, then bump nugetVersion on
Xamarin.AndroidX.Compose.Material3Android.
If the strip is intentional because of a related binder issue
(e.g. CornerBasedShape not yet being resolvable at the right
binding-pipeline stage), please flag that as the underlying root
cause so we can track it separately.
Verification
After the fix, this should compile:
using AndroidX.Compose.Material3;
using AndroidX.Compose.Foundation.Shape;
Shapes shapes = ShapesKt.Shapes(
extraSmall: RoundedCornerShapeKt.RoundedCornerShape(2),
small: RoundedCornerShapeKt.RoundedCornerShape(4),
medium: RoundedCornerShapeKt.RoundedCornerShape(8),
large: RoundedCornerShapeKt.RoundedCornerShape(12),
extraLarge: RoundedCornerShapeKt.RoundedCornerShape(16));
Activity
Add Color struct and parameterise MaterialTheme (refs #61) (#133)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61) (#177)
Rebuild Compose.Material3.Android to pick up CornerBasedShape APIs (#…