Skip to content
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

Font Color doesn't show correctly, all text will be black, and can't apply a font color for text. #1922

Closed
1 task done
RodrigoDEVS opened this issue Jun 17, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RodrigoDEVS
Copy link

Is there an existing issue for this?

Flutter Quill version

9.4.1

Steps to reproduce

1, I'm getting html text from an API:

\n <span style="font-size: small;">\n SDS Attached?         Pics Attached?\n
\n
\n Air?                        Ocean?\n
\n
\n Qty:\n
\n
\n Battery Installed?\n
\n
\n
\n <span style="color:#B22222; font-size: 12px;">* FAVOR NO RESPONDER A ESTE CORREO\n
\n \n

\n

2.I'm parsing this text width Document.fromHtml(htmlText), the text shows rightly but not the red color for last line.
3. I'm sending the text to the API to send and email parsing with quillController.document.toDelta().toHtml() using quill_html_converter.dart, the html text is right but it doesn't has the color tag.

Expected results

want to see and send the last line in red color

Actual results

currently the color shown is black

Code sample

Code sample
var html = widget.emailBody?.mailBody ??
        "<p>\n  <span style=\"font-size: small;\">\n    SDS Attached? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pics Attached?\n    <br/>\n    <br/>\n    Air? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ocean?\n    <br/>\n    <br/>\n    Qty:\n    <br/>\n    <br/>\n    Battery Installed?\n    <br/>\n    <br/>\n    <br/>\n    <span style=\"color:#B22222; font-size: 12px;\">* FAVOR NO RESPONDER A ESTE CORREO</span>\n    <br/>\n  </span>\n</p>\n";
    quillController2.document = Document.fromHtml(html);

// Quill Editor
Column(
                children: [
                  QuillToolbar.simple(
                      configurations: QuillSimpleToolbarConfigurations(
                          controller: quillController2)),
                  SingleChildScrollView(
                    child: Container(
                        height: 380,
                        width: 550,
                        decoration: const BoxDecoration(color: Colors.white),
                        child: QuillEditor.basic(
                            configurations: QuillEditorConfigurations(
                                controller: quillController2))),
                  ),
                ],
              )

// Send mail button
CustomSaveButton(
                text: 'Send Email',
                active: true,
                onPressed: () async {
                  String htmlContent =
                      quillController2.document.toDelta().toHtml();
                  context.pop();
                  ref
                      .read(whTabControllerProvider.notifier)
                      .sendComplianceEMail(
                          emailParams: ComplianceMailModel(
                              from: '[email protected]',
                              to: controllers[0].text,
                              cc: controllers[1].text,
                              bcc: controllers[2].text,
                              subject: controllers[3].text,
                              msg: htmlContent,
                              attachmentPaths: ref
                                  .watch(whTabControllerProvider)
                                  .attachmentList));
                },
              )

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]
@RodrigoDEVS RodrigoDEVS added the bug Something isn't working label Jun 17, 2024
@CatHood0
Copy link
Collaborator

CatHood0 commented Jun 28, 2024

This is difficult to solve. DeltaX class uses the html2md package to convert html to Markdown and make it easier to transform the input into a Delta. As Markdown does not support color attributes, then on the parse process the attribute will be removed, it has not been implemented in either html2md and Markdown package.

@CatHood0 CatHood0 self-assigned this Jun 28, 2024
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