auto_smooth_corners 1.1.1
auto_smooth_corners: ^1.1.1 copied to clipboard
A Flutter package for creating smooth, customizable corners in your UI with support for various corner styles and animations.
auto_smooth_corners #

A Flutter package for highly customizable, dynamic smooth corners (iOS-style squircle) with per-corner control.
Features #
- Dynamic smoothing:
smoothingFactorscales with widget size - Per-corner smoothing:
AutoSmoothBorderRadius.only(...) - Drop-in widgets:
AutoSmoothContainer,AutoSmoothClipRRect,AutoSmoothCard - Global configuration: Set default smooth corner settings app-wide
- Easy integration with existing Flutter widgets
- MIT licensed and open source
Getting Started #
Add to your pubspec.yaml:
dependencies:
auto_smooth_corners:
path: ./
Import in your Dart code:
import 'package:auto_smooth_corners/auto_smooth_corners.dart';
Basic Example #
import 'package:flutter/material.dart';
import 'package:auto_smooth_corners/auto_smooth_corners.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.grey[200],
body: Center(
child: AutoSmoothContainer(
width: 120,
height: 60,
color: Colors.blue,
smoothingFactor: 0.25, // 25% of min(width, height)
autoSmoothBorderRadius: AutoSmoothBorderRadius.all(0.2),
child: const Center(child: Text('Smooth Container', style: TextStyle(color: Colors.white))),
),
),
),
);
}
}
Global Configuration #
You can set global default values for smooth corners that will be used throughout your app:
void main() {
runApp(
SmoothCornerProvider(
defaultSmoothingFactor: 0.8, // Default smoothness for all widgets
defaultAutoSmoothBorderRadius: AutoSmoothBorderRadius.all(0.2), // Default border radius
child: const MyApp(),
),
);
}
Individual widgets can still override these defaults:
AutoSmoothContainer(
width: 120,
height: 60,
color: Colors.blue,
smoothingFactor: 0.5, // Override global default
child: const Text('Custom Smoothing'),
)
API Reference #
Widgets #
AutoSmoothContainer: LikeContainer, but with smooth cornersAutoSmoothClipRRect: LikeClipRRect, but with smooth cornersAutoSmoothCard: LikeCard, but with smooth corners
Global Configuration #
SmoothCornerProvider: Widget to provide global smooth corner configurationSmoothCornerConfig: Configuration class for global smooth corner settings
Advanced #
AutoSmoothRectangleBorder: CustomShapeBorderfor advanced useAutoSmoothBorderRadius: Per-corner smoothing factors
License #
MIT
Author #
sdkwala.com