Skip to content

Commit

Permalink
Merge pull request #6 from aagarwal1012/on_tap_event
Browse files Browse the repository at this point in the history
On tap event
  • Loading branch information
aagarwal1012 committed Sep 19, 2018
2 parents b2c96b6 + 7526dd7 commit 07a6f26
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 23 deletions.
18 changes: 18 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class _MyHomePageState extends State<MyHomePage> {
height: 100.0,
),
RotateAnimatedTextKit(
onTap: () {
print("Tap Event");
},
text: ["AWESOME", "OPTIMISTIC", "DIFFERENT"],
textStyle: TextStyle(fontSize: 40.0, fontFamily: "Horizon"),
),
Expand All @@ -73,12 +76,18 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
FadeAnimatedTextKit(
onTap: () {
print("Tap Event");
},
text: ["do IT!", "do it RIGHT!!", "do it RIGHT NOW!!!"],
textStyle: TextStyle(fontSize: 32.0, fontWeight: FontWeight.bold),
),
SizedBox(
width: 250.0,
child: TyperAnimatedTextKit(
onTap: () {
print("Tap Event");
},
text: [
"It is not enough to do your best,",
"you must know what to do,",
Expand All @@ -91,6 +100,9 @@ class _MyHomePageState extends State<MyHomePage> {
SizedBox(
width: 250.0,
child: TypewriterAnimatedTextKit(
onTap: () {
print("Tap Event");
},
text: [
"Discipline is the best tool",
"Design first, then code",
Expand All @@ -101,12 +113,18 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
ScaleAnimatedTextKit(
onTap: () {
print("Tap Event");
},
text: ["Think", "Build", "Ship"],
textStyle: TextStyle(fontSize: 70.0, fontFamily: "Canterbury"),
),

/// colors.length >= 2
ColorizeAnimatedTextKit(
onTap: () {
print("Tap Event");
},
text: [
"Larry Page",
"Bill Gates",
Expand Down
4 changes: 1 addition & 3 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
void main() {

}
void main() {}
11 changes: 8 additions & 3 deletions lib/src/colorize.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ class ColorizeAnimatedTextKit extends StatefulWidget {
final List<Color> colors;
final TextStyle textStyle;
final Duration duration;
final VoidCallback onTap;

const ColorizeAnimatedTextKit(
{Key key,
@required this.text,
this.textStyle,
@required this.colors,
this.duration})
this.duration,
this.onTap})
: super(key: key);

@override
Expand Down Expand Up @@ -125,8 +127,11 @@ class _RotatingTextState extends State<ColorizeAnimatedTextKit>

return SizedBox(
height: 80.0,
child: Stack(
children: _textWidgetList,
child: GestureDetector(
onTap: widget.onTap,
child: Stack(
children: _textWidgetList,
),
),
);
}
Expand Down
14 changes: 11 additions & 3 deletions lib/src/fade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ class FadeAnimatedTextKit extends StatefulWidget {
final List<String> text;
final TextStyle textStyle;
final Duration duration;
final VoidCallback onTap;

const FadeAnimatedTextKit(
{Key key, @required this.text, this.textStyle, this.duration})
{Key key,
@required this.text,
this.textStyle,
this.duration,
this.onTap})
: super(key: key);

@override
Expand Down Expand Up @@ -82,8 +87,11 @@ class _RotatingTextState extends State<FadeAnimatedTextKit>
));
}

return Stack(
children: textWidgetList,
return GestureDetector(
onTap: widget.onTap,
child: Stack(
children: textWidgetList,
),
);
}
}
15 changes: 10 additions & 5 deletions lib/src/rotate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ class RotateAnimatedTextKit extends StatefulWidget {
final TextStyle textStyle;
final Duration duration;
final double transitionHeight;
final VoidCallback onTap;

const RotateAnimatedTextKit(
{Key key,
@required this.text,
this.textStyle,
this.transitionHeight,
this.duration})
this.duration,
this.onTap})
: super(key: key);

@override
Expand Down Expand Up @@ -130,10 +132,13 @@ class _RotatingTextState extends State<RotateAnimatedTextKit>
));
}

return SizedBox(
height: _transitionHeight,
child: Stack(
children: textWidgetList,
return GestureDetector(
onTap: widget.onTap,
child: SizedBox(
height: _transitionHeight,
child: Stack(
children: textWidgetList,
),
),
);
}
Expand Down
11 changes: 8 additions & 3 deletions lib/src/scale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ class ScaleAnimatedTextKit extends StatefulWidget {
final TextStyle textStyle;
final Duration duration;
final double scalingFactor;
final VoidCallback onTap;

const ScaleAnimatedTextKit(
{Key key,
@required this.text,
this.textStyle,
this.scalingFactor = 0.5,
this.duration})
this.duration,
this.onTap})
: super(key: key);

@override
Expand Down Expand Up @@ -109,8 +111,11 @@ class _RotatingTextState extends State<ScaleAnimatedTextKit>
));
}

return Stack(
children: textWidgetList,
return GestureDetector(
onTap: widget.onTap,
child: Stack(
children: textWidgetList,
),
);
}
}
14 changes: 11 additions & 3 deletions lib/src/typer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ class TyperAnimatedTextKit extends StatefulWidget {
final List<String> text;
final TextStyle textStyle;
final Duration duration;
final VoidCallback onTap;

const TyperAnimatedTextKit(
{Key key, @required this.text, this.textStyle, this.duration})
{Key key,
@required this.text,
this.textStyle,
this.duration,
this.onTap})
: super(key: key);

@override
Expand Down Expand Up @@ -89,8 +94,11 @@ class _TyperState extends State<TyperAnimatedTextKit>
));
}

return Stack(
children: textWidgetList,
return GestureDetector(
onTap: widget.onTap,
child: Stack(
children: textWidgetList,
),
);
}
}
14 changes: 11 additions & 3 deletions lib/src/typewriter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ class TypewriterAnimatedTextKit extends StatefulWidget {
final List<String> text;
final TextStyle textStyle;
final Duration duration;
final VoidCallback onTap;

TypewriterAnimatedTextKit(
{Key key, @required this.text, this.textStyle, this.duration})
{Key key,
@required this.text,
this.textStyle,
this.duration,
this.onTap})
: super(key: key);

@override
Expand Down Expand Up @@ -117,8 +122,11 @@ class _TypewriterState extends State<TypewriterAnimatedTextKit>
));
}

return Stack(
children: textWidgetList,
return GestureDetector(
onTap: widget.onTap,
child: Stack(
children: textWidgetList,
),
);
}
}

0 comments on commit 07a6f26

Please sign in to comment.