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

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 を通じた簡単な統合
  • すべての Flutter プラットフォームをサポートしています

適している対象

  • 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),
  ),
),

カテゴリー

ソースリポジトリ

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

データはまだありません。