FLUTTER ECOSYSTEM

fluttercommunity/flutter_blurhash

이미지의 자리 표시자에 대한 컴팩트한 표현입니다. 미디엄에서 사용하는 것처럼 30자 미만의 흐릿한 이미지를 인코딩하여 즉시 표시합니다.

flutter_blurhash 프로젝트 이미지
Stars
574
Forks
78
최근 푸시(UTC)
2025. 4. 22.
프로젝트 상태
활성
Flutter Community GitHub avatar
GITHUB Organization

Flutter Community ↗

A central place for all community made Flutter packages. To get started, see the README of the 'community' repository.

언어DartHTML

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_lints개발 의존성—
  • flutter_test개발 의존성{"sdk":"flutter"}

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Flutter Community: flutter_blurhash

pub package Twitter

flutter_blurhash

Blurhash is compact representation of a blurred image. It's often used as a placeholder while waiting for a full image to load.

This package implements the blurhash-decoding algorithm in pure Dart. It also provides the BlurHash widget that displays the blurhash and can transition into the actual image once it is loaded.

Currently, it doesn't support encoding an image into a blurhash.

Generation

A fast and easy way to get a blurhash for your image is to upload it to https://blurha.sh.

Blurhash demo

Example

Constrain your widget's render area and let BlurHash fill the pixels.

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text("BlurHash")),
        body: const SizedBox.expand(
          child: Center(
            child: AspectRatio(
              aspectRatio: 1.6,
              child: BlurHash(hash: "L5H2EC=PM+yV0g-mq.wG9c010J}I"),
            ),
          ),
        ),
      ),
    );
  }
}

Optimization Modes

  • None (BlurHashOptimizationMode.none): The original algorithm, provided for backward compatibility.
  • Standard (BlurHashOptimizationMode.standard): Optimized decoding with better cache locality and performance.
  • Approximation (BlurHashOptimizationMode.approximation): Fastest mode with an approximated sRGB conversion that produces slightly darker results but significantly improves performance.
class BlurHashApp extends StatelessWidget {
  const BlurHashApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => MaterialApp(
    home: Scaffold(
      appBar: AppBar(title: const Text("BlurHash")),
      body: const SizedBox.expand(
        child: Center(
          child: AspectRatio(
            aspectRatio: 1.6,
            child: BlurHash(
              hash: "L5H2EC=PM+yV0g-mq.wG9c010J}I",
              optimizationMode: BlurHashOptimizationMode.approximation,
            ),
          ),
        ),
      ),
    ),
  );
}