如何设置flutter_quill包中的默认Textstyle?

问题描述 投票:0回答:1

我的要求是在我的应用程序中强制使用特定的文本样式,但我在 QuillTool.basic

中找不到相应的选项
Column buildEditor() {
return Column(
  children: [
    Expanded(
        child: quill.QuillEditor.basic(

            controller: _controller, readOnly: false)),
    quill.QuillToolbar.basic(
      fontSizeValues: const {'Small': '12'},
        controller: _controller,
      showAlignmentButtons: false,
      showBackgroundColorButton: false,
      showCameraButton: false,
      showCenterAlignment: false,
      showClearFormat: false,
      showCodeBlock: false,
      showColorButton: false,
      showDirection: false,
      showDividers: false,
      showFontFamily: false,
      showFontSize: true,
      showFormulaButton: false,
      showHeaderStyle: false,
      showImageButton: false,
      showIndent: false,
      showInlineCode: false,
      showJustifyAlignment: false,
      showLeftAlignment: false,
      showLink: false,
      showListCheck: false,
      showListNumbers: false,
      showQuote: false,
      showListBullets: false,
      showSearchButton: false,
      showStrikeThrough: false,
      showVideoButton: false,
      showSmallButton: false,
    )
  ],
);

}

在当前情况下,它给出 12 尺寸的默认尺寸输出。

flutter quill
1个回答
1
投票

是的,您可以使用

customStyles
QuillEditor
属性来更改它:

                               QuillEditor(
                                          controller: _controller2,
                                          readOnly: false,
                                          showCursor: true,
                                          autoFocus: false,
                                          expands: false,
                                          placeholder: 'add title',
       //This property with paragraph ->  customStyles: quill.DefaultStyles(
                                      ->      paragraph:
                                                  quill.DefaultTextBlockStyle(
                                                      TextStyle(
                                                          color: Colors.black,
                                                          fontWeight:
                                                              FontWeight.w900,
                                                          fontSize: 35),
                                                      Tuple2(16, 0),
                                                      Tuple2(0, 0),
                                                      null),

对于

Tuple
,您需要导入 tuple 包。

© www.soinside.com 2019 - 2024. All rights reserved.