1

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

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

4

1 回答 1

1

您需要使用该Marquee属性在颤动中自动移动文本,因为它有库可以这样做,请检查一次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,
)
于 2020-05-15T14:22:09.590 回答