andyduke / styled_text_package

Text widget with formatted text using tags. Makes it easier to use formatted text in multilingual applications.
https://pub.dev/packages/styled_text
BSD 3-Clause "New" or "Revised" License
74 stars 48 forks source link

Base Style for untagged text #63

Closed pahtz closed 1 year ago

pahtz commented 1 year ago

It would be nice to have a baseStyle: for untagged text so you don't have to wrap everything in a tag to get a default style.

Update: Oh, I can use the StyledText(style: TextStyle(...)) parameter.

andyduke commented 1 year ago

@pahtz You can set the base style with the style parameter in the StyledText constructor:

StyledText(
  text: 'Test: <bold>bold</bold> text.',
  style: TextStyle(color: Colors.red), // default text style
  tags: {
    'bold': StyledTextTag(style: TextStyle(fontWeight: FontWeight.bold)),
  },
)