パッケージ、リポジトリ、アプリカテゴリを検索

skeletons のカバー
パッケージ詳細v0.0.3

skeletons

読み込み中にページのレイアウトを模倣するカスタムスケルトンウィジェットを作成するためのFlutterパッケージ。

30日間ダウンロード
1320
いいね数
343
Pub ポイント
60

パッケージをインストール

flutter pub add skeletons

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Skeletons パッケージは、Flutter でカスタムのスケルトンローディングウィジェットを作成する簡単な方法を提供し、コンテンツの読み込み中にページのレイアウトを模倣できるようにします。最終的なUIを反映するプレースホルダー構造を表示することで、ユーザー体験を向上させ、認識される読み込み時間を短縮します。このパッケージは軽量で柔軟性があり、プレースホルダー用にさまざまな形状とアニメーションをサポートしています。複雑なレイアウトを持つ画面に最適で、読み込みからコンテンツ表示へのスムーズな遷移を保証します。

用途

  • ロード画面のプレースホルダー
  • データ取得中のコンテンツプレビュー
  • 認識されるパフォーマンスの向上
  • 複雑なUIレイアウトのシミュレーション
  • オンボーディング画面
  • 動的リストのプレースホルダー

主な機能

  • カスタマイズ可能なスケルトン形状
  • 組み込みアニメーションサポート
  • 既存のウィジェットとの簡単な統合
  • 柔軟なレイアウトの一致
  • 軽量でパフォーマンスに優れる
  • ネストされたスケルトンをサポート

適している対象

  • UI/UXデザイナー
  • フロントエンド開発者
  • 大量のデータ読み込みを行うアプリ
  • インタラクティブな画面のプロトタイピング
  • スムーズな読み込み状態を必要とするモバイルアプリ

注意事項

  • 視覚的なプレースホルダーのみに限定
  • 組み込みのデータ取得なし
  • 手動でのレイアウトの整合が必要
  • 視覚的でないロードインジケーターには適していません
  • 正確なレイアウト予測に依存する

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Skeletons

A Flutter package for building custom skeleton widgets to mimic the page's layout while loading.

Examples

Items ListView (Default)
items paragraphs listview_default
ListView (Custom) ListView (Complex Cards) SkeletonTheme
listview_custom listview_cards skeleton_theme
Light/Dark modes Right-To-Left Custom Shimmer
light_dark_modes rtl custom_shimmer

All examples can be found here examples.

How To Use

Can be used by encapsulating the child widget in a Skeleton widget:

import 'package:skeletons/skeletons.dart';

Skeleton(
        isLoading: _isLoading,
        skeleton: SkeletonListView(),
        child: Container(child: Center(child: Text("Content"))),
      )

or directly:

Container(
    child: _isLoading 
    ? SkeletonListView() 
    : Container(child: Center(
                       child: Text("Content"))),
)

a SkeletonTheme can be used to set the default configs for all skeleton descendants in the tree.

SkeletonTheme(
    // themeMode: ThemeMode.light,
    shimmerGradient: LinearGradient(
        colors: [
          Color(0xFFD8E3E7),
          Color(0xFFC8D5DA),
          Color(0xFFD8E3E7),
        ],
        stops: [
          0.1,
          0.5,
          0.9,
        ],
      ),
      darkShimmerGradient: LinearGradient(
        colors: [
          Color(0xFF222222),
          Color(0xFF242424),
          Color(0xFF2B2B2B),
          Color(0xFF242424),
          Color(0xFF222222),
        ],
        stops: [
          0.0,
          0.2,
          0.5,
          0.8,
          1,
        ],
        begin: Alignment(-2.4, -0.2),
        end: Alignment(2.4, 0.2),
        tileMode: TileMode.clamp,
      ),
        child: MateriaApp(
            ...
        ),
      ),

More Customization:

ListView (Complex Cards)
listview_cards

for more complex shapes you can build your skeleton inside a SkeletonItem widget:

ListView.builder(
  physics: NeverScrollableScrollPhysics(),
  itemCount: 5,
  itemBuilder: (context, index) => Padding(
    padding: const EdgeInsets.all(8.0),
    child: Container(
      padding: const EdgeInsets.all(8.0),
      decoration: BoxDecoration(color: Colors.white),
      child: SkeletonItem(
          child: Column(
        children: [
          Row(
            children: [
              SkeletonAvatar(
                style: SkeletonAvatarStyle(
                    shape: BoxShape.circle, width: 50, height: 50),
              ),
              SizedBox(width: 8),
              Expanded(
                child: SkeletonParagraph(
                  style: SkeletonParagraphStyle(
                      lines: 3,
                      spacing: 6,
                      lineStyle: SkeletonLineStyle(
                        randomLength: true,
                        height: 10,
                        borderRadius: BorderRadius.circular(8),
                        minLength: MediaQuery.of(context).size.width / 6,
                        maxLength: MediaQuery.of(context).size.width / 3,
                      )),
                ),
              )
            ],
          ),
          SizedBox(height: 12),
          SkeletonParagraph(
            style: SkeletonParagraphStyle(
                lines: 3,
                spacing: 6,
                lineStyle: SkeletonLineStyle(
                  randomLength: true,
                  height: 10,
                  borderRadius: BorderRadius.circular(8),
                  minLength: MediaQuery.of(context).size.width / 2,
                )),
          ),
          SizedBox(height: 12),
          SkeletonAvatar(
            style: SkeletonAvatarStyle(
              width: double.infinity,
              minHeight: MediaQuery.of(context).size.height / 8,
              maxHeight: MediaQuery.of(context).size.height / 3,
            ),
          ),
          SizedBox(height: 8),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  SkeletonAvatar(
                      style: SkeletonAvatarStyle(width: 20, height: 20)),
                  SizedBox(width: 8),
                  SkeletonAvatar(
                      style: SkeletonAvatarStyle(width: 20, height: 20)),
                  SizedBox(width: 8),
                  SkeletonAvatar(
                      style: SkeletonAvatarStyle(width: 20, height: 20)),
                ],
              ),
              SkeletonLine(
                style: SkeletonLineStyle(
                    height: 16,
                    width: 64,
                    borderRadius: BorderRadius.circular(8)),
              )
            ],
          )
        ],
      )),
    ),
  ),
);

Issues and feedback

For issues, please report here. Contributions are welcome.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト