Skip to content

Use font size from IDE in theme (WIP)#2459

Closed
helin24 wants to merge 4 commits intoflutter:masterfrom
helin24:fontsize
Closed

Use font size from IDE in theme (WIP)#2459
helin24 wants to merge 4 commits intoflutter:masterfrom
helin24:fontsize

Conversation

@helin24
Copy link
Member

@helin24 helin24 commented Oct 23, 2020

This passes font size from URL parameters and scales all text to the input size. I assumed based on https://api.flutter.dev/flutter/material/TextTheme-class.html that size 14 is default for body text, and visually it looks like if I pass in ?fontSize=14 things are unchanged.

Examples:

?fontSize=10
Screen Shot 2020-10-28 at 2 20 54 PM
Screen Shot 2020-10-28 at 2 56 21 PM

`?fontSize=20
Screen Shot 2020-10-28 at 2 21 23 PM
Screen Shot 2020-10-28 at 2 55 58 PM

@kenzieschmoll
Copy link
Member

Line heights, e.g. inspector_tree.dart seems to use rowHeight = 24.0; - maybe there's something related to font size scaling that I could access from theme to fix? Not sure.

Instead of using rowHeight consts like 24.0, could you do fontSize + 8.0 or something like that?

import 'ui/theme.dart';

const DEFAULT_FONT_SIZE = 14.0;
var fontSizeFactor = 1.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this data should not be stored as a top level field like this as that could easily cause problems due to being fragile.
For example, now the themeFor method has a surprising side effect.
It is better to use the font sizes froom the existing textTheme part of a theme.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to use the theme to find the font size, but it looked like this would mean passing it through a lot of logic for generating inspector rows. Is there any way around doing that?

@helin24
Copy link
Member Author

helin24 commented May 22, 2021

Closing in favor of #3054

@helin24 helin24 closed this May 22, 2021
@helin24 helin24 deleted the fontsize branch May 22, 2021 00:03
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

Successfully merging this pull request may close these issues.

3 participants