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

AutoSizeText not working as expected #199

Open
tyler-jewell opened this issue Jan 26, 2024 · 0 comments
Open

AutoSizeText not working as expected #199

tyler-jewell opened this issue Jan 26, 2024 · 0 comments

Comments

@tyler-jewell
Copy link
Contributor

Describe the bug
min/maxFontSize not working as expected.

  1. See screenshots below on how it's not working as expected.
  2. From following the code, this all depends on the _isIntrinsic field in VxTextBuilder.
/// lib/src/flutter/text.dart
bool _isIntrinsic = false;

and then there is this for the getter:

/// lib/src/flutter/text.dart (line 86)
/// [LayoutBuilder] does not support using IntrinsicWidth or IntrinsicHeight.
///
/// Note: Use it only for few widgets like [DataTable], [IntrinsicWidth] or
/// [IntrinsicHeight] etc which doesn't work well with Vx
/// but using [isIntrinsic] will disable [AutoSizeText].
VxTextBuilder get isIntrinsic => this.._isIntrinsic = true;

I'm not entirely sure what is going on here. How exactly is it decided if _isIntrinsic?

To Reproduce
Steps to reproduce the behavior:

class MyPage extends StatelessWidget {
  /// Create the view.
  const MyPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Container(
        color: Vx.amber400,
        height: 300,
        width: 200,
        child: '123 y'.text.minFontSize(20).maxFontSize(100).makeCentered(),
      ),
    );
  }
}

image

Expected behavior
I would expect that the text would have a font size of 100.

class MyPage extends StatelessWidget {
  /// Create the view.
  const MyPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Container(
        color: Vx.amber400,
        height: 300,
        width: 200,
        child: '123 y'.text.size(100).makeCentered(),
      ),
    );
  }
}

image

Desktop (please complete the following information):

  • OS: macos
  • Browser chrome
  • Version velocity_x: ^4.1.2, vxstate: ^2.3.0

Additional context
Add any other context about the problem here.

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