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

패키지 상세v1.0.3

css_filter

Flutter에서 CSS와 유사한 방식으로 다양한 필터 효과를 적용할 수 있으며, 이미지뿐만 아니라 모든 위젯에 사용 가능하며, 사용자 정의 필터를 지원하고 필터 강도를 제어할 수 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.6천
좋아요
84
Pub 점수
150

패키지 설치

flutter pub add css_filter

패키지 개요

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

css_filter 패키지는 이미지뿐만 아니라 어떤 Flutter 위젯에도 CSS와 유사한 필터 효과를 적용할 수 있게 해줍니다. 블러, 밝기, 대비, 채도 등의 내장 필터를 지원하며 강도를 조절할 수 있습니다. 사용자는 고급 시각적 효과를 위해 사용자 정의 필터도 정의할 수 있습니다. 이 패키지는 플랫폼에 관계없이 Android, iOS, Web, macOS, Windows, Linux에서 모두 작동합니다. 복잡한 렌더링 코드 없이 동적인 시각적 계층을 통해 UI를 향상시키기에 이상적입니다.

사용 사례

  • UI 요소에 시각적 깊이 추가
  • 인터랙티브 이미지 또는 텍스트 효과 만들기
  • 동적 필터를 사용하여 앱 테마 개선
  • 애니메이션 전환 설계
  • 사진 편집 기능 구현
  • 스타일리시한 사용자 인터페이스 구축

주요 기능

  • CSS 스타일 필터 구문
  • 이미지뿐만 아니라 모든 위젯을 지원
  • 조절 가능한 필터 강도
  • 사용자 정의 필터 정의
  • 크로스 플랫폼 호환성
  • 실시간 필터 적용

적합한 대상

  • 시각적인 매력을 찾는 UI 디자이너
  • 다중미디어 앱을 개발하는 개발자
  • 동적 시각 효과가 필요한 앱
  • 인터랙티브 인터페이스 프로토타이핑
  • 풍부한 시각적 서사가 있는 프로젝트

고려 사항

  • 큰 위젯에서 무거운 필터를 사용할 때의 성능 영향
  • 복잡한 SVG 기반 필터에 대한 제한된 지원
  • 저사양 기기에서 최적화가 필요할 수 있습니다
  • 필터 순서는 시각적 결과에 영향을 줄 수 있습니다
  • 고성능 게임 그래픽용이 아님

원본 README

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

CSS Filter for Flutter

English | 简体中文

Use CSS filter effects on Flutter.

Version Build Status

IFstruct parser supports generating flutter code from iofod visually edited projects. We have separated its filter module code and added many preset effects to form the current CSS Filter for Flutter, which facilitates all flutter projects to use the excellent design of the Web: CSS filter.

Features

  • Simple and efficient
  • Support multiple filter effects overlay
  • Rich preset effects.
  • Full platform support
  • Customize your own effect
  • Null-safety

Getting started

After importing the dependent, you can use the basic filters through CSSFilter.

import 'package:css_filter/css_filter.dart';

CSSFilter.contrast(child: const Text('foo'), value: 1.2);

Support filters:

  • contrast()
  • grayscale()
  • sepia()
  • hueRotate()
  • brightness()
  • saturate()
  • invert()
  • blur()
  • opacity()

You can combine and overlay these filters in flutter just as you would with a CSS filter. Use CSSFilter.apply in conjunction with CSSFilterMatrix(). Such as:

CSSFilter.apply(
  child: const Text('bar'),
  value: CSSFilterMatrix().contrast(1.2).sepia(0.8).hueRotate(90.0).invert(0.9).opacity(0.9)
);

Note: the order of the chain calls represents the order in which the filters are applied, and the order in which the filter effects are applied affects the final result.

Use presets

The CSSgram project does an excellent job of providing the CSS world with Instagram-like filters, and instagram.css complements it with more types of filters. We've combined these two libraries to encapsulate several presets that can call through CSSFilterPresets.

import 'package:css_filter/css_filter.dart';

CSSFilterPresets.insXpro2(child: const Text('Your widget'));

Support effects:

