Improve lookup tables for enums#36
Conversation
WalkthroughThe changes consist of two main updates: the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (2)
lib/src/view_attributes/lookup.dart (1)
1028-1050: Const map contains non-const constructor invocations – this will not compile
_scrollPhysicsIntLookupTableand_scrollPhysicsStringLookupTableare declaredconst, but the values are created with non-const constructor calls (AlwaysScrollableScrollPhysics(),BouncingScrollPhysics(), …).
Inside a const context each element must itself be a const expression.- 0: AlwaysScrollableScrollPhysics(), + 0: const AlwaysScrollableScrollPhysics(),Apply the same
constprefix to every*ScrollPhysics()call in both maps to avoid a compile-time error.lib/src/driver_api/script_def.dart (1)
14-18: Constructor contradicts the class documentation –metashould not berequiredThe docstring (Line 6) says
metais optional, but the newconstconstructor still marks itrequired.
Either change the parameter to optional- const ScriptDefinition({ - required this.sourceCode, - required this.functionName, - required this.meta, - }); + const ScriptDefinition({ + required this.sourceCode, + required this.functionName, + this.meta, + });or update the comment to reflect that
metais mandatory.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
lib/src/driver_api/script_def.dart(1 hunks)lib/src/view_attributes/lookup.dart(45 hunks)
* breaking: DuitDataSource (#32) * experiment - removing attribute support * wip * wip * wip * refacror ViewAttributes class * Added tests * wip * Added early exit from methods * Added new functions for handling JSON parsing results, improved default result return logic, and added table mapping for BlendMode and FloatingActionButtonLocation. * docs * add tests * Added tests * Removed static mapping tables for Clip, TextAlign, TextOverflow and TextWidthBasis in the DuitDataSource class. * Added new methods for JSON processing, including support for textDecorationStyle, fontWeight, fontStyle and other attributes. Improved logic for returning default values and added corresponding tests. * Added tests * Removed unused methods and added new functions to handle theme rules and image filters. Updated tests to check new features and JSON processing logic. * Upd .gitignore * wip * Upd tests, added Tween parser * Removed ventilation methods, added new functions for widget handling. Updated tests to check new features and JSON handling logic. * Refactored functions for creating InputBorder and ShapeBorder from a map, as well as corresponding lookup tables. Simplified logic for selecting the border type. * Added docs * upd actions config * wip * wip * Update test/theme_test.dart Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * clean dead code * fix * Update lib/src/view_attributes/lookup.dart Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Added export of Command.dart file to action_api and removed it from animation_api. Updated data references in DuitDataSource class to use new "stretchModes" key. Fixes to tests to match changes in step data. --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Remote commands API update (#33) * breaking: Themes refactoring (#34) * Registry API update: Added new RefWithTarget class, changed component initialization and registration functions, removed unused files, and improved export structure. Updated tests and removed deprecated topic tokens. * upd workflow * breaking: Reworking the widget model API and simplifying registration of custom widgets (#35) * Removed unused factory_record.dart file and updated component registration logic in DuitRegistry class, removed references to model factories. Updated factory getter methods to match new changes. * Small fix for tweens parser * rm unused API part * Update lib/src/registry_api/registry.dart Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * review fixes * fix --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Improve lootup tables for enums (#36) * Flutter types json encoding (#37) * Added encoding functions for: Duration, Size, EdgeInsets, TextStyle, Color, LinearGradient, BoxShadow, Offset, BoxDecoration, BorderRadius, Border, BorderSide, InputBorder, InputDecoration, VisualDensity, ScrollPhysics, ShapeBorder * wip * Added tests * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Fix tests * Added docs * dart format --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat: action debounce and throttle configuration (#38) * Added execution options for actions: added ExecutionOptions class with throttle and debounce modifiers, updated ServerAction classes and their descendants to support the new options. Updated parsing methods and added corresponding lookup tables for execution modifiers. * - Added test - Refactor DuitDataSource methods with one-line return and fail-fast approach at lookup tables work * fix Color parsers behavior * refactoring: improved color handling in _colorFromList function Changed the typification function of the _colorFromList parameter from List<num> to List, added preprocessing of color data to ensure correct conversion. Updated the corresponding calls in the JSON parsing and processing methods in the DuitDataSource class. * feat: Fragments registration in DuitRegistry (#39) Added a new static method registerFragment for registering fragments by key and a method getFragment for receiving a fragment by key with logging in case of absence. Also added an internal registry of fragments _fragmentRegistry. * Component system refactor (#40) * Components refactoring via JSON patching instead of Map mutation * Added tests for json patching and components patches generation * Review fixes * Upd lookup table for Curves * Remover legacy API references * feat: DuitDataSource methods extension (#41) * Extend parser for BorderRadius type, added Radius type parsing, upd tests * fix tests * Added new Size parsing behavior * wip * feat: Custom json reviver (#42) * Refactor env variables, refactor analysis issues in test files, added FlutterPropertyKeys class * wip * wip * wip * Fixed analysis issues * wip * Fixed getActionDependencies and childObjects methods * Upd env variables keys * Code review fixes * Fix test * Upd post-merge workflow
Summary by CodeRabbit
New Features
Refactor