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

AutoSizeText not working last word does not appear #141

Open
mu7mmd opened this issue Feb 21, 2024 · 1 comment
Open

AutoSizeText not working last word does not appear #141

mu7mmd opened this issue Feb 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mu7mmd
Copy link

mu7mmd commented Feb 21, 2024

Steps to Reproduce
I show simple item price with price label and currency symbol, I use AutoSizeText.rich to manage styles, and if the text is larger than space it does not count the last word, the currency symbol does not appear, and if I write a word after the currency symbol the text shrink to fit the text with currency symbol but again the last word does not count and does not appear!.
Even when I tried to use Row with separated AutoSizeText still the same.

Code sample

AutoSizeText.rich(
                        TextSpan(
                          text: '${locale.priceWithVat} : ',
                          style: TextStyles.smallRegular,
                          children: [
                            TextSpan(
                              text: '${item.priceWithVat} ${locale.sar}',
                              style: TextStyles.smallBold,
                            ),
                          ],
                        ),
                        maxLines: 1,
                        minFontSize: 10,
                      )

Screenshots

  1. when text: '${item.priceWithVat} ${locale.sar}'
Screenshot 2024-02-21 at 12 35 13 PM Screenshot 2024-02-21 at 12 35 27 PM
  1. when text: '${item.priceWithVat} ${locale.sar} ss'
Screenshot 2024-02-21 at 12 36 54 PM Screenshot 2024-02-21 at 12 34 15 PM

Version

  • Flutter version: [3.16.0]
  • auto_size_text version: [3.0.0]
@mu7mmd mu7mmd added the bug Something isn't working label Feb 21, 2024
@mu7mmd mu7mmd changed the title AutoSizeText not working if last word small it not appears AutoSizeText not working last word does not appear Feb 21, 2024
@iapicca
Copy link

iapicca commented Apr 18, 2024

same issue here,
I modified the example app as follow

name: example
description: AutoSizeText example

version: 1.0.0

environment:
  sdk: '>=3.3.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

  auto_size_text:
    path: ../

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true 

publish_to: none
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';

const _text = 'This string will be automatically resized to fit in two lines.';

const _style = TextStyle(fontSize: 90);

const _maxLines = 2;
void main() => runApp(App());

class App extends StatelessWidget {
  @override
  Widget build(context) => MaterialApp(
        home: Scaffold(
          body: Center(
            child: SizedBox(
              width: MediaQuery.sizeOf(context).width,
              child: AutoSizeText(
                _text,
                style: _style,
                maxLines: _maxLines,
              ),
            ),
          ),
        ),
      );
}
image
flutter doctor -v
[!] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-US)
    • Flutter version 3.19.6 on channel stable at /Users/francesco/fvm/versions/stable
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.3.4/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
      /Users/francesco/fvm/versions/stable. Consider adding /Users/francesco/fvm/versions/stable/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (18 hours ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/francesco/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.71

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

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