Skip to content

Add Fields to Control Uniform Line Height for Span in flutter-quill #2555

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wangjinshan
Copy link

This pull request introduces two additional fields to control the uniform line height for the RichText widget in the flutter-quill package. The goal is to enhance the text rendering by enabling a fixed line height using the StrutStyle properties, which can be controlled via forceStrutHeight and leadingOffset. This update ensures that the line height is consistent across multiple TextSpan widgets, providing better visual alignment when rendering text.

Modifications:
1. Added the strutStyle: A StrutStyle is created from the textSpan.style (or a default TextStyle) to apply a fixed line height.
• forceStrutHeight: Ensures the strut height is enforced, even if it would normally be overridden.
• leading: This controls the leading offset (the space between lines of text).
2. RichText Widget Update: The strutStyle is applied to the RichText widget to manage text rendering with the specified line height and spacing.

Code Changes:

in commit

Rationale:
• Control over Line Height: The primary reason for this change is to allow better control over the line height for text spans in flutter-quill. By adding these fields, we ensure that the line height is consistent and can be adjusted per use case.
• Improved Text Layout: This change makes it easier to handle cases where consistent vertical spacing is required between lines of text, especially for rich text editing use cases.

Potential Impact:

This modification is non-breaking, as it only introduces additional properties that can be customized. It ensures better control over text appearance without altering the core functionality of the RichText widget.

Suggested Reviewers:
• @flutter-quill team
@maintainers

@wangjinshan
Copy link
Author

see
#2553

@wangjinshan
Copy link
Author

image

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