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

change Margins and Paddings #118

Open
Elevencode opened this issue Jun 21, 2023 · 1 comment
Open

change Margins and Paddings #118

Elevencode opened this issue Jun 21, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Elevencode
Copy link

Elevencode commented Jun 21, 2023

Describe the bug

  • I can't remove paddings between blocks (look at screen 1).
  • Also, margins has strange behavior (screen 2) - is too big. Different behaviors when I run from Run and Debug and when I run from terminal: flutter run -d chrome --web-renderer html. After deploy on Firebase my ui looks like on second screenshot.

What I do wrong?

Screenshots
image
image

My code:

Widget build(BuildContext context) {
    return MarkdownWidget(
      padding: EdgeInsets.zero,
      physics: const NeverScrollableScrollPhysics(),
      shrinkWrap: true,
      data: widget.message.text?.trim() ?? '',
      markdownGeneratorConfig: MarkdownGeneratorConfig(linesMargin: EdgeInsets.zero),
      config: MarkdownConfig(
        configs: [
          const ListConfig(marginLeft: 20, marginBottom: 0),
          const PConfig(textStyle: TextStyle(fontSize: 14)),
          CodeConfig(style: GoogleFonts.robotoMono(color: Colors.red, fontSize: 12)),
          PreConfig(
            margin: EdgeInsets.zero,
            padding: EdgeInsets.zero,
            wrapper: (child, code) => Container(
              width: double.infinity,
              decoration: BoxDecoration(
                color: Colors.grey.shade900,
                borderRadius: BorderRadius.circular(4),
                boxShadow: [
                  BoxShadow(
                    color: Colors.black.withOpacity(0.1),
                    spreadRadius: 5,
                    blurRadius: 5,
                    offset: const Offset(0, 3),
                  ),
                ],
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Align(
                        alignment: Alignment.topRight,
                        child: CopyButton(
                          onCopy: () => onCopy(code),
                        )),
                  ),
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text(
                      code,
                      style: GoogleFonts.robotoMono(color: Colors.white, fontSize: 12),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

Environment(please complete the following information):

 Flutter (Channel stable, 3.10.4, on macOS 13.4 22F66 darwin-arm64, locale
    ru-RU)
    • Flutter version 3.10.4 on channel stable at /Users/arthur/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 682aa387cf (2 weeks ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1

markdown_widget: ^2.2.0

Platform
Web

Source data
Please provide a minimal source data that can help locating the problem

@Elevencode Elevencode added the bug Something isn't working label Jun 21, 2023
@Elevencode Elevencode changed the title change fontSize and Paddings change Margins and Paddings Jun 21, 2023
@asjqkkkk
Copy link
Owner

Hi @Elevencode , currently, using HTML rendering on the web can lead to many strange issues. Considering maintainability, I do not plan to spend more time on compatibility with HTML mode for now.

The presence of padding in the code is because you added padding in the wrapper of PreConfig

...
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text(
                      code,
                      style: GoogleFonts.robotoMono(color: Colors.white, fontSize: 12),
                    ),
                  ),
...

you can remove the padding here

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