Add Fields to Control Uniform Line Height for Span in flutter-quill #2555
+15
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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