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

FlexSpecAttribute does not resolve gap.ref() #326

Closed
qoob23 opened this issue Jun 25, 2024 · 2 comments
Closed

FlexSpecAttribute does not resolve gap.ref() #326

qoob23 opened this issue Jun 25, 2024 · 2 comments
Assignees

Comments

@qoob23
Copy link

qoob23 commented Jun 25, 2024

Package version

1.1.0

Flutter version

Flutter 3.22.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 761747bfc5 (3 weeks ago) • 2024-06-05 22:15:13 +0200
Engine • revision edd8546116
Tools • Dart 3.4.3 • DevTools 2.34.3

Steps to reproduce

Use $flex.gap.ref() inside Style

Expected results

SpaceToken resolves according to MixThemeData from context.

Actual results

SizedBox inside StyledFlex has negative width because SpaceToken.resolve() is never called, and SpaceToken.call() returns hashcode * -1 (which is used in MixTokenResolver and SpaceRef)

Code sample

Code sample
    return MixTheme(
      data: MixThemeData(spaces: {
        $token.space.small: 8,
      }),
      child: Builder(builder: (context) {
        return StyledFlex(
          direction: Axis.horizontal,
          style: Style(
            $flex.gap.ref($token.space.small), // negative gap
            // $flex.gap($token.space.small.resolve(context)), // works fine
          ),
          children: const [
            Text('Text1'),
            Text('Text2'),
          ],
        );
      }),
    );
@tilucasoli
Copy link
Collaborator

Thank you for your contribution 😊.

I opened a PR to solve this issue.

@leoafarias
Copy link
Member

#327 Closes by

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

3 participants