【问题标题】:How to Change Swiper pagination color in Flutter?如何在 Flutter 中更改 Swiper 分页颜色?
【发布时间】:2020-10-25 11:17:54
【问题描述】:

我在 Flutter Activity 中使用 Swiper 作为滑块我想将 Swiper 点指示器颜色从蓝色(默认)更改为自定义,但我无法找到如何更改指示器颜色的方法,我也想更改位置容器内的指示器。

【问题讨论】:

  • 有代码例子看看你用的是什么包和参数
  • Container( child: SizedBox( height: 170, child: Swiper( itemCount: 5, viewportFraction: 0.8, scale: 0.9, itemBuilder: (_, i) { return Container( height: 165, child : 函数(Tteam1[i], Tteam2[i], Turl1[i], Turl2[i],Tdate1[i],Tloc[i]), ); }, ,),),),

标签: android-studio dart flutter-layout swiper


【解决方案1】:

我通过在 Swiper 小部件中添加以下代码找到了解决此问题的方法。

 pagination: new SwiperPagination(
                alignment: Alignment.bottomCenter,
                builder: new DotSwiperPaginationBuilder(
                    color: Colors.grey, activeColor: Color(0xff38547C)),
              ),
              control: new SwiperControl(
                color: Color(0xff38547C),
              ),

添加此代码后,输出如下所示:

【讨论】:

    猜你喜欢
    • 2019-12-24
    • 2020-05-30
    • 2013-12-09
    • 1970-01-01
    • 2015-11-28
    • 2023-03-05
    • 1970-01-01
    • 2022-08-15
    • 2017-03-21
    相关资源
    最近更新 更多