搜尋套件、儲存庫與 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.

所屬分類

原始碼儲存庫

使用此套件的專案