Skip to content

I need the text to have a static color #2549

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
1 task done
andresguerreroh opened this issue Apr 23, 2025 · 4 comments
Open
1 task done

I need the text to have a static color #2549

andresguerreroh opened this issue Apr 23, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@andresguerreroh
Copy link

Have you checked for an existing issue?

Flutter Quill Version

11.2.0

Steps to Reproduce

I need the text to have a static color that I define, and not change depending on the style (bold, italics, underline, etc.).
The other thing is that it corrects the text for me constantly.

Expected results

Text black forever, with white background

Actual results

white text by default, with white background

Additional Context

Screenshots / Video demonstration

[Attach media here]

Logs
[Paste logs here]
@andresguerreroh andresguerreroh added the bug Something isn't working label Apr 23, 2025
@shafisma
Copy link

To force black text and disable autocorrect in Flutter Quill (v11+):

QuillEditor(
  controller: _controller,
  focusNode: FocusNode(),
  scrollController: ScrollController(),
  scrollable: true,
  readOnly: false,
  autoFocus: true,
  expands: false,
  padding: EdgeInsets.zero,
  config: QuillEditorConfig(
    autocorrect: false,
    enableSuggestions: false,
  ),
  customStyles: DefaultStyles(
    paragraph: DefaultTextBlockStyle(
      TextStyle(color: Colors.black), // Force black text
      Tuple2(16, 0),
      Tuple2(0, 0),
      null,
    ),
  ),
)

If you're hitting crashes on iOS, stub this method inside raw_editor_state_text_input_client_mixin.dart:

void showAutocorrectionPromptRect(int start, int end) {
  // prevent crash
}

For web:

quill.root.setAttribute('spellcheck', 'false');

This keeps your text black, disables autocorrect, and avoids web/iOS issues.

@andresguerreroh
Copy link
Author

void showAutocorrectionPromptRect(int start, int end) {
// prevent crash
}
Where is it located?
Regarding custom styles;
The ordered list: I can customize the font to be black, but the numbers appear in white.

@shafisma
Copy link

Here’s a quick guide to your two questions:

📍 Where is showAutocorrectionPromptRect located?

That method is inside:

flutter_quill/lib/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart

You can search for showAutocorrectionPromptRect in your flutter_quill package directory. If it's not there, you may need to check inside the RawEditorStateTextInputClientMixin mixin class.

To fix the iOS crash:

@override
void showAutocorrectionPromptRect(int start, int end) {
  // prevent crash
}

🎨 Ordered List Numbers Show as White?

That happens because the list marker (number or bullet) uses a separate text style. To override that, you can define a style for lists as well:

customStyles: DefaultStyles(
  paragraph: DefaultTextBlockStyle(
    TextStyle(color: Colors.black),
    Tuple2(16, 0),
    Tuple2(0, 0),
    null,
  ),
  lists: DefaultListBlockStyle(
    TextStyle(color: Colors.black), // This applies to the numbers
    Tuple2(16, 0),
    null,
    null,
  ),
),

This will force both the text and the number bullets to use black color. Let me know if you also want to target unordered list bullets (•) — they can be styled similarly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants