path_animation 1.1.1
path_animation: ^1.1.1 copied to clipboard
A Flutter package, path animation - that is used to moving the widget on given path.
import 'package:flutter/material.dart';
import 'solar_syatem_animation.dart';
import 'vortex_animation.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Path Animation',
theme: ThemeData(
primarySwatch: Colors.blue,
brightness: Brightness.dark,
),
home: const ExamplesPage(),
debugShowCheckedModeBanner: false,
);
}
}
class ExamplesPage extends StatelessWidget {
const ExamplesPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Path Animation Example'),
),
body: SingleChildScrollView(
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildAnimationButton(context, 'Solar System Animation',
const SolarSystemAnimation(title: 'Solar System')),
_buildAnimationButton(
context, 'Vortex Animation', const VortexAnimation()),
],
),
),
),
),
);
}
Widget _buildAnimationButton(
BuildContext context, String title, Widget destination) {
return Padding(
padding: const EdgeInsets.only(bottom: 20.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size(200, 50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => destination),
);
},
child: Text(
title,
style: const TextStyle(fontSize: 16),
),
),
);
}
}