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

image_blur 표지
패키지 상세v1.1.0

image_blur

이 Flutter 패키지는 이미지에 반짝임과 블러 효과를 추가하는 것을 가능하게 합니다. 로컬 및 온라인 이미지 모두에 대해 원형 및 사각형 형태로 이러한 효과를 적용할 수 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
125
좋아요
23
Pub 점수
140

패키지 설치

flutter pub add image_blur

패키지 개요

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

image_blur 패키지는 이미지에 반짝임과 흐림 효과를 적용함으로써 Flutter 앱을 강화합니다. 로컬 및 온라인 이미지를 모두 지원하며, 원형 또는 사각형 형태로 효과를 적용할 수 있습니다. 동적 자리표시자나 로딩 상태를 만들기에 적합하며, 이미지 로딩 중 사용자 경험을 개선합니다. 이 패키지는 가볍고 Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼에서 호환됩니다.

사용 사례

  • 로딩 상태 표시기
  • 이미지 플레이스홀더 애니메이션
  • 개선된 UI 전환
  • 이미지 가져오기 중 시각적 피드백
  • 인터랙티브 이미지 컴포넌트
  • 스무드한 콘텐츠 로딩

주요 기능

  • 반짝임 효과 지원
  • 블러 효과 적용
  • 원형 및 사각형 모양 마스킹
  • 로컬 및 원격 이미지 지원
  • 크로스 플랫폼 호환성
  • 간단한 API 통합

적합한 대상

  • 동적 UI를 구축하는 개발자
  • 중량 이미지 로딩을 하는 앱
  • 디자인 중심 애플리케이션
  • 인터랙티브 인터페이스 프로토타이핑
  • 매력적인 로딩 경험 만들기

고려 사항

  • 다중 효과로 인한 성능 영향
  • 형태와 강도 외에 맞춤 설정이 제한적입니다
  • 복잡한 레이아웃을 위해 추가 스타일링이 필요할 수 있습니다
  • 매우 큰 이미지에 최적화되지 않음
  • 중간 애니메이션 주기와 함께 사용할 때 가장 좋음

원본 README

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

Image Blur

This Flutter package provides the ability to add shimmer and blur effects to your images. You can apply these effects in circular and rectangular shapes, and use them with both local and online images.

blur

Initialize the cache configuration

void main() async {
  await ImageBlur.init();
  runApp(const MyApp());
}

Features

1. ImageBlur - Progressive Blur Loading

Display images with a progressive blur effect that smoothly transitions as the image loads.

ImageBlur(
  imageUrl: "https://picsum.photos/id/10/400/300",
  width: 300,
  height: 200,
  fit: BoxFit.cover,
  borderRadius: BorderRadius.circular(12),
)

blur-4


2. ImageHashPreview - BlurHash Placeholder

Display a BlurHash preview while the actual image loads. Great for smooth loading experiences.

ImageBlur.imageHashPreview(
  imagePath: "https://picsum.photos/id/15/400/300",
  width: 300,
  height: 200,
  fit: BoxFit.cover,
  borderRadius: BorderRadius.circular(8),
  duration: const Duration(milliseconds: 1000),
)

blur-3


3. ImageHashPreviewCircular - Circular BlurHash

Circular version of BlurHash preview, perfect for avatars and profile pictures.

ImageBlur.imageHashPreviewCircular(
  size: 120,
  imagePath: "https://picsum.photos/id/22/200/200",
  fit: BoxFit.cover,
)

blur-1


4. ImageCircularBlur - Circular with Shimmer Effect

Circular image with shimmer and blur effects.

ImageBlur.imageCircularBlur(
  size: 120,
  imageNetwork: "https://picsum.photos/id/1/200/200",
  isShimmer: true,
  isBlur: true,
)

blur-2


5. OptimizedImageHashPreview - Fast & Cached BlurHash

Optimized version with caching support for better performance. NEW

