Skip to content

Commit 6e9b393

Browse files
author
srinivas
committed
add description for the fields
1 parent e650405 commit 6e9b393

File tree

2 files changed

+53
-17
lines changed

2 files changed

+53
-17
lines changed

lib/components/animation/gf_animation.dart

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
import 'package:flutter/material.dart';
2-
3-
enum GFAnimationType {
4-
align,
5-
size,
6-
container,
7-
rotateTransition,
8-
scaleTransition,
9-
slideTransition,
10-
textStyle
11-
}
2+
import 'package:getwidget/types/gf_animation_type.dart';
123

134
class GFAnimation extends StatefulWidget {
145
const GFAnimation({
@@ -36,22 +27,50 @@ class GFAnimation extends StatefulWidget {
3627
this.textOverflow,
3728
this.maxLines,
3829
this.textWidthBasis,
30+
this.fontSize,
31+
this.fontWeight,
3932
}) : super(key: key);
4033

34+
/// The duration for animations of the [Decoration].
4135
final Duration duration;
36+
37+
/// Defines how the animated widget is aligned within the Animation.
4238
final Alignment alignment;
39+
40+
/// Defines how the animated widget is aligned(after the onTap) within the Animation.
4341
final Alignment activeAlignment;
42+
43+
/// The child of type [Widget] to display animation effect.
4444
final Widget child;
45+
46+
/// Determines the animation curve physics. Defaults to [Curves.linear].
4547
final Curve curve;
48+
49+
///type of [GFAnimation] which takes the type ie, align, size, container, rotateTransition, scaleTransition, slideTransition, and textStyle for the [GFAnimation]
4650
final GFAnimationType type;
51+
4752
final double width;
4853
final double height;
4954
final Color activeColor;
55+
56+
/// defines the color of items
5057
final Color color;
51-
final EdgeInsets padding, margin;
58+
59+
/// The empty space that surrounds the animation. Defines the animation outer [Container.padding]..
60+
final EdgeInsetsGeometry padding;
61+
62+
/// The empty space that surrounds the animation. Defines the animation outer [Container.margin].
63+
final EdgeInsetsGeometry margin;
5264
final Function onTap;
65+
66+
/// Here's an illustration of the [RotationTransition] widget, with it's [turnsAnimation]
67+
/// animated by a [Tween] set to [animate]:
5368
final Animation<double> turnsAnimation;
69+
70+
/// Here's an illustration of the [ScaleTransition] widget, with it's [scaleAnimation]
71+
/// animated by a [CurvedAnimation] set to [Curves.linear]:
5472
final Animation<double> scaleAnimation;
73+
5574
final AnimationController controller;
5675
final TextDirection textDirection;
5776
final Animation<Offset> slidePosition;
@@ -60,6 +79,8 @@ class GFAnimation extends StatefulWidget {
6079
final TextOverflow textOverflow;
6180
final int maxLines;
6281
final TextWidthBasis textWidthBasis;
82+
final double fontSize;
83+
final FontWeight fontWeight;
6384

6485
@override
6586
_GFAnimationState createState() => _GFAnimationState();
@@ -111,6 +132,12 @@ class _GFAnimationState extends State<GFAnimation>
111132
super.initState();
112133
}
113134

135+
@override
136+
void dispose() {
137+
controller.dispose();
138+
super.dispose();
139+
}
140+
114141
@override
115142
Widget build(BuildContext context) => getAnimatedTypeWidget();
116143

@@ -196,14 +223,14 @@ class _GFAnimationState extends State<GFAnimation>
196223
);
197224

198225
Widget buildAnimatedDefaultTextStyleWidget() => GestureDetector(
199-
onTap: () {
200-
if (mounted) {
201-
setState(() {});
202-
}
203-
},
226+
onTap: widget.onTap,
204227
child: AnimatedDefaultTextStyle(
205228
maxLines: widget.maxLines,
206-
style: widget.style ?? const TextStyle(),
229+
style: widget.style ??
230+
TextStyle(
231+
fontWeight: widget.fontWeight ?? FontWeight.normal,
232+
fontSize: widget.fontSize ?? 16,
233+
color: widget.color ?? Colors.blue),
207234
textWidthBasis: widget.textWidthBasis ?? TextWidthBasis.parent,
208235
textAlign: widget.textAlign ?? TextAlign.start,
209236
curve: widget.curve ?? Curves.linear,

lib/types/gf_animation_type.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
enum GFAnimationType {
2+
align,
3+
size,
4+
container,
5+
rotateTransition,
6+
scaleTransition,
7+
slideTransition,
8+
textStyle
9+
}

0 commit comments

Comments
 (0)