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

Scroll only when text overflows #87

Open
ShahoodulHassan opened this issue Feb 4, 2023 · 2 comments
Open

Scroll only when text overflows #87

ShahoodulHassan opened this issue Feb 4, 2023 · 2 comments

Comments

@ShahoodulHassan
Copy link

Hi,

How can we make it scroll only when the text is overflowing....?

Thanks!

@CengizhanParlak
Copy link

You can get help from another package: AutoSizeText for this use-case.

run flutter pub add auto_size_text

and then:

import 'package:auto_size_text/auto_size_text.dart';
import 'package:marquee/marquee.dart';

return SizedBox(
  height: 20,
  child: AutoSizeText(
    'Some text that will probably going to overflow from one of the side',
    maxLines: 1,
    style: context.subtitle2.copyWith(
      color: Colors.black,
    ),
    overflowReplacement: Marquee(
      text: 'Some text that will probably going to overflow from one of the side',
      style: context.subtitle2.copyWith(
        color: Colors.black,
      ),
      velocity: 30,
      startAfter: const Duration(seconds: 1),
      blankSpace: 20,
      fadingEdgeStartFraction: 0.1,
      fadingEdgeEndFraction: 0.1,
    ),
  ),
);

@MKlimentowicz
Copy link

I just had the problem that the font size was dynamically adjusted to the width. If you don't need this then simply use the two properties:

AutoSizeText( ... minFontSize: <int>, maxFontSize: <int>, ... )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants