분류, 패키지 및 저장소 검색

shimmer 표지
패키지 상세v4.0.0

shimmer

패키지는 Flutter 프로젝트에 샤이머 효과를 쉽게 추가할 수 있는 방법을 제공합니다

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
175만
좋아요
5.5천
Pub 점수
160

패키지 설치

flutter pub add shimmer

패키지 개요

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

Shimmer는 UI 컴포넌트에 반짝임 로딩 효과를 쉽게 추가할 수 있도록 도와주는 Flutter 패키지입니다. 부드럽고 애니메이션된 자리 표시자 외관을 생성합니다. 리스트, 카드 또는 이미지에서 콘텐츠 로딩 상태를 모방하는 데 이상적이며, 데이터 가져오기 중 사용자 경험을 향상시킵니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원하여 기기 간 일관된 동작을 보장합니다. 최소한의 설정으로 복잡한 애니메이션을 작성하지 않고도 시각적으로 매력적인 로딩 인디케이터를 빠르게 구현할 수 있습니다.

사용 사례

  • 목록 내 로딩 자리표시자
  • 애니메이션 카드 자리 표시자
  • 이미지 로딩 스켈레톤
  • 데이터 가져오기 중 사용자 경험 개선
  • 동적 콘텐츠 미리보기

주요 기능

  • 간단한 API 통합
  • 크로스 플랫폼 지원
  • 사용자 정의 반짝임 색상
  • 부드러운 애니메이션 효과
  • 경량이고 성능이 뛰어남

적합한 대상

  • 시각적 완성도를 추구하는 UI 디자이너
  • 동적 콘텐츠 화면을 구축하는 개발자
  • 자주 데이터를 로드하는 앱
  • 인터랙티브 인터페이스 프로토타이핑
  • 인식되는 성능 향상

고려 사항

  • 정적 콘텐츠에 적합하지 않습니다
  • 위젯 트리 내에서 적절한 위치에 배치되어야 합니다
  • 과도하게 사용할 경우 성능에 영향을 줄 수 있습니다
  • 기본 스타일링을 넘어서는 사용자 정의가 제한적
  • 투명한 배경과 함께 사용하는 것이 가장 좋습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Shimmer

pub package unit test codecov

A lightweight Flutter widget that paints a moving highlight over placeholder UI. Typical uses are skeleton screens while data loads, and a sliding highlight on a call to action.

Install

dependencies:
  shimmer: ^4.0.0
  material_ui: ^1.0.1

shimmer 4.0 uses Flutter's standalone material_ui package (Flutter 3.44+). Apps that still import package:flutter/material.dart can wrap those subtrees in MaterialUiCompatibilityBridge.

import 'package:material_ui/material_ui.dart';
import 'package:shimmer/shimmer.dart';

Usage

Skeleton placeholder

Shimmer.fromColors is the usual constructor. Build the child from solid shapes (Container, Row, Column). The gradient replaces those colors; transparent pixels stay transparent.

Shimmer.fromColors(
  baseColor: Colors.grey.shade300,
  highlightColor: Colors.grey.shade100,
  child: Column(
    children: [
      Container(height: 200, color: Colors.white),
      const SizedBox(height: 16),
      Container(height: 12, color: Colors.white),
      const SizedBox(height: 8),
      Container(height: 12, width: 200, color: Colors.white),
    ],
  ),
);

Dark theme:

Shimmer.fromColors(
  baseColor: Colors.grey.shade800,
  highlightColor: Colors.grey.shade600,
  child: placeholder,
);
Custom gradient

Use the default constructor when you need a RadialGradient, SweepGradient, or a LinearGradient that follows Theme.

Shimmer(
  gradient: LinearGradient(
    colors: [
      Theme.of(context).colorScheme.surfaceContainerHighest,
      Theme.of(context).colorScheme.surface,
      Theme.of(context).colorScheme.surfaceContainerHighest,
    ],
    stops: const [0.35, 0.5, 0.65],
  ),
  child: placeholder,
);
Direction, speed, and loops
Shimmer.fromColors(
  direction: ShimmerDirection.rtl,
  period: const Duration(milliseconds: 1200),
  loop: 0, // 0 = forever
  enabled: isLoading,
  baseColor: Colors.grey.shade300,
  highlightColor: Colors.grey.shade100,
  child: placeholder,
);
Parameter Default Role
child required Opaque area the highlight is blended onto
gradient required* Highlight colors (fromColors builds this for you)
direction ltr ltr, rtl, ttb, btt
period 1500ms Duration of one pass
loop 0 Passes before stopping; 0 repeats forever
enabled true false pauses the animation

*Required on Shimmer(...). Shimmer.fromColors takes baseColor and highlightColor instead.

Performance

  • Wrap a list of placeholders in one Shimmer, not one Shimmer per row.
  • Keep child simple and static. Fancy widgets (images, text with decoration, elevation) often look wrong because the shader replaces their colors.
  • Toggle enabled to false when loading finishes so the ticker stops.

Example

The example/ app shows a loading list and a “slide to unlock” highlight. From the repository root:

cd example && flutter run

How it works

Shimmer drives an AnimationController and paints a ShaderMaskLayer over the child (BlendMode.srcIn). The highlight rectangle is three times the child size so the band can travel fully across the widget.

Project internals, tests, and further optimization notes live in docs/overview.md and docs/optimization.md.

카테고리

의존성

의존성 목록 1 개

소스 저장소

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

순위