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

rotated_corner_decoration 표지
패키지 상세v2.1.0+1

rotated_corner_decoration

RotatedCornerDecoration 패키지는 코너 배지를 생성하고 적용하기 위해 개발되었습니다. TextSpans의 자동 회전 기능을 제공합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
118
좋아요
113
Pub 점수
150

패키지 설치

flutter pub add rotated_corner_decoration

패키지 개요

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

RotatedCornerDecoration은 자동 텍스트 회전 기능을 갖춘 모서리 배지를 생성하고 적용하기 위해 설계된 Flutter 패키지입니다. 개발자가 위젯에 리본이나 배지와 같은 장식적인 모서리 요소를 쉽게 추가할 수 있도록 하며, 모서리에 배치되었을 때도 텍스트 레이블이 올바르게 방향을 유지하도록 보장합니다. '신제품' 또는 '세일' 태그와 같은 UI 개선에 이상적이며 Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원합니다. TextSpan의 자동 회전 기능을 사용하여 회전된 컨테이너 내부에서 텍스트를 정렬하는 과정을 간소화합니다.

사용 사례

  • 장식용 모서리 배지 추가
  • 동적 리본 레이블 만들기
  • 시각적 표시기로 UI 개선
  • 모서리에 상태 태그 표시
  • 위젯 모서리 장식 맞춤 설정
  • 프로모션 배너 제작

주요 기능

  • 자동 회전 텍스트스팬
  • 여러 플랫폼을 지원합니다
  • 기존 위젯과의 간편한 통합
  • 유연한 모서리 위치 지정
  • 최소한의 보일러플레이트 코드
  • 크로스 플랫폼 호환성

적합한 대상

  • 시각적 매력을 추구하는 UI 디자이너
  • 전자상거래 앱을 개발하는 개발자
  • 대시보드 인터페이스를 만드는 팀
  • 상태 표시기 필요 앱
  • 사용자 지정 배지 요구 사항이 있는 프로젝트

고려 사항

  • TextSpan 레이아웃 이해 필요
  • 복잡한 레이아웃에 대해 세부 조정이 필요할 수 있습니다
  • 코너 장식 사용 사례에 한정
  • 전체 화면 오버레이에 적합하지 않습니다
  • 간단한 텍스트 콘텐츠와 함께 사용하는 것이 가장 좋습니다

원본 README

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

Pay attention!

If you need a regular (not rotated) text at the corner of widgets please consider to use Stack with Containers and Text widgets.
This package was developed to provide auto rotation of TextSpans.

Example

Take a look at the provided example application for how to use the CornerDecoration.

How to use

screenshot1678647469887

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Color(0xffffd700),
    badgeSize: Size(16, 16),
  ),
),

screenshot1678647470825

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.red,
    spanBaselineShift: 4,
    badgeSize: Size(64, 64),
    badgeCornerRadius: Radius.circular(8),
    badgePosition: BadgePosition.topStart,
    textSpan: TextSpan(
      text: 'OMG',
      style: TextStyle(
        color: Colors.white,
        fontSize: 12,
        letterSpacing: 1,
        fontWeight: FontWeight.bold,
        shadows: [
          BoxShadow(color: Colors.yellowAccent, blurRadius: 8),
        ],
      ),
    ),
  ),
),

screenshot1678647471437

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.blue,
    badgeSize: Size(64, 64),
    textSpan: TextSpan(
      text: 'Multiline\nbadge',
      style: TextStyle(fontSize: 10),
    ),
  ),
),

screenshot1678647472293

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.black87,
    badgeSize: Size(64, 64),
    spanBaselineShift: 2,
    textSpan: TextSpan(
      children: [
        TextSpan(
          text: 'LOREM\n',
          style: TextStyle(
            fontSize: 10,
            fontWeight: FontWeight.bold,
            color: Colors.redAccent,
          ),
        ),
        TextSpan(
          text: 'IPSUM',
          style: TextStyle(
            fontSize: 7,
            fontStyle: FontStyle.italic,
            letterSpacing: 5,
            color: Colors.yellow,
          ),
        ),
      ],
    ),
  ),
),

screenshot1678647473029

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.brown,
    badgeSize: Size(112, 56),
    textSpan: TextSpan(
      text: 'WEIRD BADGE',
      style: TextStyle(fontSize: 10),
    ),
  ),
),

screenshot1678647473739

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.blueGrey,
    badgeSize: Size(64, 64),
    textSpan: TextSpan(
      text: 'WOW',
      style: TextStyle(fontSize: 10),
    ),
    spanHorizontalOffset: -12,
  ),
),

screenshot1678647478380

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.green,
    badgeSize: Size(64, 64),
    textSpan: TextSpan(
      text: 'SHIFT 1',
      style: TextStyle(fontSize: 10, backgroundColor: Colors.black),
    ),
  ),
),

screenshot1678647479092

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.green,
    badgeSize: Size(64, 64),
    spanBaselineShift: 3,
    textSpan: TextSpan(
      text: 'SHIFT 4',
      style: TextStyle(fontSize: 10, backgroundColor: Colors.black),
    ),
  ),
),

screenshot1678647479917

Container(
  foregroundDecoration: RotatedCornerDecoration.withGradient(
    gradient: LinearGradient(
      begin: Alignment.topRight,
      end: Alignment.bottomLeft,
      colors: [Colors.blue, Colors.lightGreenAccent],
    ),
    badgeSize: Size(64, 64),
  ),
  decoration: RotatedCornerDecoration.withGradient(
    badgePosition: BadgePosition.topStart,
    gradient: LinearGradient(
      begin: Alignment.topLeft,
      end: Alignment.topRight,
      stops: [0, 0.5, 1],
      colors: [
        Colors.purpleAccent,
        Colors.amber,
        Colors.blue,
      ],
    ),
    badgeSize: Size(64, 64),
  ),
),

screenshot1678647480605

Container(
  foregroundDecoration: RotatedCornerDecoration.withGradient(
    gradient: RadialGradient(
      center: Alignment.topRight,
      radius: 1.5,
      stops: const [0, 0.25, 0.5],
      colors: [
        Colors.redAccent,
        Colors.redAccent.withOpacity(0.5),
        Colors.redAccent.withOpacity(0),
      ],
    ),
    badgeSize: const Size(64, 64),
  ),
  decoration: RotatedCornerDecoration.withGradient(
    badgePosition: BadgePosition.topStart,
    gradient: SweepGradient(
      center: const FractionalOffset(0.27, -0.65),
      colors: List.generate(360, _generator),
    ),
    badgeSize: const Size(64, 64),
  ),
),

screenshot1678647483564

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.lightBlue,
    badgeSize: Size(64, 64),
    badgeShadow: BadgeShadow(color: Colors.black, elevation: 4),
  ),
),

screenshot1678647484300

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.indigo,
    badgeSize: Size(64, 64),
    badgePosition: BadgePosition.bottomStart,
    textDirection: TextDirection.ltr,
  ),
),

screenshot1678647485147

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.indigo,
    badgeSize: Size(64, 64),
    badgePosition: BadgePosition.bottomStart,
    textDirection: TextDirection.rtl,
  ),
),

EXPERIMENTAL FEATURE!

use isEmoji: true to disable span rotating
you can shift span position with spanHorizontalOffset and TextStyle.height parameters screenshot1678649657350

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.purple,
    badgeSize: Size(64, 64),
    isEmoji: true,
    textSpan: TextSpan(
      text: '🤮',
      style: TextStyle(fontSize: 20, height: 1.7),
    ),
  ),
),

카테고리

소스 저장소

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

아직 데이터가 없습니다.