auto_size_text icon indicating copy to clipboard operation
auto_size_text copied to clipboard

Support for Flutter Web

Open Ahmadre opened this issue 5 years ago • 15 comments

Is your feature request related to a problem? Please describe. Package doesn't work for flutter web. It's not compatible for flutter web projects.

Describe the solution you'd like Provide support for flutter web :)

Describe alternatives you've considered Decouple auto_size_text from flutter sdk.

Version

  • Flutter version: v1.7.8+hotfix.3
  • auto_size_text version: ^1.1.2

Ahmadre avatar Jul 19 '19 22:07 Ahmadre

I'd love to support Flutter web but as long as it is not merged with Flutter, I think it will be hard to support both. How do you propose to decouple AutoSizeText from the Flutter SDK?

Edit: Here is the corresponding Flutter bug

simc avatar Jul 19 '19 22:07 simc

@leisim also ich hatte mir einige Packages angeschaut und die, die auch Flutter web unterstützen, basieren entweder nur auf Dart ohne Flutter Komponenten, oder Sie bieten neben Flutter Komponenten auch die Web-Version an. Ich vermute mal, dass diese als Dependecy flutter_web haben anstatt flutter.

Aber jetzt wo ich mir den Link angeschaut habe, denke ich warten wir lieber bis das Flutter Team das mal hinbekommt ^^ solange baue ich mal eine javascript Brücke. Kannst meinen Issue schließen, wenn du willst 👍

Ahmadre avatar Jul 20 '19 16:07 Ahmadre

Ich lasse die issue offen und schließe sie sobald AutoSizeText mit Flutter web funktioniert...

simc avatar Jul 20 '19 16:07 simc

Alriiiight. I got it running for flutter web now 👍 . Instead of flutter, i imported flutter_web and just had to modify the pubspec.yaml in auto_size_text like this:

name: auto_size_text
description: Flutter widget that automatically resizes text to fit perfectly within its bounds.
version: 2.0.2+1
author: Simon Leier <[email protected]>
homepage: https://github.com/leisim/auto_size_text

environment:
  sdk: ">=2.0.0 <3.0.0"

dependencies:
  #flutter:
  #  sdk: flutter
  flutter_web: any
  flutter_web_ui: any

dev_dependencies:
  #flutter_test:
  #  sdk: flutter
  pedantic: '>=1.4.0 <3.0.0'

dependency_overrides:
  flutter_web:
    git:
      url: https://github.com/flutter/flutter_web
      path: packages/flutter_web
  flutter_web_ui:
    git:
      url: https://github.com/flutter/flutter_web
      path: packages/flutter_web_ui
  flutter_web_test:
    git:
      url: https://github.com/flutter/flutter_web
      path: packages/flutter_web_test  

But for now the flutter_web Text Widget doesn't support "strutStyle". So i comment out the strutStyle and that's it! It works for flutter_web now 😄

Ahmadre avatar Jul 23 '19 11:07 Ahmadre

I will fork that package and provide a web version 🤣

Ahmadre avatar Jul 23 '19 11:07 Ahmadre

I'm happy to hear that no big changes are required. Feel free to create a pull request with the required changes once flutter_web is released 👍

simc avatar Jul 23 '19 11:07 simc

done with Flutter 1.9 stable 👍🏼 you can close this issue 😊

Ahmadre avatar Sep 12 '19 02:09 Ahmadre

I tried to run the AutoSizeText demo and it looks really buggy. I'm not sure if it is a problem with Flutter but I'll leave this issue open until it really works.

simc avatar Sep 12 '19 06:09 simc

But it works for my flutter web app ^^ I tested it with a demo app and mine, but great, to know, that you're really tracking that :) thx

Ahmadre avatar Sep 30 '19 13:09 Ahmadre

It does not seem to work for me

image

on android

image

on web.

@Ahmadre what version or the package are you using?

billy1380 avatar Nov 05 '19 16:11 billy1380

@billy1380 I use the actual AutoSizeText version and Flutter: 1.12.* on master channel. did you set maxLines, and a TextStyle(fontSize:...)?

Gesendet von meinem Pixel 2 XL mit FastHub

Ahmadre avatar Nov 25 '19 02:11 Ahmadre

auto_size_text works on web for dev channel @Ahmadre @leisim

edeuss avatar Jan 12 '20 04:01 edeuss

For anyone wondering, mine was failing like @billy1380 's above until I removed overflow.elipsis.

dannnnthemannnn avatar May 19 '20 22:05 dannnnthemannnn

auto_size_text does not work on beta channel

KevinYan12138 avatar Jul 07 '20 08:07 KevinYan12138

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

ligker2 avatar Mar 12 '22 05:03 ligker2