flutter_physics_ui
Physics-based UI elements that respond to touch and gravity. Create engaging, interactive user interfaces with realistic physics simulations.
Features
- 🎯 Touch Responsive: UI elements respond naturally to touch interactions
- 🌍 Gravity Physics: Realistic gravity effects and physics simulations
- 📱 Multi-Platform: Supports all 6 platforms (iOS, Android, Web, Windows, macOS, Linux)
- ⚡ WASM Compatible: Optimized web performance with WebAssembly
- 🚀 High Performance: Built with Flutter's rendering engine for smooth animations
- 🎨 Customizable: Easy to customize physics parameters and visual styles
Platform Support
| Platform | Status | Notes |
|---|---|---|
| iOS | ✅ Supported | Full physics engine support |
| Android | ✅ Supported | Optimized for mobile performance |
| Web | ✅ Supported | WASM compatible for best performance |
| Windows | ✅ Supported | Native Windows physics rendering |
| macOS | ✅ Supported | Native macOS physics rendering |
| Linux | ✅ Supported | Native Linux physics rendering |
Getting Started
Installation
Add this to your package's pubspec.yaml file:
dependencies:
flutter_physics_ui: ^0.0.1
Basic Usage
import 'package:flutter/material.dart';
import 'package:flutter_physics_ui/flutter_physics_ui.dart';
class PhysicsExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Physics UI Example')),
body: Center(
child: PhysicsContainer(
child: Text('Touch me!'),
physics: PhysicsProperties(
gravity: 9.8,
friction: 0.8,
restitution: 0.7,
),
),
),
);
}
}
API Reference
PhysicsContainer
A container widget that applies physics effects to its child.
PhysicsContainer({
required Widget child,
PhysicsProperties? physics,
VoidCallback? onTap,
VoidCallback? onPhysicsUpdate,
})
PhysicsProperties
Configuration for physics behavior.
PhysicsProperties({
double gravity = 9.8,
double friction = 0.5,
double restitution = 0.8,
Vector2? initialVelocity,
bool enableRotation = true,
})
Examples
Check out the example/ directory for complete working examples:
- Basic physics container
- Interactive physics playground
- Custom physics behaviors
- Platform-specific optimizations
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please:
- Check the issue tracker
- Create a new issue with detailed information
- Join our community discussions
Made with ❤️ by Dhia Bechattaoui
Libraries
- flutter_physics_ui
- A Flutter package providing physics-based UI elements that respond to touch and gravity.