Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.75k stars 805 forks source link

[BUG] <hr> tag doesn't work as intended when style="width: 20%;" is applied #1394

Open AlbaneseRemy opened 5 months ago

AlbaneseRemy commented 5 months ago

Describe the bug:

The < hr > tag (without spaces) doesn't display correctly when style is applied to it. Without width, it shows entirely

HTML to reproduce the issue:

          <div>
            <p>
              Lorem ipsum dolor sit amet
              <hr>
              Lorem ipsum dolor sit amet
              <hr style="width: 20%;">
              Lorem ipsum dolor sit amet
            </p>
          </div>

Html widget configuration:

    return Padding(
      padding: const EdgeInsets.all(5),
      child: SingleChildScrollView(
        child: Html(
          data: """
          <div>
            <p>
              Lorem ipsum dolor sit amet
              <hr>
              Lorem ipsum dolor sit amet
              <hr style="width: 20%;">
              Lorem ipsum dolor sit amet
            </p>
          </div>
          """,
          onLinkTap: (url, _, __) => LinkUtils.openLink(
            context: context,
            closeWhenOpeningLink: data.closeWhenOpeningLink,
            tour: data.tour,
            url: url,
          ),
        ),
      ),
    );

Expected behavior: The < hr > tag should only display on 20% of the screen's width

Screenshots:

Capture d’écran 2023-11-24 à 16 22 37

Device details and Flutter/Dart/flutter_html versions: This is compiled on Chrome (Web)

flutter_html: 3.0.0-beta.1

Flutter doctor: 
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-x64, locale fr)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.84.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!