Search code examples
flutterscrollviewsinglechildscrollview

Continuous text in flutter


I want create text with always auto scroll(like label .continuous property in swift). Now I am using SingleChildScrollView with scrollController

SchedulerBinding.instance.addPostFrameCallback((_) { _scrollController.animateTo(_scrollController.position.maxScrollExtent, duration: Duration(seconds: 3), curve: Curves.easeIn); });


Solution

  • You need to use the Marquee property for auto move text in flutter , for it there is library to do so please check it once Marquee library

    And please check the code for it

    Marquee(
      text: 'Some sample text that takes some space.',
      style: TextStyle(fontWeight: FontWeight.bold),
      scrollAxis: Axis.horizontal,
      crossAxisAlignment: CrossAxisAlignment.start,
      blankSpace: 20.0,
      velocity: 100.0,
      pauseAfterRound: Duration(seconds: 1),
      startPadding: 10.0,
      accelerationDuration: Duration(seconds: 1),
      accelerationCurve: Curves.linear,
      decelerationDuration: Duration(milliseconds: 500),
      decelerationCurve: Curves.easeOut,
    )