A beautiful Flutter application showcasing 5 stunning animated border effects built entirely with Flutter's CustomPainter API. No external packages required β just pure Flutter magic! π¨
Watch the live demo: https://streamable.com/vq3dsc
This showcase demonstrates 5 unique animated border designs:
| # | Border Style | Description |
|---|---|---|
| 1 | Neon Sweep | A mesmerizing rotating gradient border with cyan, purple, and blue neon colors using SweepGradient |
| 2 | The Comet | A comet-like trailing effect with an orange accent that orbits around the card |
| 3 | Tech Corners | Futuristic animated corner brackets with pulsing length animation β perfect for sci-fi UIs |
| 4 | Breathing | A pulsing/breathing border effect with dynamic blur, opacity, and stroke width changes |
| 5 | Dual Spin | A spinning gradient border with cyan accent and smooth rotation |
- Framework: Flutter SDK ^3.10.4
- Language: Dart
- Dependencies: None (Pure Flutter β only uses
cupertino_iconsfor icons) - Key APIs Used:
CustomPainterβ For drawing custom border graphicsAnimationControllerβ For smooth, continuous animationsSweepGradientβ For creating rotating gradient effectsMaskFilterβ For blur effects on the breathing border
CustomPainter_Border_Design/
βββ README.md # This file
βββ demo_border_showcase_image.png # App screenshot
βββ border_demo_showwcase.mov # Demo video
βββ frontend/ # Flutter application
βββ lib/
β βββ main.dart # Main application code
βββ pubspec.yaml # Flutter dependencies
βββ android/ # Android platform files
βββ ios/ # iOS platform files
βββ web/ # Web platform files
βββ linux/ # Linux platform files
βββ windows/ # Windows platform files
- Flutter SDK (^3.10.4 or higher)
- A code editor (VS Code, Android Studio, etc.)
- An emulator/simulator or physical device
-
Clone the repository:
git clone https://github.com/yourusername/CustomPainter_Border_Design.git cd CustomPainter_Border_Design/frontend -
Install dependencies:
flutter pub get
-
Run the app:
flutter run
# Android
flutter run -d android
# iOS
flutter run -d ios
# Web
flutter run -d chrome
# Desktop (macOS/Linux/Windows)
flutter run -d macos
flutter run -d linux
flutter run -d windowsThe app uses a single _UniversalBorderPainter class that handles all 5 border types:
class _UniversalBorderPainter extends CustomPainter {
final double animationValue;
final BorderType type;
@override
void paint(Canvas canvas, Size size) {
switch (type) {
case BorderType.neonSweep:
// Rotating SweepGradient with neon colors
paint.shader = SweepGradient(
colors: [Colors.cyan, Colors.purple, Colors.blue, Colors.cyan],
transform: GradientRotation(animationValue * 2 * pi),
).createShader(rect);
break;
// ... other border types
}
}
}Each card uses a SingleTickerProviderStateMixin with a repeating animation:
_controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 3)
)..repeat();| Platform | Status |
|---|---|
| Android | β Supported |
| iOS | β Supported |
| Web | β Supported |
| Windows | β Supported |
- Learning Resource: Perfect for understanding Flutter's
CustomPainterAPI - UI Inspiration: Use these border designs in your own projects
- Component Library: Extract and customize individual border styles
- Portfolio Piece: Showcase Flutter animation capabilities
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-border-style) - Commit your changes (
git commit -m 'Add new border style') - Push to the branch (
git push origin feature/new-border-style) - Open a Pull Request
If you have any questions or suggestions, feel free to open an issue or reach out!
Made with β€οΈ using Flutter
