okuna-app icon indicating copy to clipboard operation
okuna-app copied to clipboard

Add central TextStyle

Open 999eagle opened this issue 5 years ago • 3 comments

This PR adds a default TextStyle and some helper methods to the ThemeService and replaces (I hope) all uses of TextStyle(...) with one of the helper methods from the ThemeService. I have also added the free font DejaVu Sans as default fallback, but feel free to change that font.

The default font and font fallbacks can now be changed in a single central location (well, actually in lib/main.dart and lib/services/theme.dart). With this change we don't have to rely on the OS supplying Unicode characters and can make sure that even older devices without up to date Unicode fonts can render user names and posts containing newer Unicode characters.

999eagle avatar Aug 14 '19 13:08 999eagle

🤔 hmm, maybe Im missing something but I still think we should create a OBTextStyle widget here for this use case. Which will accept all the optional params that the flutter TextStyle does, and just pass them along setting the default fontfamily that you need for desktop/mobile along the way. We do this to handle theming for many existing widgets, for eg. check OBText which uses the current primary theme color and renders some text.

We also have a OBSecondaryText widget to reflect that the text should take the current active themes secondary color.

This widget wrapper is IMO better than having to pull this information from the themeService each time and merging with the other custom styles.

@lifenautjoe thoughts?

uiboy avatar Aug 17 '19 10:08 uiboy

Yeah, I've implemented this for those two widgets as well, but the basic Text is used very often instead of the OBText and OBSecondaryText widgets, so I wanted to keep it that way. If you want, I can change this of course to use the custom widgets instead of flutter's Text widget.

999eagle avatar Aug 17 '19 15:08 999eagle

@uiboy @lifenautjoe any update on how to proceed?

999eagle avatar Aug 31 '19 17:08 999eagle