ImageBlur.optimizedImageHashPreview(
  imagePath: "https://picsum.photos/id/20/400/300",
  width: 300,
  height: 200,
  fit: BoxFit.cover,
  borderRadius: BorderRadius.circular(8),
  duration: const Duration(milliseconds: 500),
  hashLoadDelay: const Duration(milliseconds: 100),
  imageShowDelay: const Duration(milliseconds: 300),
  onLoaded: () {
    debugPrint('Image loaded successfully');
  },
  errorBuilder: (context, error) {
    return const Center(child: Icon(Icons.error));
  },
)

6. ImageBlurGetPaletteColor - Extract Dominant Colors

Extract the dominant color palette from an image for dynamic theming.

ImageBlur.imageBlurGetPalletteColor(
  imageUrl: "https://picsum.photos/id/28/400/300",
  width: 300,
  height: 200,
  borderRadius: BorderRadius.circular(8),
  onPaletteReceived: (paletteFuture) async {
    final palette = await paletteFuture;
    if (palette != null && palette.dominantColor != null) {
      // Use the dominant color
      print('Dominant color: ${palette.dominantColor!.color}');
    }
    return null;
  },
)

20240505_073705


7. BlurIsWeb - Web-Optimized Blur

Optimized for web platforms with placeholder and thumbnail support.

ImageBlur.blurIsWeb(
  placeholder: const AssetImage("assets/placeholder.jpg"),
  thumbnail: const NetworkImage("https://picsum.photos/id/5/50/50"),
  image: const NetworkImage("https://picsum.photos/id/5/400/300"),
  width: 300,
  height: 200,
  fit: BoxFit.cover,
  blur: 20.0,
)

BlurHash Cache Management

Manage BlurHash caching for better performance:

// Clear all cached BlurHash values
ImageHashManager.clearCache();

// Set maximum cache size (default: 100)
ImageHashManager.setMaxCacheSize(200);

// Preload BlurHash for multiple images
await ImageHashManager.preloadHashes([
  "https://picsum.photos/id/1/200/300",
  "https://picsum.photos/id/2/200/300",
  "https://picsum.photos/id/3/200/300",
]);

Getting started

dependencies:
  image_blur: ^1.1.0

How to use

import 'package:image_blur/image_blur.dart';

Complete Example

import 'package:flutter/material.dart';
import 'package:image_blur/image_blur.dart';

void main() async {
  await ImageBlur.init(removeCacheTime: 30);
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Image Blur Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const ImageGallery(),
    );
  }
}

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

  // Sample image URLs
  static const List<String> imageUrls = [
    "https://picsum.photos/id/10/400/300",
    "https://picsum.photos/id/11/400/300",
    "https://picsum.photos/id/12/400/300",
    "https://picsum.photos/id/13/400/300",
    "https://picsum.photos/id/14/400/300",
    "https://picsum.photos/id/15/400/300",
    "https://picsum.photos/id/16/400/300",
    "https://picsum.photos/id/17/400/300",
    "https://picsum.photos/id/18/400/300",
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Image Blur Gallery'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Padding(
        padding: const EdgeInsets.all(8.0),
        child: GridView.builder(
          itemCount: imageUrls.length,
          gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 3,
            crossAxisSpacing: 8,
            mainAxisSpacing: 8,
          ),
          itemBuilder: (context, index) {
            return ImageBlur.imageHashPreview(
              imagePath: imageUrls[index],
              fit: BoxFit.cover,
              borderRadius: BorderRadius.circular(12),
            );
          },
        ),
      ),
    );
  }
}

Additional information

If you have any issues, questions, or suggestions related to this package, please feel free to contact us at [swan.dev1993@gmail.com](mailto:zagros.development.group@gmail.com). We welcome your feedback and will do our best to address any problems or provide assistance.

For more information about this package, you can also visit our GitHub repository where you can find additional resources, contribute to the package's development, and file issues or bug reports. We appreciate your contributions and feedback, and we aim to make this package as useful as possible for our users.

Thank you for using our package, and we look forward to hearing from you!

카테고리

의존성

의존성 목록 8 개

소스 저장소

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

아직 데이터가 없습니다.