패키지, 저장소 및 앱 카테고리 검색

skeletons 표지
패키지 상세v0.0.3

skeletons

로딩 중에 페이지 레이아웃을 모방하는 사용자 정의 스켈레톤 위젯을 만들기 위한 플러터 패키지입니다.

30일 다운로드
1.3천
좋아요
343
Pub 점수
60

패키지 설치

flutter pub add skeletons

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

스켈레톤 패키지는 플러터에서 사용자 지정 스켈레톤 로딩 위젯을 만드는 간단한 방법을 제공하여 콘텐츠가 로드되는 동안 페이지 레이아웃을 모방할 수 있게 해줍니다. 최종 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.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트