0% found this document useful (0 votes)
15 views2 pages

8 B

The document is a Flutter application that demonstrates various animation techniques using FadeTransition, SlideTransition, and ScaleTransition. It utilizes an AnimationController to manage animations that repeat in reverse over a duration of two seconds. The app features a simple UI with three animated containers of different colors displayed in a column layout.

Uploaded by

mdateeq807
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

8 B

The document is a Flutter application that demonstrates various animation techniques using FadeTransition, SlideTransition, and ScaleTransition. It utilizes an AnimationController to manage animations that repeat in reverse over a duration of two seconds. The app features a simple UI with three animated containers of different colors displayed in a column layout.

Uploaded by

mdateeq807
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import 'package:flutter/material.

dart';
void main() {
runApp(MyApp());}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Animation Examples',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: AnimationExamples(),
);
}
}
class AnimationExamples extends StatefulWidget {
@override
_AnimationExamplesState createState() => _AnimationExamplesState();
}
class _AnimationExamplesState extends State<AnimationExamples> with
SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _fadeAnimation;
late Animation<Offset> _slideAnimation;
late
Animation<double>
_scaleAnimation; @override void initState() {
super.initState();
_controller = AnimationController(
duration: Duration(seconds: 2),
vsync: this,
)..repeat(reverse: true);
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(_controller);
_slideAnimation = Tween<Offset>(begin: Offset(1.0, 0.0), end:
Offset.zero).animate(_controller);
_scaleAnimation = Tween<double>(begin: 0.5, end: 1.0).animate(_controller);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Animation Examples')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FadeTransition(
opacity: _fadeAnimation,
child: Container(
width: 100,
height: 100,
color: Colors.blue,
), ),
SizedBox(height: 20),
SlideTransition(
position: _slideAnimation,
child: Container(
width: 100,
height: 100,
color: Colors.red,
),
),
SizedBox(height: 20),
ScaleTransition(
scale: _scaleAnimation,
child: Container(
width: 100,
height: 100,
color: Colors.green,),),],),),);}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
}

You might also like