(颤振)在简介屏幕中滑动时,点指示滞后

时间:2019-02-20 06:57:48

标签: flutter flutter-layout indicator

我是来自的自定义代码 https://pub.dartlang.org/packages/intro_slider#-readme-tab-

但是如何使切换屏幕的逻辑不会滞后,因为当屏幕充满时点会移动100%,而不是51%

List<Widget> renderListDots() {
dots.clear();
for (int i = 0; i < slides.length; i++) {
  Color currentColor;
  if (tabController.index == i) {
    currentColor = colorActiveDot;
    dots.add(renderDotCustom(sizeActiveDot, currentColor));
  } else {
    currentColor = colorDot;
    dots.add(renderDot(sizeDot, currentColor));
  }
}
return dots; }

Widget renderDot(double radius, Color color) {
return Container(
  decoration: BoxDecoration(
      color: color, borderRadius: BorderRadius.circular(radius / 2)),
  width: radius,
  height: radius,
  margin: EdgeInsets.all(6),
);}

Widget renderDotCustom(double radius, Color color) {
return Container(
  decoration: BoxDecoration(
      color: color, borderRadius: BorderRadius.circular(radius / 2)),
  width: 30.0,
  height: 8.0,
  margin: EdgeInsets.all(6),
);}

0 个答案:

没有答案