Repository navigation
fix: accept snake_case curve and enum names from Ruby - #63
Merged
Merged
Conversation
parseCurve lowercased the name but kept underscores, so Ruby's "ease_in_out" silently fell back to the default curve, and "linear" (the Ruby AnimatedSwitcher default) was missing from the table. Unknown curve names now print a warning before falling back. parseEnum and the hand-written name tables in core utils (keyboard types, mouse cursors, autofill hints and actions, visual density, page transitions, markdown extension sets, FAB locations) had the same gap. They now compare names through normalizeEnumName: case-insensitive with underscores removed, so camelCase and snake_case both match.
This was referenced Oct 28, 2026
AdamMusa
pushed a commit
that referenced
this pull request
Nov 3, 2026
Review of #74 found two Material ContextMenu gaps. Both are already closed in the merged code; this pins the one that had no test. - An items-only menu (Ruby's ContextMenu sends `items` and the per-trigger lists, never `actions`): #78 made the Material renderer fall back to `items` before `actions` for every trigger and for a programmatic open, and ruby_material_context_menu_items_test.dart covers the right-click case. - `primary_trigger: "long_press"`: parseContextMenuTrigger goes through the shared parseEnum, which #63 made compare names without case or underscores, so Material accepts Ruby's spelling as iOS does. Nothing tested it on Material. ruby_context_menu_trigger_items_test.dart now long-presses a menu with `primary_trigger` "long_press" and "longPress" on iOS and Android: each shows `primary_items` (not `secondary_items`) and selecting reports b: primary, tr: longPress. With parseEnum as it was before #63 the Android "long_press" case fails (no menu opens). Context menu tests and test/architecture: 317/317. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MqfxcsDiEUZngybe9L72JQ
AdamMusa
pushed a commit
that referenced
this pull request
Nov 3, 2026
Follow-up to #63 (snake_case curve names). parseCurve's table listed every Flutter Curves constant except fastEaseInToSlowEaseOut, so `curve: "fast_ease_in_to_slow_ease_out"` (or the camelCase name) printed "unknown curve" and fell back to the default. It is in the table now. enum_name_parsing_test.dart lists all 42 public Curves constants and checks that each parses, by its snake_case and its Dart name, to that very constant without a warning; this fails without the fix (the warning for fast_ease_in_to_slow_ease_out). A second test reads the Curves class from the Flutter SDK source this package resolves (via .dart_tool/package_config.json) and requires the list to match it, so a Flutter upgrade that adds a curve fails until parseCurve knows it. test/architecture plus every test mentioning curves: 361/361. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MqfxcsDiEUZngybe9L72JQ
This was referenced Nov 7, 2026
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.
What
Ruby-style snake_case names now reach the renderer. Before this PR they were silently dropped.
parseCurve(utils/animations.dart) lowercased the name but kept underscores. So"ease_in_out"fell back to the default curve without any message. Forscroll_toand TabBarmove_tothe default isease, for PageView it is the control'sanimation_curve, and for animation maps it islinear."linear"was also missing from the table. It is the Rubyanimated_switcherdefault forswitch_in_curve/switch_out_curve, andscroll_to(curve: "linear")animated withease.Warning: unknown curve "<name>"; using the default.before falling back.parseEnum(utils/enums.dart), used by 62 call sites in core and 16 in extensions, had the same gap: it compared case-insensitively but kept underscores. SPEC R4 worked around this by asking every new parser toreplaceAll("_", "")itself. Matching now goes through a newnormalizeEnumName(lowercase, underscores removed) on both sides."space_between","spaceBetween"and"SPACE_BETWEEN"all matchMainAxisAlignment.spaceBetween. Exact and case-insensitive matches behave as before.normalizeEnumName(value):parseTextInputType)parseMouseCursor)theme.dart)Single-word name matches (
PointMode,TargetPlatform, AnimatedSwitchertransition) have no multi-word names and are left unchanged.Not in this PR (same gap, separate packages)
These extension packages compare enum names inline with
e.name.toLowerCase() == value.toLowerCase()instead of using the coreparseEnum. Each line can becomeparseEnum(X.values, value, default), which now normalizes. I left them out to keep this core fix small; they are a follow-up.ruflet_ads/lib/utils/native.dart:8,16ruflet_audio/lib/src/utils/audio.dart:7ruflet_audio_recorder/lib/src/utils/audio_recorder.dart:8,21,40ruflet_charts/lib/src/utils/bar_chart.dart:57,239,charts.dart:209,radar_chart.dart:12ruflet_datatable2/lib/src/utils/datatable.dart:9ruflet_geolocator/lib/src/utils/geolocator.dart:10,34ruflet_map/lib/src/utils/attribution_alignment.dart:8,map.dart:31,172,210ruflet_secure_storage/lib/src/utils/secure_storage.dart:90,97,104,111ruflet_video/lib/src/utils/video.dart:133ruflet_map's curves already go through the coreparseCurve, so they are fixed here.Tests
New
test/utils/enum_name_parsing_test.dart(9 tests):parseCurve:easeInOut,ease_in_out,EASE_IN_OUT,easeinout,fast_out_slow_in,ease_in_out_cubic_emphasized, …)linearresolvesnullreturns the default without a warningwobbly,ease_wobble) return the default ornulland print exactly one warning, captured viadebugPrintparseAnimationandparseAnimationStyleread snake_casecurveandreverse_curveparseEnum:MainAxisAlignment,Clip.antiAliasWithSaveLayerandScrollViewKeyboardDismissBehavior.onDragnullnames keep the defaultstreet_address,all_scroll,telephone_number_national,adaptive_platform_density,fade_upwards,github_flavoredandcenter_dockedresolve, and misspelled names still fall back.AnimatedSwitcherwithswitch_in_curve: "ease_out_back"andswitch_out_curve: "fast_out_slow_in"buildsAnimatedSwitcherwith those curves.team/verify_pr.sh <engine> ""withEXT_PKGS="ruflet_map ruflet_color_pickers ruflet_spinkit"(the extensions that call the core parsers):packages/rufletflutter test(Flutter 3.41.2): +704, all passed (baseline 695 + 9 new).flutter analyze lib test: No issues found. These two steps are the default verify scope, and both pass.ruflet_map,ruflet_spinkit: tests pass, analyze clean.ruflet_color_pickers: tests pass (+7). Its analyze reports 126 issues, all already present on basec9b9d76(same count there; deprecatedColor.value/withOpacityand similar). They are unrelated to this change, which touches no file in that package. This is why the script's overall line says FAIL.Engine-only change; no Ruby counterpart is needed. Ruby already sends these names.