Repository navigation
Add Modifier support (Phase 1: Padding + FillMax*) - #23
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-phase support for Jetpack Compose Modifier to the C# facade by introducing a fluent, immutable ComposeNet.Modifier chain and threading an optional modifier through the facade composables and their JNI bridges. This unblocks basic layout styling (padding and fillMax*) and updates the sample to restore the content gutter regression introduced in #19.
Changes:
- Introduces
ComposeNet.Modifier(Padding + FillMax*) and runtime materialization via JNI at render time. - Plumbs an optional
ModifierthroughComposableNodeand most public composables/bridges, including$defaultbitmask handling when a modifier is provided. - Updates the sample to apply
Modifier.Companion.Padding(16)to the Scaffold body rootColumn.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ComposeNet.Sample/MainActivity.cs | Applies padding modifier to restore sample UI gutter in Scaffold body. |
| src/ComposeNet.Compose/Tooltip.cs | Builds/passes modifier and updates default-bitmask handling for TooltipBox. |
| src/ComposeNet.Compose/TimePickerDialog.cs | Builds/passes modifier and clears modifier bit in defaults when present. |
| src/ComposeNet.Compose/TimePicker.cs | Adds modifier support to TimePicker bridge invocation and defaults mask. |
| src/ComposeNet.Compose/TextField.cs | Passes built modifier through to the TextField JNI bridge. |
| src/ComposeNet.Compose/Text.cs | Passes built modifier through to the Text JNI bridge. |
| src/ComposeNet.Compose/Surface.cs | Passes built modifier through to the Surface JNI bridge. |
| src/ComposeNet.Compose/SuggestionChip.cs | Adds modifier parameter/default-bit handling for SuggestionChip. |
| src/ComposeNet.Compose/Scaffold.cs | Adds modifier support and defaults-bit handling for Scaffold. |
| src/ComposeNet.Compose/OutlinedTextField.cs | Passes built modifier through to the OutlinedTextField JNI bridge. |
| src/ComposeNet.Compose/NavigationRailItem.cs | Adds modifier parameter/default-bit handling for NavigationRailItem. |
| src/ComposeNet.Compose/NavigationRail.cs | Passes built modifier through to the NavigationRail JNI bridge. |
| src/ComposeNet.Compose/NavigationBarItem.cs | Adds modifier parameter/default-bit handling for NavigationBarItem. |
| src/ComposeNet.Compose/NavigationBar.cs | Passes built modifier through to the NavigationBar JNI bridge. |
| src/ComposeNet.Compose/Modifier.cs | New fluent modifier chain type + render-time JNI materialization. |
| src/ComposeNet.Compose/ModalBottomSheet.cs | Adds modifier support and defaults-bit handling for ModalBottomSheet. |
| src/ComposeNet.Compose/InputChip.cs | Adds modifier parameter/default-bit handling for InputChip. |
| src/ComposeNet.Compose/IconButton.cs | Passes built modifier through to the IconButton JNI bridge. |
| src/ComposeNet.Compose/FloatingActionButton.cs | Passes built modifier through to the FAB JNI bridge. |
| src/ComposeNet.Compose/FilterChip.cs | Adds modifier parameter/default-bit handling for FilterChip. |
| src/ComposeNet.Compose/DatePickerDialog.cs | Adds modifier support and defaults-bit handling for DatePickerDialog. |
| src/ComposeNet.Compose/DatePicker.cs | Adds modifier support for DatePicker bridge invocation and defaults mask. |
| src/ComposeNet.Compose/ComposeBridges.cs | Adds modifier building helpers + threads IModifier? through many JNI bridges and updates $default masks accordingly. |
| src/ComposeNet.Compose/ComposableNode.cs | Adds Modifier property and BuildModifier() helper for render-time materialization. |
| src/ComposeNet.Compose/ComposableContainer.cs | Adds Add(Modifier) overload to allow setting modifier in collection initializers. |
| src/ComposeNet.Compose/Column.cs | Passes modifier through to bound ColumnKt.Column and updates default-bitmask handling. |
| src/ComposeNet.Compose/Card.cs | Passes built modifier through to the Card JNI bridge. |
| src/ComposeNet.Compose/Button.cs | Passes built modifier through to the Button JNI bridge. |
| src/ComposeNet.Compose/BottomSheetScaffold.cs | Adds modifier support and defaults-bit handling for BottomSheetScaffold. |
| src/ComposeNet.Compose/AssistChip.cs | Adds modifier parameter/default-bit handling for AssistChip. |
| src/ComposeNet.Compose/AlertDialog.cs | Adds modifier support and defaults-bit handling for AlertDialog. |
Implements issue #21 Phase 1: a Modifier C# builder mirroring Kotlin's chained Modifier.foo().bar() API, threaded through every public composable. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
jonathanpeppers
force-pushed
the
jonathanpeppers/modifier-support
branch
from
June 3, 2026 20:55
5b73c48 to
44e06db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Phase 1 of #21.
What
Introduces a C#
Modifierbuilder that mirrors Kotlin's chainedModifier.foo().bar()API and threads through every public composable in the facade. With this PR users can finally style layout — starting with the padding/fill ops needed to fix the regression from #19 (tab content flush against the screen edges).API
ComposeNet.Modifiertype withCompanion,Padding(int),Padding(int h, int v),Padding(int l, int t, int r, int b),FillMaxWidth(float = 1f),FillMaxHeight(float = 1f),FillMaxSize(float = 1f). Each op returns a new immutableModifierso the chain is reusable.internal IModifier? Build()materializes the chain atRendertime via JNI:Modifier.Companion.$$INSTANCEresolved viaJNIEnv.GetStaticFieldID, then each op invokes the matching Kotlin static (PaddingKt.padding-3ABfNKs/-VpY3zN4/-qDBjuR0,SizeKt.fillMaxWidth/Height/Size).ComposableNode.Modifier { get; set; }— every composable accepts an optional modifier.Setting
Modifieron containers vs. leavesC# disallows mixing object-init assignments with collection-init items in the same
{ }. Leaves (Text, Button, …) keep object-init syntax:For containers that derive from
ComposableContainer(Column, Card, Surface, Scaffold, …) I added anAdd(Modifier)overload so the modifier is set inline alongside children — the canonical C# trick for this situation:Wiring
ComposeBridges.cs: addedModifierHandle/ModifierCompanionInstance/ModifierPadding{All,HV,LTRB}/ModifierFillMax{Width,Height,Size}JNI helpers, and threaded anIModifier? modifierparameter through every existing bridge (Text, Button, IconButton, FAB, Surface, Card, TextField/OutlinedTextField, AlertDialog, ModalBottomSheet, BottomSheetScaffold, Scaffold, DatePicker(Dialog), TimePicker(Dialog), Tooltip, *Chip, NavigationBar(Item), NavigationRail(Item)).Rendernow callsBuildModifier()and clears theModifierbit in its$defaultmask when the user supplied one.Columnuses the boundColumnKt.Columndirectly (no JNI bridge), so it just passes the modifier through.Sample
MainActivity.csaddsModifier.Companion.Padding(16)to the Scaffold body's rootColumn, restoring the horizontal gutter that was dropped in #19 while leaving the BottomBar flush against the edges.Phase 2+ (out of scope)
Background,Border,Clip,Clickable, gestures, size constraints, window-insets — to follow as separate issues / PRs.Verification
dotnet test src/ComposeNet.SourceGenerators.Tests— 10/10 passing.dotnet build src/ComposeNet.Compose— clean.dotnet build src/ComposeNet.Sample— clean.Closes #21 (Phase 1).