Search packages, repositories and app categories

smooth_corner cover
Package detailsv1.1.1

smooth_corner

A rectangular border with variable smoothness imitated from Figma.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
24.3K
Likes
64
Pub points
160

Install package

flutter pub add smooth_corner

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Smooth Corner is a Flutter package that enables developers to create rectangular borders with adjustable smoothness, closely mimicking the design aesthetics found in Figma. It provides a flexible and performant way to apply rounded or smoothly curved edges to widgets using custom clipper logic. Ideal for UI elements requiring modern, polished appearances without relying on complex image assets. The package supports all major platforms, ensuring consistent rendering across devices.

Use cases

  • Creating modern UI components with soft edges
  • Designing buttons and cards with variable corner radius
  • Implementing Figma-inspired border styles
  • Enhancing visual polish in app interfaces
  • Building reusable decorative containers
  • Matching design system requirements

Key features

  • Variable smoothness control for corners
  • Figma-style border approximation
  • Cross-platform compatibility
  • Lightweight and efficient clipper implementation
  • Easy integration via pub add
  • Supports all Flutter platforms

Suitable for

  • UI designers implementing Figma designs
  • Developers seeking clean, modern borders
  • Apps with high visual fidelity requirements
  • Projects using design tokens for consistency
  • Teams working with pixel-perfect UI replication

Considerations

  • Performance impact may increase with complex shapes
  • Limited to rectangular borders with smooth corners
  • May require testing on all target platforms
  • Not suitable for highly irregular or freeform shapes
  • Depends on accurate rendering of path-based clipping

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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

Categories

Source repository

Projects using this package

No data available yet.