搜尋套件、儲存庫與 APP 分類

shimmer_animation 封面
套件詳情v2.2.2+1

shimmer_animation

這個閃爍動畫小部件可幫助您輕鬆為專案加入簡單而美觀的骨架載入器。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1.2萬
喜歡數
517
Pub 分數
160

安裝套件

flutter pub add shimmer_animation

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

ShimmerAnimation 是一個 Flutter 套件,提供了一種簡單且優雅的方式來在您的應用程式中實作骨架載入器。它讓開發者能夠建立流暢、動畫化的佔位符 UI,模擬真實內容載入的外觀,進而提升感知效能與使用者體驗。透過最少的設定,它支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。此組件高度可自訂,並能順暢整合至現有的 Flutter 項目中。

適用情境

  • 載入清單的佔位符
  • 防止資料獲取期間出現空白畫面
  • 在載入緩慢的介面中提升使用者體驗
  • 建立現代、動態的使用者介面
  • 在網格中顯示內容骨架
  • 模擬即時資料加載

主要特色

  • 平滑閃爍動畫效果
  • 跨平台相容性
  • 與 Flutter 的輕鬆整合
  • 可自訂的顏色和漸變
  • 支援多種容器形狀
  • 輕量且高效

適合對象

  • 尋求視覺精煉的UI/UX設計師
  • 開發資料密集型應用程式的開發者
  • 專注於感知效能的團隊
  • 需要現代加載狀態的項目
  • 具有動態或異步內容的應用程式
  • 原型設計互動介面

使用建議

  • 可能需要額外的樣式才能實現複雜的佈局
  • 不適合靜態佔位內容
  • 對超大列表的效能影響
  • 超出基本動畫之外的自訂功能有限
  • 最佳搭配適當的載入狀態管理使用
  • 需要理解 Flutter 的 widget 樹

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Shimmer Animation

pub package Libraries.io dependency status for latest release License

Supports Null Safety

This shimmer animation widget can help you bring simple yet beautiful skeleton loaders to your project with ease.

Shimmer is very widely used as the default animation for skeleton loaders or placeholder widgets throughout the development community. Therefore, having an easy to use, yet customizable widget ready to use for Android, iOS and Web, gives developers an advantage to focus on their actual functionality, let shimmer make the loading experience smoother.

Examples

An example can be found in the example directory of this repository.

A list of detailed examples can be found in this Examples Repository

Full Screen Loading Widgets Loading Buttons

How to use

Add shimmer_animation to pubspec.yaml of your project:

dependencies:
  shimmer_animation: ^2.1.0

Import it in your Dart code:

import 'package:shimmer_animation/shimmer_animation.dart';

Wrap any widget with Shimmer() widget to apply animaton:

  Shimmer(
    child: Container(
      color: Colors.deepPurple,
    ),
  ),

A number of parameters can be passed to customise the look and feel of this animation:

  Shimmer(
    duration: Duration(seconds: 3), //Default value
    interval: Duration(seconds: 5), //Default value: Duration(seconds: 0)
    color: Colors.white, //Default value
    colorOpacity: 0, //Default value
    enabled: true, //Default value
    direction: ShimmerDirection.fromLTRB(),  //Default Value
    child: Container(
      color: Colors.deepPurple,
    ),
  ),
Parameters:
  • @required child : accepts a child Widget over which the animation is to be displayed
  • color : accepts a parameter of type Color and sets the color of the animation overlay. Default value is Colors.white
  • color : accepts a parameter of type double and sets the Opacity of the color of the animation overlay. Default value is 0.3
  • enabled : accepts a bool which toggles the animation on/off. Default value is true
  • duration : accepts a Duration that would be the time period of animation. Default value is Duration(seconds: 3)
  • interval : accepts a Duration that would be the interval between the repeating animation. Default value is Duration(seconds: 0) i.e. no interval
  • direction : accepts a ShimmerDirection and aligns the animation accordingly. Default value is ShimmerDirection.fromLBRT()

A detailed API Reference can be found here.

License

MIT License.

所屬分類

原始碼儲存庫

使用此套件的專案