Professional Documents
Culture Documents
Name: Om Badhe
Roll No: 01
Sub- MAD&PWA
Class-TE IT Sem- VI
Date of display: 21-02-24
Date of submission: 12-03-24
Assignment 1: MAD: To build interactive App by including Flutter Gestures and Animations
Theory:
Flutter provides built-in support for handling gestures and creating animations, making it easy to
create interactive and visually appealing user interfaces.
Gestures in Flutter:
These gesture recognizers are used to detect user actions on widgets, enabling developers to create
interactive elements in their apps.
Gesture detection in Flutter is highly customizable, allowing developers to specify different callbacks
for various gestures and fine-tune gesture recognition parameters like sensitivity and velocity.
Animations in Flutter:
Flutter provides powerful animation APIs that allow developers to create smooth and fluid
animations to enhance the user experience.
Animations in Flutter can be applied to any property of a widget, including size, position, opacity,
rotation, and more.
There are various ways to create animations in Flutter, such as using explicit animation controllers
(`AnimationController`), implicit animations (e.g., `AnimatedContainer`, `AnimatedOpacity`), physics-
based animations (e.g., `AnimatedAlign`, `AnimatedPositioned`), and custom animations using
`Animation` objects.
Flutter's animation system is declarative, meaning that developers describe how animations should
behave rather than manually updating widget properties over time.
Flutter's animation APIs support complex animations with features like curves (e.g.,
`Curves.easeInOut`), tweens (e.g., `Tween`), interpolation, chaining animations, and more.
Code: Flutter Gesture and Animation Example: Interactive Box Scaling
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
@override
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
@override
@override
return Scaffold(
appBar: AppBar(
),
body: Center(
child: GestureDetector(
onTap: () {
setState(() {
});
},
child: AnimatedContainer(
curve: Curves.easeInOut,
color: Colors.blue,
child: Center(
child: Text(
'Tap me!',
),
),
),
),
),
);
}
OUTPUT: