motion_widget 1.0.2 motion_widget: ^1.0.2 copied to clipboard
A simple, powerful widget to build cool transitions. It handles initialization, state changes, code clean-ups and all the other animation boilerplate code, keeping you in the driver's seat by allowing [...]
import 'package:flutter/material.dart';
import 'package:motion_widget/motion_widget.dart';
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
MotionExitConfigurations motionExitConfigurations;
@override
void initState() {
super.initState();
motionExitConfigurations =
MotionExitConfigurations(durationMs: 500, displacement: 50);
Future.delayed(Duration(seconds: 2), () {
motionExitConfigurations.controller.addStatusListener((status) {
if (status == AnimationStatus.completed)
Navigator.pushReplacement(context,
PageRouteBuilder(pageBuilder: (_, __, ___) => SplashScreen()));
});
motionExitConfigurations.controller.forward();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Motion<Row>(
mainAxisSize: MainAxisSize.min,
exitConfigurations: motionExitConfigurations,
children: <Widget>[
MotionElement(
child: Text(
"Introducing\nMotion Widget",
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25),
),
orientation: MotionOrientation.RIGHT,
interval: Interval(0.0, 0.5),
),
SizedBox(
width: 20,
),
MotionElement(
child: FlutterLogo(size: 50),
interval: Interval(0.5, 1.0, curve: Curves.easeOutBack),
)
],
)));
}
}