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

Does not work with Flutter Web --web-renderer = html (default for mobile) #86

Open
MyBuzzTechnologies opened this issue Feb 16, 2021 · 18 comments
Labels
bug Something isn't working

Comments

@MyBuzzTechnologies
Copy link

Create a simple app with AutoSizeText:

Widget build(BuildContext context) {
return Container(
// color: Colors.red,
// child: const Center(child: Text("Reports")),
child: Center(
child: Container(
width: 60,
decoration: BoxDecoration(border: Border.all()),
child: const AutoSizeText("Sample long text", minFontSize: 5, maxLines: 1),
)));
}

Run with:

flutter -d chrome --web-renderer html

image

Note: the text does not resize correctly.
If you run with --web-renderer canvasKit (the default for desktop) the text resizes correctly.

image

Flutter (Channel beta, 1.26.0-17.3.pre, on macOS 11.2.1 20D74 darwin-arm, locale en-GB)
• Flutter version 1.26.0-17.3.pre
• Framework revision 4b50ca7f7f (11 days ago)
• Engine revision 2c527d6c7e
• Dart version 2.12.0 (build 2.12.0-259.8.beta)

auto_size_text: ^2.1.0 (also tried 3.0.0-nullsafety.0 - same problem)

Reproducible on Chrome version 88.0.4324.150 (Official Build) (x86_64 translated)

Also has same problem on iPhone Safari browser (iOS 14.3)

@MyBuzzTechnologies MyBuzzTechnologies added the bug Something isn't working label Feb 16, 2021
@ghunkins
Copy link

I have this exact issue as well.

@Xim-ya
Copy link

Xim-ya commented Feb 18, 2021

please stable version.. after the flutter event

@MiroLiebschner
Copy link

MiroLiebschner commented Mar 5, 2021

Same problem.

@doppio
Copy link

doppio commented Apr 1, 2021

This is caused by flutter/flutter#65940. auto_size_text checks TextPainter.didExceedMaxLines to determine the right font size, but it's always returning false. The package is given the impression that the text always fits.

@skiunke
Copy link

skiunke commented Aug 15, 2021

Could this be the reason that debugging in desktop chrome and changing to a smartphone aspect ratio resizes the text, but on a smartphone itself it doesn't?

Is there any workaround for this?

@leonardopivetta
Copy link

I'm facing the same issue, on desktop is all fine but when I compile and run on the smartphone it doesn't work

@smok95
Copy link

smok95 commented Nov 2, 2021

I have this exact issue as well.

@P-B1101
Copy link

P-B1101 commented Dec 13, 2021

Same here.

@kipouras
Copy link

kipouras commented Jan 4, 2022

same here

@JorisObert
Copy link

A little hack if you have to deploy your web app (not a fix):

  • add this right after your tag in your web/index.html:
    <script> window.flutterWebRenderer = 'canvaskit'; </script>

  • build using
    flutter build web --web-renderer auto

It will force the web renderer to 'canvaskit'.

@doppio
Copy link

doppio commented Jan 27, 2022

A little hack if you have to deploy your web app (not a fix):

  • add this right after your tag in your web/index.html:
    <script> window.flutterWebRenderer = 'canvaskit'; </script>
  • build using
    flutter build web --web-renderer auto

It will force the web renderer to 'canvaskit'.

You can actually just flutter build web --web-renderer canvaskit. No need to modify your HTML.

@JorisObert
Copy link

@doppio I had to launch a little website on Firebase Hosting and doing just flutter build web --web-renderer canvaskit did not work for me.

@guccisekspir
Copy link

still same. In Flutter Web doesnt work properly

@doppio
Copy link

doppio commented Feb 28, 2022

There's nothing the author of this package can do until flutter/flutter#65940 is resolved, please thumbs-up that issue instead of "same here" comments so it gets prioritized by the Flutter team. 🙂

@ligker2
Copy link

ligker2 commented Mar 12, 2022

hello everyone,
run: flutter build web --release --web-renderer html => auto_size_text not working.
but,
if run: flutter build web --release => working for me

@MorelSerge
Copy link

It seems to be fixed in flutter 2.10.3! I've tried running my app on WEB using --web-renderer html and auto_size_text works as expected. Might need a little more testing, but I think we can close this issue now.

Just installed 2.10.4, doesn't seem to work with the html renderer for me.

@SeriousMonk
Copy link

It seems to be fixed in flutter 2.10.3! I've tried running my app on WEB using --web-renderer html and auto_size_text works as expected. Might need a little more testing, but I think we can close this issue now.

Just installed 2.10.4, doesn't seem to work with the html renderer for me.

Sorry I am using --web-renderer canvaskit. I don't know what happened to me that day

@remantou
Copy link

Any update on this? The problem is still there...

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