Modify flutter_quill textStyle

Viewed 797

I'm trying to modify the 'N' default text style for the flutter quill editor. However, I can't seem to find the option in the DefaultStyles class. Below is my current code:


QuillEditor(
       autoFocus: true,
       controller: controller,
       scrollController: scrollController,
       expands: true,
       focusNode: focusNode,
       readOnly: false,
       scrollable: true,
       padding: EdgeInsets.only(left: 30, right: 30),
       customStyles: DefaultStyles(

           h1: DefaultTextBlockStyle(
               GoogleFonts.montserrat(
                   fontSize: 20, fontWeight: FontWeight.w300, color: darkText),
               Tuple2(16, 0),
               Tuple2(0, 0),
               null),
           h2: DefaultTextBlockStyle(
               GoogleFonts.montserrat(
                   fontSize: 25, fontWeight: FontWeight.w300, color: darkText),
               Tuple2(16, 0),
               Tuple2(0, 0),
               null),
           h3: DefaultTextBlockStyle(
               GoogleFonts.montserrat(
                   fontSize: 30, fontWeight: FontWeight.w300, color: darkText),
               Tuple2(16, 0),
               Tuple2(0, 0),
               null),
           strikeThrough: GoogleFonts.montserrat(
               color: darkText, decoration: TextDecoration.lineThrough),
           sizeSmall: GoogleFonts.montserrat(color: darkText),
           italic: GoogleFonts.montserrat(
               color: darkText, fontStyle: FontStyle.italic),
           bold: GoogleFonts.montserrat(
               color: darkText, fontWeight: FontWeight.bold),
           underline: GoogleFonts.montserrat(
               color: darkText, decoration: TextDecoration.underline),
           color: darkText),
     ),

I've been able to modify the textstyles for h1 to h3 but not the normal (N) option. How do I achieve this?

1 Answers

Looking at the library's implementation, the DefaultStyles class has the following vars

DefaultStyles({
    this.h1,
    this.h2,
    this.h3,
    this.paragraph,

I guess what you're calling "N" is the default style, which should be paragraph.
You just have to follow the same logic you had with h1 h2 h3 and you should be fine

Related