패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.1+2

gradients

CMYK, HSI, HSL, HSP, HSB, LAB, Oklab, RGB 및 XYZ 색 공간을 지원하는 Flutter의 선형, 반경 및 스위프 그래디언트 구현.

30일 다운로드
5
좋아요
26
Pub 점수
60

패키지 설치

flutter pub add gradients

패키지 개요

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

gradients 패키지는 Flutter의 선형, 방사형, 스위프트 그라데이션에 대한 향상된 구현을 제공하며, CMYK, HSI, HSL, HSP, HSB, LAB, Oklab, RGB 및 XYZ를 포함한 여러 색 공간을 지원합니다. 표준 RGB를 넘어서는 고급 색상 모델을 사용하여 풍부하고 사용자 정의 가능한 그라데이션 효과를 만들 수 있게 해줍니다. 정밀한 색상 제어가 필요한 디자인 중심 애플리케이션에 적합하며, 런타임 오버헤드 없이 Flutter의 기본 기능을 확장합니다. 이 라이브러리는 가볍고 기존 Flutter 프로젝트에 원활하게 통합됩니다.

사용 사례

  • 사용자 정의 그라데이션 배경을 사용하여 시각적으로 풍부한 UI 만들기
  • 비-RGB 색 공간을 사용한 컬러 테마 인터페이스 설계
  • 모바일 앱에서 그라디언트 애니메이션 구현
  • 고급 색상 혼합을 사용한 디자인 도구 개발
  • 인지적으로 균일한 그라디언트를 통한 접근성 향상

주요 기능

  • LAB 및 Oklab을 포함한 9가지 색 공간 지원
  • 선형, 반지름 및 스위프 유형을 위한 확장 가능한 그라디언트 빌더
  • Flutter의 페인팅 시스템과의 원활한 통합
  • 다양한 색상 모델 간의 정밀한 색상 보간
  • 가볍고 종속성 없음

적합한 대상

  • 사용자 정의 테마를 구축하는 UI/UX 디자이너
  • 창의적 또는 예술 앱을 개발하는 개발자
  • 고급 색상 조작이 필요한 앱
  • 시각적 미학과 브랜딩에 중점을 둔 프로젝트
  • 접근성 인식 애플리케이션 개발

고려 사항

  • RGB가 아닌 색 공간에 대한 이해 필요
  • 초보자에게 빌드 복잡성을 증가시킬 수 있음
  • 제한된 플랫폼별 최적화
  • 색 정밀도가 중요한 앱에 가장 적합
  • 성능 중심의 렌더링 루프에는 적합하지 않습니다

원본 README

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

gradients

Implementations of Flutter's [LinearGradient], [RadialGradient], and [SweepGradient] with support for the CMYK, HSI, HSL, HSP, HSB, LAB, Oklab, RGB, and XYZ color spaces.

gradients depends on and exposes the flutter_color_models package.

See: flutter_palette, a package for generating color palettes.

Usage

import 'package:gradients/gradients.dart';

The 3 classes in gradients can be used interchangeably with Flutter's [Gradient]s: [LinearGradientPainter], [RadialGradientPainter], and [SweepGradientPainter].

final colors = <Color>[Colors.lime, Colors.pink, Colors.cyan];
final linearGradient = LinearGradientPainter(colors: colors);
final radialGradient = RadialGradientPainter(colors: colors);
final sweepGradient = SweepGradientPainter(colors: colors);

Like [Gradient]s, [GradientPainter]s can be provided to a [BoxDecoration], or the [createShader] method can be used to paint directly to a [Canvas].

final widget = Container(
  decoration: BoxDecoration(
    gradient: LinearGradientPainter(
      colors: <Color>[Colors.lime, Colors.pink, Colors.cyan],
    ),
  ),
);

Color Spaces

By default, [Color]s are interpolated in the RGB color space; A [colorSpace] can be provided to set the color space colors will be interpolated in.

final colors = <Color>[Colors.lime, Colors.pink, Colors.cyan];
final oklabGradient = LinearGradientPainter(
  colorSpace: ColorSpace.oklab,
  colors: colors,
);

Oklab Gradient

Color Models

However, if [ColorModel]s are utilized and no [colorSpace] is provided, the gradient will be interpolated in the color space defined by the starting color within any pair of colors.

final colors = <Color>[
  RgbColor(0, 188, 212),
  HsbColor(35, 100, 100),
  OklabColor(0.9, -0.05, 0.033),
  HspColor(175, 100, 50),
];

// This gradient will be interpolated in the RGB color space,
// then the HSB color space, then the Oklab color space.
final gradient = LinearGradientPainter(colors: colors);

Color Models Example Gradient

If [invert] is set to true, the gradient will be interpolated in the color space defined by the ending color within any pair of colors.

// This gradient will be interpolated in the HSB color space,
// then the Oklab color space, then the HSP color space.
final gradient = LinearGradientPainter(colors: colors, invert: true);

Color Models Inverted Example Gradient

Output

Below is the same set of colors interpolated in each of the supported color spaces.

final colors = <Color>[Colors.lime, Colors.pink, Colors.cyan];
CMYK
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.cmyk);

CMYK Gradient

HSB
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.hsb);

HSB Gradient

HSI
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.hsi);

HSI Gradient

HSL
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.hsl);

HSL Gradient

HSP
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.hsp);

HSP Gradient

LAB
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.lab);

LAB Gradient

Oklab
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.oklab);

Oklab Gradient

RGB
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.rgb);

RGB Gradient

XYZ
final gradient = LinearGradientPainter(
    colors: colors, colorSpace: ColorSpace.xyz);

XYZ Gradient

카테고리

의존성

의존성 목록 2 개

소스 저장소

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

아직 데이터가 없습니다.