Effect name Preview effect Sample code
origin origin CSSFilterPresets.origin(child: Image(...))
ins1977 ins1977 CSSFilterPresets.ins1977(child: Image(...))
ins1977V2 ins1977V2 CSSFilterPresets.ins1977V2(child: Image(...))
insAden insAden CSSFilterPresets.insAden(child: Image(...))
insAmaro insAmaro CSSFilterPresets.insAmaro(child: Image(...))
insAshby insAshby CSSFilterPresets.insAshby(child: Image(...))
insBrannan insBrannan CSSFilterPresets.insBrannan(child: Image(...))
insBrooklyn insBrooklyn CSSFilterPresets.insBrooklyn(child: Image(...))
insClarendon insClarendon CSSFilterPresets.insClarendon(child: Image(...))
insDogpatch insDogpatch CSSFilterPresets.insDogpatch(child: Image(...))
insEarlybird insEarlybird CSSFilterPresets.insEarlybird(child: Image(...))
insGingham insGingham CSSFilterPresets.insGingham(child: Image(...))
insHelena insHelena CSSFilterPresets.insHelena(child: Image(...))
insHudson insHudson CSSFilterPresets.insHudson(child: Image(...))
insInkwell insInkwell CSSFilterPresets.insInkwell(child: Image(...))
insInkwellV2 insInkwellV2 CSSFilterPresets.insInkwellV2(child: Image(...))
insJuno insJuno CSSFilterPresets.insJuno(child: Image(...))
insKelvin insKelvin CSSFilterPresets.insKelvin(child: Image(...))
insLark insLark CSSFilterPresets.insLark(child: Image(...))
insLofi insLofi CSSFilterPresets.insLofi(child: Image(...))
insLudwig insLudwig CSSFilterPresets.insLudwig(child: Image(...))
insMaven insMaven CSSFilterPresets.insMaven(child: Image(...))
insMayfair insMayfair CSSFilterPresets.insMayfair(child: Image(...))
insMoon insMoon CSSFilterPresets.insMoon(child: Image(...))
insMoonV2 insMoonV2 CSSFilterPresets.insMoonV2(child: Image(...))
insNashville insNashville CSSFilterPresets.insNashville(child: Image(...))
insNashvilleV2 insNashvilleV2 CSSFilterPresets.insNashvilleV2(child: Image(...))
insPerpetua insPerpetua CSSFilterPresets.insPerpetua(child: Image(...))
insPoprocket insPoprocket CSSFilterPresets.insPoprocket(child: Image(...))
insReyes insReyes CSSFilterPresets.insReyes(child: Image(...))
insRise insRise CSSFilterPresets.insRise(child: Image(...))
insSierra insSierra CSSFilterPresets.insSierra(child: Image(...))
insSkyline insSkyline CSSFilterPresets.insSkyline(child: Image(...))
insSlumber insSlumber CSSFilterPresets.insSlumber(child: Image(...))
insStinson insStinson CSSFilterPresets.insStinson(child: Image(...))
insSutro insSutro CSSFilterPresets.insSutro(child: Image(...))
insToaster insToaster CSSFilterPresets.insToaster(child: Image(...))
insToasterV2 insToasterV2 CSSFilterPresets.insToasterV2(child: Image(...))
insValencia insValencia CSSFilterPresets.insValencia(child: Image(...))
insVesper insVesper CSSFilterPresets.insVesper(child: Image(...))
insWalden insWalden CSSFilterPresets.insWalden(child: Image(...))
insWaldenV2 insWaldenV2 CSSFilterPresets.insWaldenV2(child: Image(...))
insWillow insWillow CSSFilterPresets.insWillow(child: Image(...))
insXpro2 insXpro2 CSSFilterPresets.insXpro2(child: Image(...))

Similar to CSSFilter, we provide the apply method for CSSFilterPresets to invoke presets consistently, and apply additionally supports setting the intensity of the filter effect used. To do so:

/// You can replace the value parameter with any of the supported effects.
CSSFilterPresets.apply(
  child: YourWidget,
  value: CSSFilterPresets.insNashville, 
  strength: 0.7
);

Customize your own filter preset

CSSFilter provides the most basic filters, CSSFilterPresets collects the commonly used combinations of basic filters as presets, meaning you can also customize your own filter presets based on the basic filters.


customPreset({ required Widget child }) {
  return CSSFilter.apply(
    child: child, 
    value: CSSFilterMatrix().sepia(0.2).saturate(1.4)
  );
}

/// Used by CSSFilterPresets to set the intensity of the effect.
CSSFilterPresets.apply(
  child: YourWidget,
  value: customPreset,
  strength: 0.9
);

/// It also supports direct use.
customPreset(child: YourWidget);

More examples

For more usage examples, please check out the example project.

카테고리

소스 저장소

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

아직 데이터가 없습니다.