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

smooth_corner 표지
패키지 상세v1.1.1

smooth_corner

Figma에서 영감을 받은 변수 평활도를 가진 사각형 테두리.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.4만
좋아요
64
Pub 점수
160

패키지 설치

flutter pub add smooth_corner

패키지 개요

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

Smooth Corner는 Flutter 패키지로, 조정 가능한 부드러움을 가진 사각형 테두리를 만들 수 있게 해주며, Figma에서 볼 수 있는 디자인 미학을 거의 완벽하게 재현합니다. 사용자 정의 클리퍼 로직을 활용하여 위젯에 둥근 모서리나 부드럽게 곡선 처리된 가장자리를 적용하는 유연하고 성능이 우수한 방법을 제공합니다. 복잡한 이미지 자산에 의존하지 않고도 현대적이고 세련된 외관을 원하는 UI 요소에 이상적입니다. 이 패키지는 모든 주요 플랫폼을 지원하며 장치 간 일관된 렌더링을 보장합니다.

사용 사례

  • 부드러운 에지로 현대적인 UI 컴포넌트 만들기
  • 변경 가능한 모서리 반지름을 가진 버튼과 카드 디자인
  • Figma 스타일의 테두리 스타일 구현
  • 앱 인터페이스의 시각적 완성도 향상
  • 재사용 가능한 장식용 컨테이너 만들기
  • 디자인 시스템 요구사항 준수

주요 기능

  • 모서리에 대한 변수 부드러움 조절
  • Figma 스타일의 테두리 근사
  • 크로스 플랫폼 호환성
  • 경량이고 효율적인 클리퍼 구현
  • pub add를 통한 간편한 통합
  • 모든 플러터 플랫폼을 지원합니다

적합한 대상

  • Figma 디자인을 구현하는 UI 디자이너
  • 깨끗하고 현대적인 테두리를 찾는 개발자
  • 시각적 정밀도 요구 사항이 높은 앱
  • 일관성을 위해 디자인 토큰을 사용하는 프로젝트
  • 픽셀 완벽한 UI 복제 작업 중인 팀

고려 사항

  • 복잡한 모양일수록 성능에 미치는 영향이 커질 수 있습니다
  • 둥근 모서리가 있는 사각형 테두리로 제한
  • 모든 대상 플랫폼에서 테스트가 필요할 수 있습니다
  • 매우 불규칙하거나 자유형태의 형상에는 적합하지 않습니다
  • 경로 기반 클리핑의 정확한 렌더링에 의존

원본 README

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

Language: English | 中文简体

smooth_corner

Pub

Implement smooth iOS-style rounded corners in Flutter, mimicking Figma's "corner smoothing" feature. The algorithm is also inspired by Figma's blog post "Desperately seeking squircles".

The principle involves combining two Bezier curves and an arc to create smooth corners. Similar to Figma, the smoothness is adjustable. When the smoothness parameter is 0, it represents a normal rounded rectangle, and when the parameter is 1, the rounded corners are composed of only two Bezier curves, approaching a superellipse.

You can view the debug rounded corner components and image examples I wrote in the example project, adjusting their smoothness and corner size to observe the changes in the corner curves.

Example screen shot

Usage

Add dependency
dependencies:
  smooth_corner: ^1.1.1
Built-in Widgets

This library provides several commonly used widgets that allow you to adjust smooth rounded corners.

All widgets provide three parameters: smoothness, side, and borderRadius, to control smooth corners and borders.

  • smoothness: Represents the smoothness, ranging from [0, 1.0]. According to Figma's standards, 0.6 is the closest to iOS's rounded corner curve.

  • side: Type is BorderSide, used to set borders.

  • borderRadius: Used to set the corner radius. Note that if the x and y values of the radius are not equal, the smaller one will be chosen.

SmoothContainer

SmoothContainer includes all the parameters of Container.

SmoothContainer(
  width: 200,
  height: 200,
  smoothness: 0.6,
  side: BorderSide(color: Colors.cyan, width: 2),
  borderRadius: BorderRadius.circular(40),
  child: child,
  alignment: Alignment.center,
),
SmoothClipRRect

To enable images to have borders, SmoothClipRRect is provided.

SmoothClipRRect(
  smoothness: 0.6,
  side: BorderSide(color: Colors.deepOrange, width: 4),
  borderRadius: BorderRadius.circular(40),
  child: Image.network(
    url,
    fit: BoxFit.cover,
  ),
SmoothCard

SmoothCard includes all parameters of Card.

SmoothCard(
  smoothness: 0.6,
  borderRadius: BorderRadius.circular(40),
  elevation: 6,
  child: child,
),
Custom widget

The smooth corner capabilities of the above widgets are implemented by SmoothRectangleBorder. You can use this ShapeBorder to freely customize your smooth corner components.

ShapeDecoration
Container(
  width: 200,
  height: 200,
  alignment: Alignment.center,
  decoration: ShapeDecoration(
    shape: SmoothRectangleBorder(
      borderRadius: BorderRadius.circular(40),
      smoothness: 0.6,
    ),
    color: Colors.amber,
  ),
  child: Text(''),
),
ShapeBorderClipper
Container(
  width: 200,
  height: 200,
  child: ClipPath(
    clipper: ShapeBorderClipper(
      shape: SmoothRectangleBorder(
        smoothness: 0.6,
        borderRadius:
            BorderRadius.circular(40),
      ),
    ),
    child: Image.network(url),
  ),
),

카테고리

소스 저장소

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

아직 데이터가 없습니다.