<p>In this article, I'm going to share an example on AnimatedPadding Widget. Using AnimatedPadding Widget, you can animate the padding of the child widgets for the given duration.</p> <p>Here is how the final output is going to look. ; background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre-wrap;](color: #569cd6;](import color: #ce9178;]('package:flutter/material.dart'; color: #569cd6;](void main() => runApp(MyApp()); color: #569cd6;](class MyApp color: #569cd6;](extends StatefulWidget { color: #569cd6;](@override _MyAppState createState() => _MyAppState();} color: #569cd6;](class _MyAppState color: #569cd6;](extends State { double padValue = color: #b5cea8;](0; color: #569cd6;](@override Widget build(BuildContext context) { color: #569cd6;](return MaterialApp( home: Scaffold( appBar: AppBar( title: Text(color: #ce9178;]("AnimatedPadding"), ), body: Column( children: [ Expanded( child: AnimatedPadding( child: Container( color: Colors.red, ), duration: color: #569cd6;](const Duration(seconds: color: #b5cea8;](1), padding: EdgeInsets.all(padValue), curve: Curves.easeInOut, ), ), Text(color: #ce9178;]('Padding Value: $padValue'), ButtonBar( alignment: MainAxisAlignment.center, children: [ RaisedButton( child: Text(color: #ce9178;]('Add Padding'), onPressed: () { setState(() { padValue = padValue + color: #b5cea8;](10; }); }, ), RaisedButton( child: Text(color: #ce9178;]('Sub Padding'), onPressed: () { setState(() { color: #569cd6;](if(padValue != color: #b5cea8;](0) { padValue = padValue - color: #b5cea8;](10; } }); }, ) ], )<br /> ], ), ), ); }}</p> <p>Thanks,Srikanth</p>
AnimatedPadding Example in Flutter
This Article is posted by seven.srikanth at 8/22/2019 3:56:17 AM
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter
Tags: AnimatedPadding; Animation in Flutter;
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter