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

パッケージ詳細v0.0.2

progressive_blur

(実験的) Flutterにおけるプログレッシブブラーの実装。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
2.2万
いいね数
68
Pub ポイント
160

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

flutter pub add progressive_blur

パッケージ概要

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

プログレッシブブラーブラウザは、画像のスムーズで段階的なぼかしを可能にする実験的なFlutterパッケージです。画像読み込み時の視覚的遷移とパフォーマンスを向上させます。画像が読み込まれるにつれてぼかしを段階的に適用することで、視覚的な違和感を軽減し、応答性の向上を図ります。画像が多く含まれるアプリケーション向けに設計されており、Android、iOS、Web、macOS、Windows、Linuxなど複数のプラットフォームをサポートしています。Flutterのレンダリングパイプラインを活用して、最小限のオーバーヘッドで効率的なリアルタイムのぼかし効果を提供します。スタートスクリーン、画像ギャラリー、視覚的な連続性が重要な動的UIに最適です。

用途

  • スムーズなトランジション付きの画像読み込み
  • ぼかし背景付きのスプラッシュ画面
  • 動的画像ギャラリー
  • 高パフォーマンスUIアニメーション
  • 画像レンダリング中の視覚フィードバック

主な機能

  • 実験的なプログレッシブブラー効果
  • 画像の読み込み中のスムーズな視覚的遷移
  • クロスプラットフォーム対応(Android、iOS、Web、macOS、Windows、Linux)
  • 最小限のパフォーマンスオーバーヘッド
  • Flutter のレンダリングパイプラインとの統合

適している対象

  • 画像豊富なアプリを開発する開発者
  • 視覚的な仕上げを求めるUIデザイナー
  • スムーズな読み込み体験を必要とするアプリ
  • 実験的機能テスト
  • パフォーマンスに注力したFlutterプロジェクト

注意事項

  • 実験的な状態は不安定を示す可能性がある
  • 利用可能なドキュメントは限られています
  • プラットフォーム固有のチューニングが必要になる場合があります
  • まだ本番での重要な機能には推奨されていません
  • ぼかし処理中のメモリ使用量が増加

元の README

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

Demo image

[!NOTE] Early version of the project. The performance may be suboptimal, and the APIs may change in the future.

An iOS-like progressive blur implementation for Flutter.

Usage

See the example folder for a complete example.

[!CAUTION] The CanvasKit web performance seems to be terrible. I'm not exactly sure why at the moment. However, skwasm performs much better.

import 'package:progressive_blur/progressive_blur.dart';

// Simple gradient blur with optional tint
ProgressiveBlurWidget(
  sigma: 24.0,
  linearGradientBlur: const LinearGradientBlur(
    values: [0, 1], // 0 - no blur, 1 - full blur
    stops: [0.5, 0.8],
    start: Alignment.topCenter,
    end: Alignment.bottomCenter,
  ),
  tintColor: Colors.orange.withOpacity(0.3), // Optional tint color
  child: ...
);

// Advanced: custom blur texture
//
// You can create a custom blur texture using the Flutter's Canvas API. Note that the red channel controls the blur strength (0 - no blur, 255 - full blur).
ProgressiveBlurWidget.custom(
  sigma: 24.0,
  blurTexture: [instance of ui.Image],
  tintColor: Colors.purple.withOpacity(0.4), // Optional tint color
  child: ...,
)

Rendering implementations

The package ships two implementations of the blur:

  • ImageFilter.shader (Impeller only): the two blur passes are applied as chained ui.ImageFilter.shader filters via an ImageFiltered widget. This avoids rendering the subtree into an intermediate ui.Image every frame. Requires Flutter 3.35+ and the Impeller rendering engine.
  • AnimatedSampler (fallback): the original implementation — the subtree is rendered into a composited layer and the resulting ui.Image is bound as a shader sampler. Works on Skia and on the web.

By default, the implementation is selected automatically at runtime via ui.ImageFilter.isShaderFilterSupported. You can override the selection with the static useImageFilter toggle:

// null (default): pick automatically — ImageFilter.shader on Impeller,
// AnimatedSampler otherwise.
ProgressiveBlurWidget.useImageFilter = null;

// Force the ImageFilter.shader implementation.
ProgressiveBlurWidget.useImageFilter = true;

// Force the AnimatedSampler implementation.
ProgressiveBlurWidget.useImageFilter = false;

The toggle can be changed at any time (existing widgets pick it up on their next rebuild), and both implementations render identically.

[!NOTE] With the ImageFilter.shader implementation, the blur parameters are read when the widget is built or its configuration changes — animating them every frame is not supported yet (see flutter/flutter#163302).

Additional information

Feel free to report bugs/issues on GitHub.

If you have questions, you can contact me directly at kk.erzhan@gmail.com.

Credits:

  • https://www.shadertoy.com/view/Mfd3DM - an inspiration for the blur shader
  • flutter_shaders - a great library for working with shaders in Flutter

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

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