forked from md-siam/widget_of_the_day
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimated_padding.dart
65 lines (62 loc) · 2.02 KB
/
animated_padding.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import 'package:flutter/material.dart';
class MyAnimatedPadding extends StatefulWidget {
const MyAnimatedPadding({Key? key}) : super(key: key);
@override
State<MyAnimatedPadding> createState() => _MyAnimatedPaddingState();
}
class _MyAnimatedPaddingState extends State<MyAnimatedPadding> {
double padValue = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurple[100],
appBar: AppBar(title: const Text('Animated Padding')),
body: Column(
children: [
AnimatedPadding(
padding: EdgeInsets.all(padValue),
duration: const Duration(seconds: 1),
curve: Curves.bounceOut,
child: Image.asset('assets/images/cow.jpeg'),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
onPressed: () {
setState(() {
padValue = 50;
});
},
icon: const Icon(
Icons.zoom_out,
color: Colors.blue,
),
),
IconButton(
onPressed: () {
setState(() {
padValue = 0;
});
},
icon: const Icon(
Icons.zoom_in,
color: Colors.blue,
),
),
],
),
const Padding(
padding: EdgeInsets.only(left: 20.0, right: 20.0),
child: Text(
'''Cow, in common parlance, a domestic bovine, regardless of sex and age, usually of the species Bos taurus. In precise usage, the name is given to mature females of several large mammals, including cattle (bovines), moose, elephants, sea lions, and whales.
''',
style: TextStyle(fontSize: 16),
textAlign: TextAlign.justify,
),
)
],
),
);
}
}