搜索插件、代码仓与 APP 分类

插件详情v0.3.1+1

parallax_image

一个 Flutter 小部件,用于绘制图像并使其移动速度慢于主要滚动内容。

近 30 天下载
15
喜欢数
94
Pub 分数
40

安装插件

flutter pub add parallax_image

插件介绍

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

Parallax_image 是一个 Flutter 小部件,通过以比周围内容更慢的速度移动图像来创建视差滚动效果。这种视觉技术为可滚动界面增添了深度和吸引力,非常适合用于沉浸式体验,如封面流或幻灯片轮播。该小部件可无缝集成到 ListView 及其他可滚动组件中,使开发者能够通过微妙的运动增强用户交互。它轻量且专为性能设计,即使在低端设备上也能确保流畅的动画效果。

适合场景

  • 创建沉浸式轮播界面
  • 增强应用入门屏幕
  • 为产品展示页面增加深度
  • 提升滚动式内容的用户参与度
  • 设计视觉动态的着陆页

主要特点

  • 平滑的视差滚动效果
  • 与 ListView 的轻松集成
  • 可自定义的视差速度
  • 轻量且高效
  • 支持静态和动态图像

适合对象

  • 寻求视觉深度的应用程序设计师
  • 开发交互式轮播图的开发者
  • 专注于用户体验提升的团队
  • 需要细微动画效果的项目
  • 具有丰富视觉叙事的移动应用

使用建议

  • 可能会影响低端设备的性能
  • 需要仔细调整视差速度
  • 仅限可滚动的上下文
  • 不适合复杂动画
  • 最好与高质量图像一起使用

原始 README

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

A Flutter widget that paints an image and moves it at a slower speed than the main scrolling content.

demo.gif

Installation

Add dependency to your pubspec.yaml:

dependencies:
  parallax_image: [latest version]

Usage

ParallaxImage can be used with any Scrollable (ListView for instance). When created, it subscribes to scroll updates on nearest Scrollable ancestor. It is also possible to specify custom ScrollController in which case this widget subscribes to updates on ScrollController.position (assumes that controller is attached to only one Scrollable).

class MyWidget extends StatefulWidget {
  @override
  MyWidgetState createState() => new MyWidgetState();
}

class MyWidgetState extends State<MyWidget> {
  final _controller = new ScrollController();

  @override
  Widget build(BuildContext context) {
    return new ListView(controller: _controller, children: [
      new ParallaxImage(
        image: new AssetImage('images/january.jpg'),
        // Extent of this widget in scroll direction.
        // In this case it is vertical scroll so extent defines
        // the height of this widget.
        // The image is scaled with BoxFit.fitWidth which makes it
        // occupy full width of this widget.
        // After image is scaled it should normally have height greater
        // than this value to allow for parallax effect to be
        // visible.
        extent: 100.0,
        // Optionally specify child widget.
        child: new Text('January'),
        // Optinally specify scroll controller.
        controller: _controller,
      ),
      // ...add more list items
    ]);
  }
}

See example/ folder for a complete demo.

Features and bugs

Please file feature requests and bugs at the issue tracker.

所属分类

源码仓库

使用此插件的项目