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

skeleton_text 封面
套件詳情v3.0.1

skeleton_text

一個提供在 Flutter 項目中輕鬆加入骨架文字載入動畫的套件。此專案是 101Loop 社區的一部分。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2.7萬
喜歡數
350
Pub 分數
150

安裝套件

flutter pub add skeleton_text

套件介紹

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

一個 Flutter 套件,可簡化在資料載入期間新增骨架文字載入動畫的過程,以提升使用者體驗。它提供一種乾淨、可自訂的方式,透過帶有動態閃爍效果的佔位內容來模擬真實文字版面。屬於 101Loop 社群的一部分,支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 與 Linux。非常適合尋求輕量級解決方案以提升 UI 回應性的開發者。

適用情境

  • 加載畫面佔位符
  • 產品卡佔位符
  • 列表項骨架
  • 個人資料頁面加載狀態
  • 動態內容預覽

主要特色

  • 動態閃爍效果
  • 可自定義的寬度和高度
  • 支援多行
  • 與現有小部件的輕鬆整合
  • 輕量且高效

適合對象

  • UI/UX 設計師
  • Flutter 初學者
  • 應用開發者需要加載狀態
  • 具有動態內容的專案
  • 注重性能的應用

使用建議

  • 僅限純文字佔位符
  • 不支援內建影像
  • 需要手動樣式設定以實現複雜佈局
  • 不適用於非文字載入情境
  • 依賴於平台特定的渲染

原始 README

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

skeleton_text

A package provides an easy way to add skeleton text loading animation in Flutter project

Dependency

dependencies:
  skeleton_text: 

How To Use

import 'package:skeleton_text/skeleton_text.dart';

To achieve the above example animation use the following code :

 ListView.builder(
   scrollDirection: Axis.vertical,
   physics: BouncingScrollPhysics(),
   itemCount: 5,
   itemBuilder: (BuildContext context, int index) {
     return Container(
       height: 240,
       margin: EdgeInsets.symmetric(horizontal: 20),
       child: Row(
         children: [
           Expanded(
             child: SkeletonAnimation(
               shimmerColor: Colors.grey,
               borderRadius: BorderRadius.circular(20),
               shimmerDuration: 1000,
               child: Container(
                 decoration: BoxDecoration(
                   color: Colors.grey[300],
                   borderRadius: BorderRadius.circular(20),
                   boxShadow: shadowList,
                 ),
                 margin: EdgeInsets.only(top: 40),
               ),
             ),
           ),
           Expanded(
             child: Container(
               margin: EdgeInsets.only(top: 60, bottom: 20),
               decoration: BoxDecoration(
                 color: Colors.grey,
                 boxShadow: shadowList,
                 borderRadius: BorderRadius.only(
                   topRight: Radius.circular(20),
                   bottomRight: Radius.circular(20),
                 ),
               ),
               child: Column(
                 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                 crossAxisAlignment: CrossAxisAlignment.start,
                 mainAxisSize: MainAxisSize.max,
                 children: <Widget>[
                   Padding(
                     padding: const EdgeInsets.only(left: 15.0, bottom: 5.0),
                     child: SkeletonAnimation(
                       borderRadius: BorderRadius.circular(10.0),
                       shimmerColor: index % 2 != 0 ? Colors.grey : Colors.white54,
                       child: Container(
                         height: 30,
                         width: MediaQuery.of(context).size.width * 0.35,
                         decoration: BoxDecoration(
                             borderRadius: BorderRadius.circular(10.0),
                             color: Colors.grey[300]),
                       ),
                     ),
                   ),
                   Padding(
                     padding: const EdgeInsets.only(left: 15.0),
                     child: Padding(
                       padding: const EdgeInsets.only(right: 5.0),
                       child: SkeletonAnimation(
                         borderRadius: BorderRadius.circular(10.0),
                         shimmerColor: index % 2 != 0 ? Colors.grey : Colors.white54,
                         child: Container(
                           width: 60,
                           height: 30,
                           decoration: BoxDecoration(
                               borderRadius: BorderRadius.circular(10.0),
                               color: Colors.grey[300]),
                         ),
                       ),
                     ),
                   ),
                 ],
               ),
             ),
           ),
         ],
       ),
     );
   },
 )

Explanation

I have created a List builder of 5 Containers. Wrapping any widget by SkeletonAnimation would give a beautiful loading animation.

SkeletonAnimation Constructor :

  SkeletonAnimation({
      @required this.child,
      this.shimmerColor = Colors.white54,
      this.gradientColor = const Color.fromARGB(0, 244, 244, 244),
      this.curve = Curves.fastOutSlowIn,
      this.borderRadius = const BorderRadius.all(Radius.circular(0)),
      this.shimmerDuration = 1000,
      Key key,
    })

所屬分類

原始碼儲存庫

使用此套件的專案