antigravity_motion 0.0.1+3
antigravity_motion: ^0.0.1+3 copied to clipboard
A premium Flutter package for weightless, floating, and spring-based motion effects. Elevate your UI with gravity-defying animations, smooth cubic easing, and interactive spring physics. Ideal for imm [...]
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:antigravity_motion/antigravity_motion.dart';
void main() {
runApp(const AntigravityExampleApp());
}
class AntigravityExampleApp extends StatelessWidget {
const AntigravityExampleApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.deepPurple,
useMaterial3: true,
),
home: const MotionShowcasePage(),
);
}
}
class MotionShowcasePage extends StatelessWidget {
const MotionShowcasePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Antigravity Motion'),
centerTitle: true,
backgroundColor: Colors.transparent,
elevation: 0,
),
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF0F0C29), Color(0xFF302B63), Color(0xFF24243E)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: GridView.count(
padding: const EdgeInsets.all(24),
crossAxisCount: MediaQuery.of(context).size.width > 600 ? 3 : 1,
mainAxisSpacing: 32,
crossAxisSpacing: 32,
children: const [
_ExampleSection(
title: 'Space',
subtitle: 'Slow & Ethereal',
floatingRange: 30.0,
duration: Duration(milliseconds: 4000),
icon: Icons.rocket_launch,
color: Colors.blueAccent,
),
_ExampleSection(
title: 'Water',
subtitle: 'Fast & Buoyant',
floatingRange: 15.0,
duration: Duration(milliseconds: 1200),
icon: Icons.waves,
color: Colors.cyanAccent,
),
_ExampleSection(
title: 'Pulse',
subtitle: 'Interactive & Responsive',
floatingRange: 5.0,
duration: Duration(milliseconds: 800),
icon: Icons.vibration,
color: Colors.pinkAccent,
),
],
),
),
);
}
}
class _ExampleSection extends StatelessWidget {
final String title;
final String subtitle;
final double floatingRange;
final Duration duration;
final IconData icon;
final Color color;
const _ExampleSection({
required this.title,
required this.subtitle,
required this.floatingRange,
required this.duration,
required this.icon,
required this.color,
});
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
letterSpacing: 1.2,
),
),
const SizedBox(height: 8),
Text(
subtitle,
style: TextStyle(color: Colors.white.withAlpha(150), fontSize: 14),
),
const SizedBox(height: 32),
AntigravityWrapper(
floatingRange: floatingRange,
duration: duration,
child: Card(
elevation: 12,
shadowColor: color.withAlpha(100),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
side: BorderSide(color: color.withAlpha(50), width: 1.5),
),
child: Container(
width: 150,
height: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
gradient: LinearGradient(
colors: [color.withAlpha(30), color.withAlpha(10)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Icon(icon, size: 64, color: color),
),
),
),
],
);
}
}