Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SpaceResolver. #539

Open
4 tasks
Tracked by #536
tilucasoli opened this issue Dec 3, 2024 · 1 comment
Open
4 tasks
Tracked by #536

Implement SpaceResolver. #539

tilucasoli opened this issue Dec 3, 2024 · 1 comment

Comments

@tilucasoli
Copy link
Collaborator

tilucasoli commented Dec 3, 2024

Description:

Currently, the framework lacks a token resolver for SpaceToken, which could manage spacing values like margins, paddings, and gaps. This task involves implementing a SpaceResolver .

User Story:

As a developer using the framework,
I want to resolve and apply standardized space tokens,
so that I can create dynamically resolve the token values.

Acceptance Criteria:

  • Design and implement a SpaceResolver to handle spacing tokens based on BuildContext.
  • Ensure the resolver is following the same structure of others TokenResolver.
  • Write tests to validate the SpaceResolver functionality.
  • Update documentation to include instructions for using the SpaceResolver.

API Reference

MixThemeData(
  spaces: {
    spaceToken: SpaceResolver((context) {
      if (MediaQuery.of(context).size.width > 600) {
        return 16.0;
      }
      return 8.0;
    }),
  },
);
@tilucasoli
Copy link
Collaborator Author

The issue we are facing is that all Resolvers were developed by extending the Token type. For example, the ColorResolver is an extension of the Color type, allowing it to be used as a color and resolved when needed. However, for Space, which is represented by a double, we encounter a problem. Since double is a final class, it CANNOT be extended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant