Repository navigation
Conversation
…r reads
Several controls gave their default arguments values the Flutter renderer
cannot parse:
- alignment "center" (filled_icon_button, filled_tonal_icon_button,
outlined_icon_button, cupertino_button, cupertino_filled_button,
cupertino_tinted_button, cupertino_timer_picker): the renderer's
parseAlignment reads only {x, y} and threw on the String, so the control
showed Flutter's error widget instead of rendering.
- padding {"all" => 8} (the three icon buttons) and {"all" => 7}
(cupertino_text_field), border_radius {"all" => 8.0} (the three Cupertino
buttons): the renderer reads only per-side and per-corner keys or a
number, so these parsed as zero padding and square corners.
The defaults are now {"x" => 0.0, "y" => 0.0}, per-side padding and
per-corner radii, the shapes Flet sends for Alignment.CENTER,
Padding.all(n) and BorderRadius.all(n). Values an app passes are sent
unchanged. The engine also learns the old shapes (ruflet-engine#118) for
apps on published gems.
Fixes #94
This was referenced Nov 20, 2026
fix: read the alignment, padding and radius shapes Ruby sends as defaults
AdamMusa/ruflet-engine#119
Merged
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.
Fixes #94
What changed
Several controls gave their default arguments values in shapes the Flutter renderer cannot parse. They now send the shapes Flet sends for the same defaults:
filled_icon_button,filled_tonal_icon_button,outlined_icon_buttonalignment: "center",padding: {"all" => 8}{"x" => 0.0, "y" => 0.0},{"left" => 8, "top" => 8, "right" => 8, "bottom" => 8}cupertino_button,cupertino_filled_button,cupertino_tinted_buttonalignment: "center",border_radius: {"all" => 8.0}{"x" => 0.0, "y" => 0.0},{"top_left" => 8.0, "top_right" => 8.0, "bottom_left" => 8.0, "bottom_right" => 8.0}cupertino_timer_pickeralignment: "center"{"x" => 0.0, "y" => 0.0}cupertino_text_fieldpadding: {"all" => 7}{"left" => 7, "top" => 7, "right" => 7, "bottom" => 7}Containeralready sends its"center"shorthand as{x: 0, y: 0}(normalize_container_props). This PR does the same for these defaults.The renderer side is AdamMusa/ruflet-engine#119 (issue AdamMusa/ruflet-engine#118). It teaches the engine the old shapes, so apps on published gems get the fix after a template sync. This PR makes new gems render correctly on today's template without waiting for that sync.
Self-contained (
--self) builds run theruflet_corethat is precompiled into theruby_runtimeVM artifacts. This PR does not rebuild them: the Android.sofiles are the owner's in-progress 16 KB work (D2). Those builds pick up the change when the VM is rebuilt for a release. Server-mode apps pick it up from the gem.How verified
New
packages/ruflet_core/test/default_value_wire_shapes_test.rb:ControlFactorycontrol that takes no arguments (395 of 458) and fails if any default sends an{"all" => n}map.With the
libchanges reverted (bug planted back), that file fails 5 of 6 tests. The guard listscupertino_button.border_radius,cupertino_text_field.padding,filled_icon_button.padding, and the rest.Updated the
*_defaults_match_fletassertions in the cupertino button, timer picker, text field and three icon-button compatibility tests. They had asserted the unparseable values.packages/ruflet_core: all 191 test files pass, oneruby -Ilib -Itest <file>process per file.H1 goldens:
cd packages/ruflet && ruby test/compat/compat.rb --jobs 4checked 234 goldens with no differences. No golden contains these defaults.I mounted the new wire on the unfixed engine parsers (
codex/engine-initializationf44e7df7, flutter 3.41.2, both designs) with a throwaway widget probe. All 16 mounts render with no exception and noErrorWidget:IconButtonpaddingEdgeInsets.all(8), alignmentAlignment.centerCupertinoButtonradiusBorderRadius.circular(8)CupertinoTimerPicker.alignmentAlignment.centerCupertinoTextField.paddingEdgeInsets.all(7)ruflet-template
main(e32c873d) vendors the same parsers and reads these keys at the same call sites (material_icon_button.dart:79-80,cupertino_button.dart:130-136,cupertino_timer_picker.dart:36,cupertino_textfield.dart:352).Behavior changes
All bug fixes (D6).
Crash becomes a rendered control. These controls built with default arguments used to show Flutter's error widget:
main; on the engine default branch also android);They now render, centered.
Icon-button padding. An icon button built with an explicit
alignment:and the default padding used to get 0 padding. It now gets 8, which is Flet's and Flutter's IconButton default.Cupertino button radius. A Cupertino button on iOS built with an explicit
alignment:and the default radius used to get square corners. It now gets radius 8, the engine's own default.cupertino_text_fieldon iOS goes from 0 inner padding to 7. 7 is Flet's, Flutter's and the engine's declared default. This is the most visible change.propsread-back. Code that reads these defaults back fromcontrol.props(for examplebutton.props["alignment"]) now sees the Hash shapes in the table instead of"center"/{"all" => n}.