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.76k stars 815 forks source link

max-width attribute and auto-margins on network images for Flutter 3.10 #1359

Open TheCarpetMerchant opened 9 months ago

TheCarpetMerchant commented 9 months ago

This PR is not ready to be merged. I made it as best as I could while trying to learn the inner workings of this beautiful package :)

Hopefully, it's not too shabby. The use of shrinkWrap should probably be removed in favor of understanding what's going wrong in the _calculateUsedMargins, but I haven't even tried given shrinkWrap fixes it (by bypassing the issue), at least AFAIK.

Rockets1080 commented 9 months ago

image

  1. It is necessary to determine whether the current style width is greater than the screen width;
  2. Keep the aspect ratio of the picture, otherwise the picture will be stretched and distorted image Where used set like this.
eEQK commented 9 months ago

This PR is not ready to be merged. I made it as best as I could while trying to learn the inner workings of this beautiful package :)

@TheCarpetMerchant Do you intend to finish it or would you prefer someone to take over?

TheCarpetMerchant commented 9 months ago

@eEQK Would prefer someone at least look it over. I didn't even run tests because my local setup kept erroring out ; it just works for my use case as is. If what I did is enough then great, but it would still be better someone take it over, especially to separate the 2 commits which are really two different things.

TheCarpetMerchant commented 8 months ago

@eEQK Finally back to it. What's missing for now it the ability to compare 2 Widths that aren't in the same unit, if you know how to do that on a sufficient "best effort" basis at least that'd be great. Since there's now a bunch of commits and this is 2 separate things in one PR (maxWidth and the BoxFit.contain change), I can close this PR and open 2 others if you think it's better for the commit history.