This pull request is not directly related to any open issues.
Description
This pull request introduces support for a fluent API in the Mix library. The fluent API allows for more expressive and readable code when working with Mix specifications and utilities. It enables chaining of method calls and provides a more intuitive way to configure and build Mix components.
The fluent API support brings the following improvements:
Simplified and more concise code when defining Mix specifications.
Improved readability and maintainability of the codebase.
Enhanced developer experience and productivity.
Changes
The key changes made in this pull request include:
Modified the SpecUtility class to support fluent behavior and mutable state.
Updated the generated utility classes for various Mix specifications (BoxSpecUtility, FlexSpecUtility, ImageSpecUtility, IconSpecUtility, TextSpecUtility, StackSpecUtility) to include fluent methods and constructors.
Added a builder getter in the utility classes to enable mutable behavior.
Modified the MixUtilities class to provide a more concise and consistent API for accessing Mix utilities.
Updated the specUtilityClass function in the Mix generator to generate the necessary code for the fluent API.
Added comprehensive tests for the fluent API functionality in the corresponding test files for each Mix specification.
The fluent API allows developers to chain method calls and build Mix components in a more expressive and readable manner. For example:
final box = BoxSpecUtility.self;
final util = box.chain
..alignment.center()
..padding(8);
final style = Style(util);
In the above code snippet, the chain getter is used to create a mutable BoxSpecUtility instance, and the fluent methods alignment.center() and padding(8) are chained to configure the box specification.
The tests added in this pull request ensure the correctness and expected behavior of the fluent API across different Mix specifications.
Please review the changes and provide any feedback or suggestions for improvement.
Review Checklist
[x] Testing: Have you tested your changes, including unit tests and integration tests for affected code?
[ ] Breaking Changes: Does this change introduce breaking changes affecting existing code or users?
[ ] Documentation Updates: Are all relevant documentation files (e.g. README, API docs) updated to reflect the changes in this PR?
[ ] Website Updates: Is the website containing the updates you make on documentation?
Related issue
This pull request is not directly related to any open issues.
Description
This pull request introduces support for a fluent API in the Mix library. The fluent API allows for more expressive and readable code when working with Mix specifications and utilities. It enables chaining of method calls and provides a more intuitive way to configure and build Mix components.
The fluent API support brings the following improvements:
Changes
The key changes made in this pull request include:
SpecUtility
class to support fluent behavior and mutable state.BoxSpecUtility
,FlexSpecUtility
,ImageSpecUtility
,IconSpecUtility
,TextSpecUtility
,StackSpecUtility
) to include fluent methods and constructors.builder
getter in the utility classes to enable mutable behavior.MixUtilities
class to provide a more concise and consistent API for accessing Mix utilities.specUtilityClass
function in the Mix generator to generate the necessary code for the fluent API.The fluent API allows developers to chain method calls and build Mix components in a more expressive and readable manner. For example:
In the above code snippet, the
chain
getter is used to create a mutableBoxSpecUtility
instance, and the fluent methodsalignment.center()
andpadding(8)
are chained to configure the box specification.The tests added in this pull request ensure the correctness and expected behavior of the fluent API across different Mix specifications.
Please review the changes and provide any feedback or suggestions for improvement.
Review Checklist