Is Line Spacing is available? or is it something that I have to configure by my own?
Is there an existing issue for this?
- [X] I have searched the existing issues
The question
If I have a quill document and I want to add styling ( change line spacing), is it something available in the package? If not, anyone can advise me on how to do it?
Hello. I solved the problem by overriding custom styles in QuillEditor
customStyles: DefaultStyles(
sizeSmall: FontSizeType.h3.getTextStyle
sizeLarge: FontSizeType.h2.getTextStyle,
sizeHuge: FontSizeType.h1.getTextStyle,
),
and for each style apply SizeAttribute, like SizeAttribute('huge')
I am looking to implement a line spacing feature. This means that the user can press a button from the quilltoolbar and choose the spacing he wants, and then the changes should apply to the text. Let's say the spacing was the default 1.0, then the user chooses 1.5, so this would increase the line spacing in the document or the selected text.
You can just add a custom attribute and use a custom button to the toolbar to apply your line spacing options. But this has a issue, the cursor height is based in the size of the line height instead of the font size of the current word position. This can add a visual error with a line spacing over 2.0. it looks weird
This is an example of how should be your custom attribute:
class LineSpacingAttribute extends Attribute<double>{
LineSpacingAttribute({double value = 1.0})
: super(value, AttributeScope.block, "lineHeight");
}
@CatHood0 implemented this toolbar function. It is not enabled by default - where you set QuillSimpleToolbarConfigurations you can enable it
configurations.showLineHeightButton = true
or add the button to your custom toolbar
QuillToolbarSelectLineHeightStyleDropdownButton