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

feat: allow overriding text style for rich text #41

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

CazSaa
Copy link
Contributor

@CazSaa CazSaa commented Aug 21, 2024

This PR adds functionality to override TextStyle for RichTextLeafMarkable.

@CazSaa CazSaa mentioned this pull request Aug 21, 2024
@PhiFry
Copy link
Collaborator

PhiFry commented Aug 21, 2024

Thank you for your submission! Do you want to provide a specific change that you needed for your use case? For example to change the font or color etc. Just so I can get an idea of what users of this library might want to customize in the future. Thank you.

@CazSaa
Copy link
Contributor Author

CazSaa commented Aug 22, 2024

We used it like this:

textStyleOverrides: (RichTextLeafMarkable leaf) =>
    TextStyle(
  color: CustomTheme.primaryColor,
  fontWeight: leaf.isBold || leaf.link != null
      ? FontWeight.bold
      : FontWeight.normal,
)

to set our own text colour, and to make links bold.

Copy link
Collaborator

@PhiFry PhiFry left a comment

Choose a reason for hiding this comment

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

Its a simple solution for the problem. Code looks good 👍

@PhiFry PhiFry merged commit 603f3b7 into alsterverse:main Sep 3, 2024
1 check failed
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.

2 participants