particles_flutter 0.1.1 particles_flutter: ^0.1.1 copied to clipboard
A flutter package for particle animation.
import 'package:flutter/material.dart';
import 'package:particles_flutter/particles_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
backgroundColor: Colors.white70,
body: CircularParticleScreen(),
));
}
}
class CircularParticleScreen extends StatelessWidget {
const CircularParticleScreen({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
double screenHeight = MediaQuery.of(context).size.height;
double screenWidth = MediaQuery.of(context).size.width;
return Center(
child: Container(
height: 350,
width: 350,
child: Center(
child: CircularParticle(
awayRadius: 80,
numberOfParticles: 200,
speedOfParticles: 1,
height: screenHeight,
width: screenWidth,
onTapAnimation: true,
particleColor: Colors.white.withAlpha(150),
awayAnimationDuration: Duration(milliseconds: 600),
maxParticleSize: 8,
isRandSize: true,
isRandomColor: true,
randColorList: [
Colors.red.withAlpha(210),
Colors.white.withAlpha(210),
Colors.yellow.withAlpha(210),
Colors.green.withAlpha(210)
],
awayAnimationCurve: Curves.easeInOutBack,
enableHover: true,
hoverColor: Colors.white,
hoverRadius: 90,
connectDots: false, //not recommended
),
),
),
);
}
}