搜索分类、插件与代码仓

smooth_page_indicator 封面
插件详情v3.0.0

smooth_page_indicator

可自定义的动画页面指示器,带有一组内置效果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
60.7万
喜欢数
4130
Pub 分数
160

安装插件

flutter pub add smooth_page_indicator

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Smooth Page Indicator 是一个可自定义的、带有动画效果的 Flutter 页面指示器,支持多种内置视觉效果。它可无缝集成到 PageView 小部件中,为用户提供在可滚动页面列表中的当前位置的直观反馈。该包提供平滑的过渡效果和动态样式选项,使开发者能够根据应用的设计语言定制其外观和行为。支持所有主要平台,确保在移动设备、网页或桌面端均能提供一致的用户体验。

适合场景

  • 显示入职流程中的进度
  • 增强图像滑块的用户体验
  • 可视化多步骤表单中的步骤
  • 在标签之间进行动画导航
  • 创建引人入胜的教程屏幕

主要特点

  • 内置动画效果
  • 可定制的颜色和尺寸
  • 支持多种页面视图类型
  • 跨平台响应式设计
  • 与 PageView 的轻松集成
  • 可扩展的效果系统

适合对象

  • 入门屏幕
  • 图像画廊
  • 多步骤向导
  • 交互式教程
  • 移动和网络应用

使用建议

  • 可能会影响许多指标的性能
  • 需要仔细调整以适应复杂动画
  • 有限的自定义,不扩展代码
  • 不适合静态、非动画指示器
  • 最适合与中等页数一起使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

smooth_page_indicator

MIT License stars pub version Buy Me A Coffee

Introduction

Page indicators are a crucial part of any app that involves multiple pages. They help users to
understand the number of pages and their current position. SmoothPageIndicator is a Flutter
package that provides a set of animated page indicators with a variety of effects.

Effects

SmoothPageIndicator comes with a set of built-in effects that you can use to animate the active dot,
you can also customize each effect to your liking.

for more specific customization, try the CustomizableEffect which allows for more customization.

Effect Preview
Worm
Worm style = WormStyle.thin [v1.0.0]
Expanding Dots
Jumping dot
Jumping dot with vertical offset [v1.0.0]
Scrolling Dots
Slide
Scale
Swap
Swap type = SwapType.yRotation [v1.0.0]
Color Transition [0.1.2]
Customizable demo-1 [v1.0.0]
Customizable demo-2 [v1.0.0]
Customizable demo-3 [v1.0.0]
Customizable demo-4 [v1.0.0]

Usage

SmoothPageIndicator uses the PageController's scroll offset to animate the active dot.

SmoothPageIndicator(    
   controller: controller,  // PageController    
   count:  6,    
   effect:  WormEffect(),  // your preferred effect    
   onDotClicked: (index){    
  }
)    
   

Usage without a PageController

Unlike SmoothPageIndicator, AnimatedSmoothIndicator is self animated and all it needs is the
active index.

AnimatedSmoothIndicator(    
   activeIndex: yourActiveIndex,    
   count: 6,    
   effect: WormEffect(), 
)    

Vertical layout support

Smooth page indicator supports both horizontal and vertical layouts.

SmoothPageIndicator(    
   controller: controller,  // PageController    
   count:  6,    
   axisDirection: Axis.vertical,    
   effect:  WormEffect(), 
)    

Scrolling dots effect

Smooth page indicator comes with a shipped it scrolling dots effect, (similar to the one used in instagram), it's useful when you have a large number of pages.

Customization

Each effect comes with its own set of properties that you can customize to your liking.
for example, you can customize direction, width, height, radius, spacing, paint style, color and more... of SlideEffect like follows:

  SmoothPageIndicator(    
   controller: controller,    
   count:  6,    
   axisDirection: Axis.vertical,    
   effect:  SlideEffect(    
      spacing:  8.0,    
      radius:  4.0,    
      dotWidth:  24.0,    
      dotHeight:  16.0,    
      paintStyle:  PaintingStyle.stroke,    
      strokeWidth:  1.5,    
      dotColor:  Colors.grey,    
      activeDotColor:  Colors.indigo    
  ), 
)    
   

Default Colors

By default, indicators use these fallback colors:

  • activeDotColor: Color(0xFF3F51B5)
  • dotColor: Color(0xFF9E9E9E)

These colors do not come from the app's ThemeData. Override them for a subtree with SmoothPageIndicatorTheme, or set dotColor and activeDotColor directly on an effect.

SmoothPageIndicatorTheme

SmoothPageIndicatorTheme is an InheritedTheme that configures default settings for descendant SmoothPageIndicator and AnimatedSmoothIndicator widgets. Wrap the subtree that should share the configuration:

MaterialApp(
  home: SmoothPageIndicatorTheme(
    effect: ExpandingDotsEffect(), // default effect when none is specified
    defaultColors: DefaultIndicatorColors(
      active: Colors.blue,
      inactive: Colors.grey,
    ),
    child: MyHomePage(),
  ),
)
  • defaultColors: Applies to all descendant indicator effects unless dotColor or activeDotColor is set on the effect.
  • effect: The default effect when an indicator does not specify one. If omitted, WormEffect is used.

This provides consistent indicator styling without relying on or modifying the app theme.

Support the Library

You can support the library by liking it on pub, staring in on Github and reporting any bugs you
encounter.

所属分类

源码仓库

使用此插件的项目

所在榜单