颤动中的连续文本

Continuous text in flutter

我想创建始终自动滚动的文本(如 swift 中的标签 .continuous 属性)。现在我正在使用 SingleChildScrollViewscrollController

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

你需要使用 Marquee 属性 在 flutter 中自动移动文本,因为有库可以这样做,请检查一次 Marquee

请检查代码

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,
)