Skip to content

Assertion failure when setting font size #5912

Description

@DanTup

While trying to debug #5911, I see these assertion failures when passing some fontSize values on the querystring:

http://localhost:65501/inspector?uri=ws://127.0.0.1:62171/1Bf7h481aGI=/ws&theme=light&backgroundColor=%23ffffff&foregroundColor=%23000000&fontSize=12

Screenshot 2023-06-13 at 16 33 42

It seems to be coming from code in theme.dart like this:

primaryTextTheme: theme.primaryTextTheme
    .merge(colorTheme.primaryTextTheme)
    .apply(fontSizeFactor: ideTheme.fontSizeFactor),

The apply methods have this assertion:

assert(fontSize != null || (fontSizeFactor == 1.0 && fontSizeDelta == 0.0));

I can trigger it by adding code like:

  theme.primaryTextTheme
      .merge(colorTheme.primaryTextTheme)
      .apply(fontSizeFactor: 1.2);

But I'm not sure I understand what the assertion is trying to enforce from the code or what the fix is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3issues we think are valid but not importantbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions