From 1a9b69c7cc955631d624502282a383a8caac23d7 Mon Sep 17 00:00:00 2001 From: Anders Cheow Date: Mon, 7 Jan 2019 10:44:30 +0800 Subject: [PATCH 1/5] Added alignment property to Stack and textAlign property to Text --- lib/src/colorize.dart | 8 ++++++++ lib/src/fade.dart | 8 ++++++++ lib/src/rotate.dart | 8 ++++++++ lib/src/scale.dart | 8 ++++++++ lib/src/typer.dart | 8 ++++++++ lib/src/typewriter.dart | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/lib/src/colorize.dart b/lib/src/colorize.dart index 44ddbeb..c2c8df7 100644 --- a/lib/src/colorize.dart +++ b/lib/src/colorize.dart @@ -6,6 +6,8 @@ class ColorizeAnimatedTextKit extends StatefulWidget { final TextStyle textStyle; final Duration duration; final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; final bool isRepeatingAnimation; const ColorizeAnimatedTextKit( @@ -15,6 +17,8 @@ class ColorizeAnimatedTextKit extends StatefulWidget { @required this.colors, this.duration, this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, this.isRepeatingAnimation = true}) : super(key: key); @@ -128,6 +132,7 @@ class _RotatingTextState extends State ? widget.textStyle.merge( TextStyle(foreground: Paint()..shader = linearGradient)) : widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -150,6 +155,7 @@ class _RotatingTextState extends State ? widget.textStyle.merge(TextStyle( foreground: Paint()..shader = linearGradient)) : widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -169,6 +175,7 @@ class _RotatingTextState extends State ? widget.textStyle.merge(TextStyle( foreground: Paint()..shader = linearGradient)) : widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -182,6 +189,7 @@ class _RotatingTextState extends State child: GestureDetector( onTap: widget.onTap, child: Stack( + alignment: widget.alignment, children: _textWidgetList, ), ), diff --git a/lib/src/fade.dart b/lib/src/fade.dart index b43e584..08486d2 100644 --- a/lib/src/fade.dart +++ b/lib/src/fade.dart @@ -5,6 +5,8 @@ class FadeAnimatedTextKit extends StatefulWidget { final TextStyle textStyle; final Duration duration; final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; final bool isRepeatingAnimation; const FadeAnimatedTextKit( @@ -13,6 +15,8 @@ class FadeAnimatedTextKit extends StatefulWidget { this.textStyle, this.duration, this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, this.isRepeatingAnimation = true}) : super(key: key); @@ -90,6 +94,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -106,6 +111,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -119,6 +125,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -130,6 +137,7 @@ class _RotatingTextState extends State return GestureDetector( onTap: widget.onTap, child: Stack( + alignment: widget.alignment, children: textWidgetList, ), ); diff --git a/lib/src/rotate.dart b/lib/src/rotate.dart index 9aaf3ef..5e0d550 100644 --- a/lib/src/rotate.dart +++ b/lib/src/rotate.dart @@ -6,6 +6,8 @@ class RotateAnimatedTextKit extends StatefulWidget { final Duration duration; final double transitionHeight; final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; final bool isRepeatingAnimation; const RotateAnimatedTextKit( @@ -15,6 +17,8 @@ class RotateAnimatedTextKit extends StatefulWidget { this.transitionHeight, this.duration, this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, this.isRepeatingAnimation = true}) : super(key: key); @@ -135,6 +139,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ), ); @@ -155,6 +160,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ), ); @@ -171,6 +177,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ), ); @@ -185,6 +192,7 @@ class _RotatingTextState extends State child: SizedBox( height: _transitionHeight, child: Stack( + alignment: widget.alignment, children: textWidgetList, ), ), diff --git a/lib/src/scale.dart b/lib/src/scale.dart index 5f7ad0f..ea5795e 100644 --- a/lib/src/scale.dart +++ b/lib/src/scale.dart @@ -6,6 +6,8 @@ class ScaleAnimatedTextKit extends StatefulWidget { final Duration duration; final double scalingFactor; final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; final bool isRepeatingAnimation; const ScaleAnimatedTextKit( @@ -15,6 +17,8 @@ class ScaleAnimatedTextKit extends StatefulWidget { this.scalingFactor = 0.5, this.duration, this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, this.isRepeatingAnimation = true}) : super(key: key); @@ -113,6 +117,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ), ); @@ -132,6 +137,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ), ); @@ -148,6 +154,7 @@ class _RotatingTextState extends State child: Text( widget.text[i], style: widget.textStyle, + textAlign: widget.textAlign, ), ), ); @@ -160,6 +167,7 @@ class _RotatingTextState extends State return GestureDetector( onTap: widget.onTap, child: Stack( + alignment: widget.alignment, children: textWidgetList, ), ); diff --git a/lib/src/typer.dart b/lib/src/typer.dart index c1a796b..a3a48ba 100644 --- a/lib/src/typer.dart +++ b/lib/src/typer.dart @@ -5,6 +5,8 @@ class TyperAnimatedTextKit extends StatefulWidget { final TextStyle textStyle; final Duration duration; final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; final bool isRepeatingAnimation; const TyperAnimatedTextKit( @@ -13,6 +15,8 @@ class TyperAnimatedTextKit extends StatefulWidget { this.textStyle, this.duration, this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, this.isRepeatingAnimation = true}) : super(key: key); @@ -97,6 +101,7 @@ class _TyperState extends State child: Text( widget.text[i].substring(0, _typingText[i].value), style: widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -111,6 +116,7 @@ class _TyperState extends State child: Text( widget.text[i].substring(0, _typingText[i].value), style: widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -124,6 +130,7 @@ class _TyperState extends State child: Text( widget.text[i].substring(0, _typingText[i].value), style: widget.textStyle, + textAlign: widget.textAlign, ), ); }, @@ -135,6 +142,7 @@ class _TyperState extends State return GestureDetector( onTap: widget.onTap, child: Stack( + alignment: widget.alignment, children: textWidgetList, ), ); diff --git a/lib/src/typewriter.dart b/lib/src/typewriter.dart index 2592b46..e4434ca 100644 --- a/lib/src/typewriter.dart +++ b/lib/src/typewriter.dart @@ -5,6 +5,8 @@ class TypewriterAnimatedTextKit extends StatefulWidget { final TextStyle textStyle; final Duration duration; final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; final bool isRepeatingAnimation; TypewriterAnimatedTextKit( @@ -13,6 +15,8 @@ class TypewriterAnimatedTextKit extends StatefulWidget { this.textStyle, this.duration, this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, this.isRepeatingAnimation = true}) : super(key: key); @@ -124,6 +128,7 @@ class _TypewriterState extends State return Text( visibleString, style: widget.textStyle, + textAlign: widget.textAlign, ); }, ), @@ -162,6 +167,7 @@ class _TypewriterState extends State return Text( visibleString, style: widget.textStyle, + textAlign: widget.textAlign, ); }, ), @@ -199,6 +205,7 @@ class _TypewriterState extends State return Text( visibleString, style: widget.textStyle, + textAlign: widget.textAlign, ); }, ), @@ -212,6 +219,7 @@ class _TypewriterState extends State return GestureDetector( onTap: widget.onTap, child: Stack( + alignment: widget.alignment, children: textWidgetList, ), ); From 1dc30cc296aabd5ac07867346e805b01eb6f8168 Mon Sep 17 00:00:00 2001 From: Anders Cheow Date: Mon, 7 Jan 2019 11:22:03 +0800 Subject: [PATCH 2/5] Added GenericAnimatedTextKit to simplify some initialization Added some common assertions --- lib/src/colorize.dart | 88 ++++++++++++-------------- lib/src/fade.dart | 78 ++++++++++------------- lib/src/generic_animated_text_kit.dart | 58 +++++++++++++++++ lib/src/rotate.dart | 85 +++++++++++-------------- lib/src/scale.dart | 82 +++++++++++------------- lib/src/typer.dart | 77 ++++++++++------------ lib/src/typewriter.dart | 80 ++++++++++------------- 7 files changed, 269 insertions(+), 279 deletions(-) create mode 100644 lib/src/generic_animated_text_kit.dart diff --git a/lib/src/colorize.dart b/lib/src/colorize.dart index c2c8df7..4c0a779 100644 --- a/lib/src/colorize.dart +++ b/lib/src/colorize.dart @@ -1,39 +1,37 @@ +import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class ColorizeAnimatedTextKit extends StatefulWidget { - final List text; +class ColorizeAnimatedTextKit extends GenericAnimatedTextKit { final List colors; - final TextStyle textStyle; - final Duration duration; - final VoidCallback onTap; - final AlignmentGeometry alignment; - final TextAlign textAlign; - final bool isRepeatingAnimation; const ColorizeAnimatedTextKit( {Key key, - @required this.text, - this.textStyle, + @required List text, @required this.colors, - this.duration, - this.onTap, - this.alignment = AlignmentDirectional.topStart, - this.textAlign = TextAlign.start, - this.isRepeatingAnimation = true}) - : super(key: key); + TextStyle textStyle, + Duration duration, + VoidCallback onTap, + AlignmentGeometry alignment = AlignmentDirectional.topStart, + TextAlign textAlign = TextAlign.start, + bool isRepeatingAnimation = true}) + : assert(colors != null), + super( + key: key, + text: text, + textStyle: textStyle, + duration: duration, + onTap: onTap, + alignment: alignment, + textAlign: textAlign, + isRepeatingAnimation: isRepeatingAnimation); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState extends State +class _RotatingTextState + extends GenericAnimatedTextKitState with SingleTickerProviderStateMixin { - Duration _duration; - - AnimationController _controller; - - List _textWidgetList = []; - List> _colorShifter = []; List> _fadeIn = []; @@ -42,9 +40,7 @@ class _RotatingTextState extends State List _tuning = []; @override - void initState() { - super.initState(); - + void setup() { int lengthList = widget.text.length; int totalCharacters = 0; @@ -54,20 +50,20 @@ class _RotatingTextState extends State } if (widget.duration == null) { - _duration = Duration(milliseconds: 1500 * totalCharacters ~/ 3); + duration = Duration(milliseconds: 1500 * totalCharacters ~/ 3); } else { - _duration = widget.duration; + duration = widget.duration; } - _controller = new AnimationController( - duration: _duration, + controller = new AnimationController( + duration: duration, vsync: this, ); if (widget.isRepeatingAnimation) { - _controller..repeat(); + controller..repeat(); } else { - _controller.forward(); + controller.forward(); } double percentTimeCount = 0.0; @@ -81,7 +77,7 @@ class _RotatingTextState extends State (widget.text[i].length / 15.0)); _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( percentTimeCount, percentTimeCount + (percentTime / 10), @@ -89,7 +85,7 @@ class _RotatingTextState extends State )))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(new CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval((percentTimeCount + (percentTime * 9 / 10)), (percentTimeCount + percentTime), curve: Curves.easeIn)))); @@ -97,7 +93,7 @@ class _RotatingTextState extends State _colorShifter.add( Tween(begin: 0.0, end: widget.colors.length * _tuning[i]).animate( CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( percentTimeCount, percentTimeCount + percentTime, curve: Curves.easeIn)))); @@ -107,17 +103,11 @@ class _RotatingTextState extends State } @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { + Widget buildLayout(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { - _textWidgetList.add(AnimatedBuilder( - animation: _controller, + textWidgetList.add(AnimatedBuilder( + animation: controller, builder: (BuildContext context, Widget child) { Shader linearGradient = LinearGradient(colors: widget.colors) .createShader( @@ -139,8 +129,8 @@ class _RotatingTextState extends State )); } else { if (widget.isRepeatingAnimation) { - _textWidgetList.add(AnimatedBuilder( - animation: _controller, + textWidgetList.add(AnimatedBuilder( + animation: controller, builder: (BuildContext context, Widget child) { Shader linearGradient = LinearGradient(colors: widget.colors) .createShader( @@ -161,8 +151,8 @@ class _RotatingTextState extends State }, )); } else { - _textWidgetList.add(AnimatedBuilder( - animation: _controller, + textWidgetList.add(AnimatedBuilder( + animation: controller, builder: (BuildContext context, Widget child) { Shader linearGradient = LinearGradient(colors: widget.colors) .createShader( @@ -190,7 +180,7 @@ class _RotatingTextState extends State onTap: widget.onTap, child: Stack( alignment: widget.alignment, - children: _textWidgetList, + children: textWidgetList, ), ), ); diff --git a/lib/src/fade.dart b/lib/src/fade.dart index 08486d2..ee8ef06 100644 --- a/lib/src/fade.dart +++ b/lib/src/fade.dart @@ -1,59 +1,53 @@ +import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class FadeAnimatedTextKit extends StatefulWidget { - final List text; - final TextStyle textStyle; - final Duration duration; - final VoidCallback onTap; - final AlignmentGeometry alignment; - final TextAlign textAlign; - final bool isRepeatingAnimation; - +class FadeAnimatedTextKit extends GenericAnimatedTextKit { const FadeAnimatedTextKit( {Key key, - @required this.text, - this.textStyle, - this.duration, - this.onTap, - this.alignment = AlignmentDirectional.topStart, - this.textAlign = TextAlign.start, - this.isRepeatingAnimation = true}) - : super(key: key); + @required List text, + TextStyle textStyle, + Duration duration, + VoidCallback onTap, + AlignmentGeometry alignment = AlignmentDirectional.topStart, + TextAlign textAlign = TextAlign.start, + bool isRepeatingAnimation = true}) + : super( + key: key, + text: text, + textStyle: textStyle, + duration: duration, + onTap: onTap, + alignment: alignment, + textAlign: textAlign, + isRepeatingAnimation: isRepeatingAnimation); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState extends State +class _RotatingTextState + extends GenericAnimatedTextKitState with SingleTickerProviderStateMixin { - Duration _duration; - - AnimationController _controller; - List> _fadeIn = []; List> _fadeOut = []; - List textWidgetList = []; - @override - void initState() { - super.initState(); - + void setup() { if (widget.duration == null) { - _duration = Duration(milliseconds: 2000 * widget.text.length); + duration = Duration(milliseconds: 2000 * widget.text.length); } else { - _duration = widget.duration; + duration = widget.duration; } - _controller = new AnimationController( - duration: _duration, + controller = new AnimationController( + duration: duration, vsync: this, ); if (widget.isRepeatingAnimation) { - _controller..repeat(); + controller..repeat(); } else { - _controller.forward(); + controller.forward(); } int lengthList = widget.text.length; @@ -63,11 +57,11 @@ class _RotatingTextState extends State for (int i = 0; i < widget.text.length; i++) { _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval((i * percentTime), (i * percentTime) + fadeTime, curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( ((i + 1) * percentTime) - fadeTime, ((i + 1) * percentTime), curve: Curves.linear)))); @@ -75,17 +69,11 @@ class _RotatingTextState extends State } @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { + Widget buildLayout(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: !(_fadeIn[i].value == 1.0) @@ -102,7 +90,7 @@ class _RotatingTextState extends State } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: !(_fadeIn[i].value == 1.0) @@ -118,7 +106,7 @@ class _RotatingTextState extends State )); } else { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeIn[i].value, diff --git a/lib/src/generic_animated_text_kit.dart b/lib/src/generic_animated_text_kit.dart new file mode 100644 index 0000000..06be1d7 --- /dev/null +++ b/lib/src/generic_animated_text_kit.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; + +abstract class GenericAnimatedTextKit extends StatefulWidget { + final List text; + final TextStyle textStyle; + final Duration duration; + final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; + final bool isRepeatingAnimation; + + const GenericAnimatedTextKit( + {Key key, + @required this.text, + this.textStyle, + this.duration, + this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, + this.isRepeatingAnimation}) + : assert(text != null), + assert(alignment != null), + assert(textAlign != null), + assert(isRepeatingAnimation != null), + super(key: key); + + @override + GenericAnimatedTextKitState createState(); +} + +abstract class GenericAnimatedTextKitState + extends State { + Duration duration; + AnimationController controller; + + List textWidgetList = []; + + void setup(); + + Widget buildLayout(BuildContext context); + + @override + void initState() { + super.initState(); + setup(); + } + + @override + void dispose() { + controller?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return buildLayout(context); + } +} diff --git a/lib/src/rotate.dart b/lib/src/rotate.dart index 5e0d550..5f73260 100644 --- a/lib/src/rotate.dart +++ b/lib/src/rotate.dart @@ -1,65 +1,60 @@ +import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class RotateAnimatedTextKit extends StatefulWidget { - final List text; - final TextStyle textStyle; - final Duration duration; +class RotateAnimatedTextKit extends GenericAnimatedTextKit { final double transitionHeight; - final VoidCallback onTap; - final AlignmentGeometry alignment; - final TextAlign textAlign; - final bool isRepeatingAnimation; const RotateAnimatedTextKit( {Key key, - @required this.text, - this.textStyle, + @required List text, this.transitionHeight, - this.duration, - this.onTap, - this.alignment = AlignmentDirectional.topStart, - this.textAlign = TextAlign.start, - this.isRepeatingAnimation = true}) - : super(key: key); + TextStyle textStyle, + Duration duration, + VoidCallback onTap, + AlignmentGeometry alignment = AlignmentDirectional.topStart, + TextAlign textAlign = TextAlign.start, + bool isRepeatingAnimation = true}) + : super( + key: key, + text: text, + textStyle: textStyle, + duration: duration, + onTap: onTap, + alignment: alignment, + textAlign: textAlign, + isRepeatingAnimation: isRepeatingAnimation); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState extends State +class _RotatingTextState + extends GenericAnimatedTextKitState with SingleTickerProviderStateMixin { - AnimationController _controller; - double _transitionHeight; - Duration _duration; - List> _fadeIn = []; List> _fadeOut = []; List> _slideIn = []; List> _slideOut = []; - List textWidgetList = []; - @override - void initState() { - super.initState(); - + void setup() { if (widget.duration == null) { - _duration = Duration(milliseconds: 2000 * widget.text.length); + duration = Duration(milliseconds: 2000 * widget.text.length); } else { - _duration = widget.duration; + duration = widget.duration; } - _controller = new AnimationController( - duration: _duration, + controller = new AnimationController( + duration: duration, vsync: this, ); if (widget.isRepeatingAnimation) { - _controller..repeat(); + controller..repeat(); } else { - _controller.forward(); + controller.forward(); } int lengthList = widget.text.length; @@ -80,21 +75,21 @@ class _RotatingTextState extends State begin: Alignment(-1.0, -1.0), end: new Alignment(-1.0, 0.0), ).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval(0.0, slideTime, curve: Curves.linear)))); _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval(0.0, fadeTime, curve: Curves.easeOut)))); } else { _slideIn.add(AlignmentTween( begin: Alignment(-1.0, -1.0), end: new Alignment(-1.0, 0.0), ).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval((i * percentTime) - slideTime, (i) * percentTime, curve: Curves.linear)))); _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval((i * percentTime) - slideTime, (i * percentTime) - slideTime + fadeTime, curve: Curves.easeOut)))); @@ -104,12 +99,12 @@ class _RotatingTextState extends State begin: Alignment(-1.0, 0.0), end: new Alignment(-1.0, 1.0), ).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( ((i + 1) * percentTime) - slideTime, (i + 1) * percentTime, curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval(((i + 1) * percentTime) - slideTime, ((i + 1) * percentTime) - slideTime + fadeTime, curve: Curves.easeIn)))); @@ -117,17 +112,11 @@ class _RotatingTextState extends State } @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { + Widget buildLayout(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return AlignTransition( alignment: @@ -148,7 +137,7 @@ class _RotatingTextState extends State } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return AlignTransition( alignment: @@ -168,7 +157,7 @@ class _RotatingTextState extends State )); } else { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return AlignTransition( alignment: _slideIn[i], diff --git a/lib/src/scale.dart b/lib/src/scale.dart index ea5795e..679a7ce 100644 --- a/lib/src/scale.dart +++ b/lib/src/scale.dart @@ -1,63 +1,59 @@ +import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class ScaleAnimatedTextKit extends StatefulWidget { - final List text; - final TextStyle textStyle; - final Duration duration; +class ScaleAnimatedTextKit extends GenericAnimatedTextKit { final double scalingFactor; - final VoidCallback onTap; - final AlignmentGeometry alignment; - final TextAlign textAlign; - final bool isRepeatingAnimation; const ScaleAnimatedTextKit( {Key key, - @required this.text, - this.textStyle, + @required List text, this.scalingFactor = 0.5, - this.duration, - this.onTap, - this.alignment = AlignmentDirectional.topStart, - this.textAlign = TextAlign.start, - this.isRepeatingAnimation = true}) - : super(key: key); + TextStyle textStyle, + Duration duration, + VoidCallback onTap, + AlignmentGeometry alignment = AlignmentDirectional.topStart, + TextAlign textAlign = TextAlign.start, + bool isRepeatingAnimation = true}) + : assert(scalingFactor != null), + super( + key: key, + text: text, + textStyle: textStyle, + duration: duration, + onTap: onTap, + alignment: alignment, + textAlign: textAlign, + isRepeatingAnimation: isRepeatingAnimation); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState extends State +class _RotatingTextState + extends GenericAnimatedTextKitState with SingleTickerProviderStateMixin { - Duration _duration; - - AnimationController _controller; - List> _scaleIn = []; List> _scaleOut = []; List> _fadeIn = []; List> _fadeOut = []; - List textWidgetList = []; - @override - void initState() { - super.initState(); - + void setup() { if (widget.duration == null) { - _duration = Duration(milliseconds: 2000 * widget.text.length); + duration = Duration(milliseconds: 2000 * widget.text.length); } else { - _duration = widget.duration; + duration = widget.duration; } - _controller = new AnimationController( - duration: _duration, + controller = new AnimationController( + duration: duration, vsync: this, ); if (widget.isRepeatingAnimation) { - _controller..repeat(); + controller..repeat(); } else { - _controller.forward(); + controller.forward(); } int lengthList = widget.text.length; @@ -68,17 +64,17 @@ class _RotatingTextState extends State for (int i = 0; i < widget.text.length; i++) { _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval((i * percentTime), (i * percentTime) + fadeTime, curve: Curves.easeOut)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( ((i + 1) * percentTime) - fadeTime, ((i + 1) * percentTime), curve: Curves.easeIn)))); _scaleIn.add(Tween(begin: widget.scalingFactor, end: 1.0) .animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( (i * percentTime), (i * percentTime) + scaleTime, @@ -86,7 +82,7 @@ class _RotatingTextState extends State )))); _scaleOut.add(Tween(begin: 1.0, end: widget.scalingFactor) .animate(CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( ((i + 1) * percentTime) - scaleTime, ((i + 1) * percentTime), @@ -96,17 +92,11 @@ class _RotatingTextState extends State } @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { + Widget buildLayout(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return ScaleTransition( scale: !(_scaleIn[i].value == 1.0) ? _scaleIn[i] : _scaleOut[i], @@ -126,7 +116,7 @@ class _RotatingTextState extends State } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return ScaleTransition( scale: !(_scaleIn[i].value == 1.0) ? _scaleIn[i] : _scaleOut[i], @@ -145,7 +135,7 @@ class _RotatingTextState extends State )); } else { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return ScaleTransition( scale: _scaleIn[i], diff --git a/lib/src/typer.dart b/lib/src/typer.dart index a3a48ba..b63043e 100644 --- a/lib/src/typer.dart +++ b/lib/src/typer.dart @@ -1,44 +1,37 @@ +import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class TyperAnimatedTextKit extends StatefulWidget { - final List text; - final TextStyle textStyle; - final Duration duration; - final VoidCallback onTap; - final AlignmentGeometry alignment; - final TextAlign textAlign; - final bool isRepeatingAnimation; - +class TyperAnimatedTextKit extends GenericAnimatedTextKit { const TyperAnimatedTextKit( {Key key, - @required this.text, - this.textStyle, - this.duration, - this.onTap, - this.alignment = AlignmentDirectional.topStart, - this.textAlign = TextAlign.start, - this.isRepeatingAnimation = true}) - : super(key: key); + @required List text, + TextStyle textStyle, + Duration duration, + VoidCallback onTap, + AlignmentGeometry alignment = AlignmentDirectional.topStart, + TextAlign textAlign = TextAlign.start, + bool isRepeatingAnimation = true}) + : super( + key: key, + text: text, + textStyle: textStyle, + duration: duration, + onTap: onTap, + alignment: alignment, + textAlign: textAlign, + isRepeatingAnimation: isRepeatingAnimation); @override _TyperState createState() => new _TyperState(); } -class _TyperState extends State +class _TyperState extends GenericAnimatedTextKitState with SingleTickerProviderStateMixin { - AnimationController _controller; - List> _typingText = []; List> _fadeOut = []; - List textWidgetList = []; - - Duration _duration; - @override - void initState() { - super.initState(); - + void setup() { int totalCharacters = 0; for (int i = 0; i < widget.text.length; i++) { @@ -46,20 +39,20 @@ class _TyperState extends State } if (widget.duration == null) { - _duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); + duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); } else { - _duration = widget.duration; + duration = widget.duration; } - _controller = new AnimationController( - duration: _duration, + controller = new AnimationController( + duration: duration, vsync: this, ); if (widget.isRepeatingAnimation) { - _controller..repeat(); + controller..repeat(); } else { - _controller.forward(); + controller.forward(); } double percentTimeCount = 0.0; @@ -68,13 +61,13 @@ class _TyperState extends State _typingText.add(StepTween(begin: 0, end: widget.text[i].length).animate( new CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( percentTimeCount, (percentTimeCount + (percentTime * 8 / 10)), curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(new CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval((percentTimeCount + (percentTime * 9 / 10)), (percentTimeCount + percentTime), curve: Curves.easeIn)))); @@ -84,17 +77,11 @@ class _TyperState extends State } @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { + Widget buildLayout(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -109,7 +96,7 @@ class _TyperState extends State } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -123,7 +110,7 @@ class _TyperState extends State )); } else { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: 1, diff --git a/lib/src/typewriter.dart b/lib/src/typewriter.dart index e4434ca..f6613ac 100644 --- a/lib/src/typewriter.dart +++ b/lib/src/typewriter.dart @@ -1,44 +1,38 @@ +import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class TypewriterAnimatedTextKit extends StatefulWidget { - final List text; - final TextStyle textStyle; - final Duration duration; - final VoidCallback onTap; - final AlignmentGeometry alignment; - final TextAlign textAlign; - final bool isRepeatingAnimation; - - TypewriterAnimatedTextKit( +class TypewriterAnimatedTextKit extends GenericAnimatedTextKit { + const TypewriterAnimatedTextKit( {Key key, - @required this.text, - this.textStyle, - this.duration, - this.onTap, - this.alignment = AlignmentDirectional.topStart, - this.textAlign = TextAlign.start, - this.isRepeatingAnimation = true}) - : super(key: key); + @required List text, + TextStyle textStyle, + Duration duration, + VoidCallback onTap, + AlignmentGeometry alignment = AlignmentDirectional.topStart, + TextAlign textAlign = TextAlign.start, + bool isRepeatingAnimation = true}) + : super( + key: key, + text: text, + textStyle: textStyle, + duration: duration, + onTap: onTap, + alignment: alignment, + textAlign: textAlign, + isRepeatingAnimation: isRepeatingAnimation); @override _TypewriterState createState() => new _TypewriterState(); } -class _TypewriterState extends State +class _TypewriterState + extends GenericAnimatedTextKitState with SingleTickerProviderStateMixin { - Duration _duration; - - AnimationController _controller; - List> _typewriterText = []; List> _fadeOut = []; - List textWidgetList = []; - @override - void initState() { - super.initState(); - + void setup() { if (widget.duration == null) { int totalCharacters = 0; @@ -46,20 +40,20 @@ class _TypewriterState extends State totalCharacters += (widget.text[i].length + 8); } - _duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); + duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); } else { - _duration = widget.duration; + duration = widget.duration; } - _controller = new AnimationController( - duration: _duration, + controller = new AnimationController( + duration: duration, vsync: this, ); if (widget.isRepeatingAnimation) { - _controller..repeat(); + controller..repeat(); } else { - _controller.forward(); + controller.forward(); } int totalCharacters = 0; @@ -74,13 +68,13 @@ class _TypewriterState extends State _typewriterText.add(StepTween(begin: 0, end: widget.text[i].length + 8) .animate(new CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval( percentTimeCount, (percentTimeCount + (percentTime * 8 / 10)), curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(new CurvedAnimation( - parent: _controller, + parent: controller, curve: Interval((percentTimeCount + (percentTime * 9 / 10)), (percentTimeCount + percentTime), curve: Curves.easeIn)))); @@ -90,17 +84,11 @@ class _TypewriterState extends State } @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { + Widget buildLayout(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -138,7 +126,7 @@ class _TypewriterState extends State } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -176,7 +164,7 @@ class _TypewriterState extends State )); } else { textWidgetList.add(AnimatedBuilder( - animation: _controller, + animation: controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: 1, From 598fafefafe8a551c19e861c9fa4a9bd98e5ec35 Mon Sep 17 00:00:00 2001 From: Anders Cheow Date: Mon, 7 Jan 2019 12:05:18 +0800 Subject: [PATCH 3/5] Revert "Added GenericAnimatedTextKit to simplify some initialization" This reverts commit 1dc30cc296aabd5ac07867346e805b01eb6f8168. --- lib/src/colorize.dart | 88 ++++++++++++++------------ lib/src/fade.dart | 78 +++++++++++++---------- lib/src/generic_animated_text_kit.dart | 58 ----------------- lib/src/rotate.dart | 85 ++++++++++++++----------- lib/src/scale.dart | 82 +++++++++++++----------- lib/src/typer.dart | 77 ++++++++++++---------- lib/src/typewriter.dart | 80 +++++++++++++---------- 7 files changed, 279 insertions(+), 269 deletions(-) delete mode 100644 lib/src/generic_animated_text_kit.dart diff --git a/lib/src/colorize.dart b/lib/src/colorize.dart index 4c0a779..c2c8df7 100644 --- a/lib/src/colorize.dart +++ b/lib/src/colorize.dart @@ -1,37 +1,39 @@ -import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class ColorizeAnimatedTextKit extends GenericAnimatedTextKit { +class ColorizeAnimatedTextKit extends StatefulWidget { + final List text; final List colors; + final TextStyle textStyle; + final Duration duration; + final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; + final bool isRepeatingAnimation; const ColorizeAnimatedTextKit( {Key key, - @required List text, + @required this.text, + this.textStyle, @required this.colors, - TextStyle textStyle, - Duration duration, - VoidCallback onTap, - AlignmentGeometry alignment = AlignmentDirectional.topStart, - TextAlign textAlign = TextAlign.start, - bool isRepeatingAnimation = true}) - : assert(colors != null), - super( - key: key, - text: text, - textStyle: textStyle, - duration: duration, - onTap: onTap, - alignment: alignment, - textAlign: textAlign, - isRepeatingAnimation: isRepeatingAnimation); + this.duration, + this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, + this.isRepeatingAnimation = true}) + : super(key: key); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState - extends GenericAnimatedTextKitState +class _RotatingTextState extends State with SingleTickerProviderStateMixin { + Duration _duration; + + AnimationController _controller; + + List _textWidgetList = []; + List> _colorShifter = []; List> _fadeIn = []; @@ -40,7 +42,9 @@ class _RotatingTextState List _tuning = []; @override - void setup() { + void initState() { + super.initState(); + int lengthList = widget.text.length; int totalCharacters = 0; @@ -50,20 +54,20 @@ class _RotatingTextState } if (widget.duration == null) { - duration = Duration(milliseconds: 1500 * totalCharacters ~/ 3); + _duration = Duration(milliseconds: 1500 * totalCharacters ~/ 3); } else { - duration = widget.duration; + _duration = widget.duration; } - controller = new AnimationController( - duration: duration, + _controller = new AnimationController( + duration: _duration, vsync: this, ); if (widget.isRepeatingAnimation) { - controller..repeat(); + _controller..repeat(); } else { - controller.forward(); + _controller.forward(); } double percentTimeCount = 0.0; @@ -77,7 +81,7 @@ class _RotatingTextState (widget.text[i].length / 15.0)); _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( percentTimeCount, percentTimeCount + (percentTime / 10), @@ -85,7 +89,7 @@ class _RotatingTextState )))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(new CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval((percentTimeCount + (percentTime * 9 / 10)), (percentTimeCount + percentTime), curve: Curves.easeIn)))); @@ -93,7 +97,7 @@ class _RotatingTextState _colorShifter.add( Tween(begin: 0.0, end: widget.colors.length * _tuning[i]).animate( CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( percentTimeCount, percentTimeCount + percentTime, curve: Curves.easeIn)))); @@ -103,11 +107,17 @@ class _RotatingTextState } @override - Widget buildLayout(BuildContext context) { + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { - textWidgetList.add(AnimatedBuilder( - animation: controller, + _textWidgetList.add(AnimatedBuilder( + animation: _controller, builder: (BuildContext context, Widget child) { Shader linearGradient = LinearGradient(colors: widget.colors) .createShader( @@ -129,8 +139,8 @@ class _RotatingTextState )); } else { if (widget.isRepeatingAnimation) { - textWidgetList.add(AnimatedBuilder( - animation: controller, + _textWidgetList.add(AnimatedBuilder( + animation: _controller, builder: (BuildContext context, Widget child) { Shader linearGradient = LinearGradient(colors: widget.colors) .createShader( @@ -151,8 +161,8 @@ class _RotatingTextState }, )); } else { - textWidgetList.add(AnimatedBuilder( - animation: controller, + _textWidgetList.add(AnimatedBuilder( + animation: _controller, builder: (BuildContext context, Widget child) { Shader linearGradient = LinearGradient(colors: widget.colors) .createShader( @@ -180,7 +190,7 @@ class _RotatingTextState onTap: widget.onTap, child: Stack( alignment: widget.alignment, - children: textWidgetList, + children: _textWidgetList, ), ), ); diff --git a/lib/src/fade.dart b/lib/src/fade.dart index ee8ef06..08486d2 100644 --- a/lib/src/fade.dart +++ b/lib/src/fade.dart @@ -1,53 +1,59 @@ -import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class FadeAnimatedTextKit extends GenericAnimatedTextKit { +class FadeAnimatedTextKit extends StatefulWidget { + final List text; + final TextStyle textStyle; + final Duration duration; + final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; + final bool isRepeatingAnimation; + const FadeAnimatedTextKit( {Key key, - @required List text, - TextStyle textStyle, - Duration duration, - VoidCallback onTap, - AlignmentGeometry alignment = AlignmentDirectional.topStart, - TextAlign textAlign = TextAlign.start, - bool isRepeatingAnimation = true}) - : super( - key: key, - text: text, - textStyle: textStyle, - duration: duration, - onTap: onTap, - alignment: alignment, - textAlign: textAlign, - isRepeatingAnimation: isRepeatingAnimation); + @required this.text, + this.textStyle, + this.duration, + this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, + this.isRepeatingAnimation = true}) + : super(key: key); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState - extends GenericAnimatedTextKitState +class _RotatingTextState extends State with SingleTickerProviderStateMixin { + Duration _duration; + + AnimationController _controller; + List> _fadeIn = []; List> _fadeOut = []; + List textWidgetList = []; + @override - void setup() { + void initState() { + super.initState(); + if (widget.duration == null) { - duration = Duration(milliseconds: 2000 * widget.text.length); + _duration = Duration(milliseconds: 2000 * widget.text.length); } else { - duration = widget.duration; + _duration = widget.duration; } - controller = new AnimationController( - duration: duration, + _controller = new AnimationController( + duration: _duration, vsync: this, ); if (widget.isRepeatingAnimation) { - controller..repeat(); + _controller..repeat(); } else { - controller.forward(); + _controller.forward(); } int lengthList = widget.text.length; @@ -57,11 +63,11 @@ class _RotatingTextState for (int i = 0; i < widget.text.length; i++) { _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval((i * percentTime), (i * percentTime) + fadeTime, curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( ((i + 1) * percentTime) - fadeTime, ((i + 1) * percentTime), curve: Curves.linear)))); @@ -69,11 +75,17 @@ class _RotatingTextState } @override - Widget buildLayout(BuildContext context) { + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: !(_fadeIn[i].value == 1.0) @@ -90,7 +102,7 @@ class _RotatingTextState } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: !(_fadeIn[i].value == 1.0) @@ -106,7 +118,7 @@ class _RotatingTextState )); } else { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeIn[i].value, diff --git a/lib/src/generic_animated_text_kit.dart b/lib/src/generic_animated_text_kit.dart deleted file mode 100644 index 06be1d7..0000000 --- a/lib/src/generic_animated_text_kit.dart +++ /dev/null @@ -1,58 +0,0 @@ -import 'package:flutter/material.dart'; - -abstract class GenericAnimatedTextKit extends StatefulWidget { - final List text; - final TextStyle textStyle; - final Duration duration; - final VoidCallback onTap; - final AlignmentGeometry alignment; - final TextAlign textAlign; - final bool isRepeatingAnimation; - - const GenericAnimatedTextKit( - {Key key, - @required this.text, - this.textStyle, - this.duration, - this.onTap, - this.alignment = AlignmentDirectional.topStart, - this.textAlign = TextAlign.start, - this.isRepeatingAnimation}) - : assert(text != null), - assert(alignment != null), - assert(textAlign != null), - assert(isRepeatingAnimation != null), - super(key: key); - - @override - GenericAnimatedTextKitState createState(); -} - -abstract class GenericAnimatedTextKitState - extends State { - Duration duration; - AnimationController controller; - - List textWidgetList = []; - - void setup(); - - Widget buildLayout(BuildContext context); - - @override - void initState() { - super.initState(); - setup(); - } - - @override - void dispose() { - controller?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return buildLayout(context); - } -} diff --git a/lib/src/rotate.dart b/lib/src/rotate.dart index 5f73260..5e0d550 100644 --- a/lib/src/rotate.dart +++ b/lib/src/rotate.dart @@ -1,60 +1,65 @@ -import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class RotateAnimatedTextKit extends GenericAnimatedTextKit { +class RotateAnimatedTextKit extends StatefulWidget { + final List text; + final TextStyle textStyle; + final Duration duration; final double transitionHeight; + final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; + final bool isRepeatingAnimation; const RotateAnimatedTextKit( {Key key, - @required List text, + @required this.text, + this.textStyle, this.transitionHeight, - TextStyle textStyle, - Duration duration, - VoidCallback onTap, - AlignmentGeometry alignment = AlignmentDirectional.topStart, - TextAlign textAlign = TextAlign.start, - bool isRepeatingAnimation = true}) - : super( - key: key, - text: text, - textStyle: textStyle, - duration: duration, - onTap: onTap, - alignment: alignment, - textAlign: textAlign, - isRepeatingAnimation: isRepeatingAnimation); + this.duration, + this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, + this.isRepeatingAnimation = true}) + : super(key: key); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState - extends GenericAnimatedTextKitState +class _RotatingTextState extends State with SingleTickerProviderStateMixin { + AnimationController _controller; + double _transitionHeight; + Duration _duration; + List> _fadeIn = []; List> _fadeOut = []; List> _slideIn = []; List> _slideOut = []; + List textWidgetList = []; + @override - void setup() { + void initState() { + super.initState(); + if (widget.duration == null) { - duration = Duration(milliseconds: 2000 * widget.text.length); + _duration = Duration(milliseconds: 2000 * widget.text.length); } else { - duration = widget.duration; + _duration = widget.duration; } - controller = new AnimationController( - duration: duration, + _controller = new AnimationController( + duration: _duration, vsync: this, ); if (widget.isRepeatingAnimation) { - controller..repeat(); + _controller..repeat(); } else { - controller.forward(); + _controller.forward(); } int lengthList = widget.text.length; @@ -75,21 +80,21 @@ class _RotatingTextState begin: Alignment(-1.0, -1.0), end: new Alignment(-1.0, 0.0), ).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval(0.0, slideTime, curve: Curves.linear)))); _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval(0.0, fadeTime, curve: Curves.easeOut)))); } else { _slideIn.add(AlignmentTween( begin: Alignment(-1.0, -1.0), end: new Alignment(-1.0, 0.0), ).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval((i * percentTime) - slideTime, (i) * percentTime, curve: Curves.linear)))); _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval((i * percentTime) - slideTime, (i * percentTime) - slideTime + fadeTime, curve: Curves.easeOut)))); @@ -99,12 +104,12 @@ class _RotatingTextState begin: Alignment(-1.0, 0.0), end: new Alignment(-1.0, 1.0), ).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( ((i + 1) * percentTime) - slideTime, (i + 1) * percentTime, curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval(((i + 1) * percentTime) - slideTime, ((i + 1) * percentTime) - slideTime + fadeTime, curve: Curves.easeIn)))); @@ -112,11 +117,17 @@ class _RotatingTextState } @override - Widget buildLayout(BuildContext context) { + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return AlignTransition( alignment: @@ -137,7 +148,7 @@ class _RotatingTextState } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return AlignTransition( alignment: @@ -157,7 +168,7 @@ class _RotatingTextState )); } else { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return AlignTransition( alignment: _slideIn[i], diff --git a/lib/src/scale.dart b/lib/src/scale.dart index 679a7ce..ea5795e 100644 --- a/lib/src/scale.dart +++ b/lib/src/scale.dart @@ -1,59 +1,63 @@ -import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class ScaleAnimatedTextKit extends GenericAnimatedTextKit { +class ScaleAnimatedTextKit extends StatefulWidget { + final List text; + final TextStyle textStyle; + final Duration duration; final double scalingFactor; + final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; + final bool isRepeatingAnimation; const ScaleAnimatedTextKit( {Key key, - @required List text, + @required this.text, + this.textStyle, this.scalingFactor = 0.5, - TextStyle textStyle, - Duration duration, - VoidCallback onTap, - AlignmentGeometry alignment = AlignmentDirectional.topStart, - TextAlign textAlign = TextAlign.start, - bool isRepeatingAnimation = true}) - : assert(scalingFactor != null), - super( - key: key, - text: text, - textStyle: textStyle, - duration: duration, - onTap: onTap, - alignment: alignment, - textAlign: textAlign, - isRepeatingAnimation: isRepeatingAnimation); + this.duration, + this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, + this.isRepeatingAnimation = true}) + : super(key: key); @override _RotatingTextState createState() => new _RotatingTextState(); } -class _RotatingTextState - extends GenericAnimatedTextKitState +class _RotatingTextState extends State with SingleTickerProviderStateMixin { + Duration _duration; + + AnimationController _controller; + List> _scaleIn = []; List> _scaleOut = []; List> _fadeIn = []; List> _fadeOut = []; + List textWidgetList = []; + @override - void setup() { + void initState() { + super.initState(); + if (widget.duration == null) { - duration = Duration(milliseconds: 2000 * widget.text.length); + _duration = Duration(milliseconds: 2000 * widget.text.length); } else { - duration = widget.duration; + _duration = widget.duration; } - controller = new AnimationController( - duration: duration, + _controller = new AnimationController( + duration: _duration, vsync: this, ); if (widget.isRepeatingAnimation) { - controller..repeat(); + _controller..repeat(); } else { - controller.forward(); + _controller.forward(); } int lengthList = widget.text.length; @@ -64,17 +68,17 @@ class _RotatingTextState for (int i = 0; i < widget.text.length; i++) { _fadeIn.add(Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval((i * percentTime), (i * percentTime) + fadeTime, curve: Curves.easeOut)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( ((i + 1) * percentTime) - fadeTime, ((i + 1) * percentTime), curve: Curves.easeIn)))); _scaleIn.add(Tween(begin: widget.scalingFactor, end: 1.0) .animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( (i * percentTime), (i * percentTime) + scaleTime, @@ -82,7 +86,7 @@ class _RotatingTextState )))); _scaleOut.add(Tween(begin: 1.0, end: widget.scalingFactor) .animate(CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( ((i + 1) * percentTime) - scaleTime, ((i + 1) * percentTime), @@ -92,11 +96,17 @@ class _RotatingTextState } @override - Widget buildLayout(BuildContext context) { + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return ScaleTransition( scale: !(_scaleIn[i].value == 1.0) ? _scaleIn[i] : _scaleOut[i], @@ -116,7 +126,7 @@ class _RotatingTextState } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return ScaleTransition( scale: !(_scaleIn[i].value == 1.0) ? _scaleIn[i] : _scaleOut[i], @@ -135,7 +145,7 @@ class _RotatingTextState )); } else { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return ScaleTransition( scale: _scaleIn[i], diff --git a/lib/src/typer.dart b/lib/src/typer.dart index b63043e..a3a48ba 100644 --- a/lib/src/typer.dart +++ b/lib/src/typer.dart @@ -1,37 +1,44 @@ -import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class TyperAnimatedTextKit extends GenericAnimatedTextKit { +class TyperAnimatedTextKit extends StatefulWidget { + final List text; + final TextStyle textStyle; + final Duration duration; + final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; + final bool isRepeatingAnimation; + const TyperAnimatedTextKit( {Key key, - @required List text, - TextStyle textStyle, - Duration duration, - VoidCallback onTap, - AlignmentGeometry alignment = AlignmentDirectional.topStart, - TextAlign textAlign = TextAlign.start, - bool isRepeatingAnimation = true}) - : super( - key: key, - text: text, - textStyle: textStyle, - duration: duration, - onTap: onTap, - alignment: alignment, - textAlign: textAlign, - isRepeatingAnimation: isRepeatingAnimation); + @required this.text, + this.textStyle, + this.duration, + this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, + this.isRepeatingAnimation = true}) + : super(key: key); @override _TyperState createState() => new _TyperState(); } -class _TyperState extends GenericAnimatedTextKitState +class _TyperState extends State with SingleTickerProviderStateMixin { + AnimationController _controller; + List> _typingText = []; List> _fadeOut = []; + List textWidgetList = []; + + Duration _duration; + @override - void setup() { + void initState() { + super.initState(); + int totalCharacters = 0; for (int i = 0; i < widget.text.length; i++) { @@ -39,20 +46,20 @@ class _TyperState extends GenericAnimatedTextKitState } if (widget.duration == null) { - duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); + _duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); } else { - duration = widget.duration; + _duration = widget.duration; } - controller = new AnimationController( - duration: duration, + _controller = new AnimationController( + duration: _duration, vsync: this, ); if (widget.isRepeatingAnimation) { - controller..repeat(); + _controller..repeat(); } else { - controller.forward(); + _controller.forward(); } double percentTimeCount = 0.0; @@ -61,13 +68,13 @@ class _TyperState extends GenericAnimatedTextKitState _typingText.add(StepTween(begin: 0, end: widget.text[i].length).animate( new CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( percentTimeCount, (percentTimeCount + (percentTime * 8 / 10)), curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(new CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval((percentTimeCount + (percentTime * 9 / 10)), (percentTimeCount + percentTime), curve: Curves.easeIn)))); @@ -77,11 +84,17 @@ class _TyperState extends GenericAnimatedTextKitState } @override - Widget buildLayout(BuildContext context) { + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -96,7 +109,7 @@ class _TyperState extends GenericAnimatedTextKitState } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -110,7 +123,7 @@ class _TyperState extends GenericAnimatedTextKitState )); } else { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: 1, diff --git a/lib/src/typewriter.dart b/lib/src/typewriter.dart index f6613ac..e4434ca 100644 --- a/lib/src/typewriter.dart +++ b/lib/src/typewriter.dart @@ -1,38 +1,44 @@ -import 'package:animated_text_kit/src/generic_animated_text_kit.dart'; import 'package:flutter/material.dart'; -class TypewriterAnimatedTextKit extends GenericAnimatedTextKit { - const TypewriterAnimatedTextKit( +class TypewriterAnimatedTextKit extends StatefulWidget { + final List text; + final TextStyle textStyle; + final Duration duration; + final VoidCallback onTap; + final AlignmentGeometry alignment; + final TextAlign textAlign; + final bool isRepeatingAnimation; + + TypewriterAnimatedTextKit( {Key key, - @required List text, - TextStyle textStyle, - Duration duration, - VoidCallback onTap, - AlignmentGeometry alignment = AlignmentDirectional.topStart, - TextAlign textAlign = TextAlign.start, - bool isRepeatingAnimation = true}) - : super( - key: key, - text: text, - textStyle: textStyle, - duration: duration, - onTap: onTap, - alignment: alignment, - textAlign: textAlign, - isRepeatingAnimation: isRepeatingAnimation); + @required this.text, + this.textStyle, + this.duration, + this.onTap, + this.alignment = AlignmentDirectional.topStart, + this.textAlign = TextAlign.start, + this.isRepeatingAnimation = true}) + : super(key: key); @override _TypewriterState createState() => new _TypewriterState(); } -class _TypewriterState - extends GenericAnimatedTextKitState +class _TypewriterState extends State with SingleTickerProviderStateMixin { + Duration _duration; + + AnimationController _controller; + List> _typewriterText = []; List> _fadeOut = []; + List textWidgetList = []; + @override - void setup() { + void initState() { + super.initState(); + if (widget.duration == null) { int totalCharacters = 0; @@ -40,20 +46,20 @@ class _TypewriterState totalCharacters += (widget.text[i].length + 8); } - duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); + _duration = Duration(milliseconds: totalCharacters * 5000 ~/ 15); } else { - duration = widget.duration; + _duration = widget.duration; } - controller = new AnimationController( - duration: duration, + _controller = new AnimationController( + duration: _duration, vsync: this, ); if (widget.isRepeatingAnimation) { - controller..repeat(); + _controller..repeat(); } else { - controller.forward(); + _controller.forward(); } int totalCharacters = 0; @@ -68,13 +74,13 @@ class _TypewriterState _typewriterText.add(StepTween(begin: 0, end: widget.text[i].length + 8) .animate(new CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval( percentTimeCount, (percentTimeCount + (percentTime * 8 / 10)), curve: Curves.linear)))); _fadeOut.add(Tween(begin: 1.0, end: 0.0).animate(new CurvedAnimation( - parent: controller, + parent: _controller, curve: Interval((percentTimeCount + (percentTime * 9 / 10)), (percentTimeCount + percentTime), curve: Curves.easeIn)))); @@ -84,11 +90,17 @@ class _TypewriterState } @override - Widget buildLayout(BuildContext context) { + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { for (int i = 0; i < widget.text.length; i++) { if (i != widget.text.length - 1) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -126,7 +138,7 @@ class _TypewriterState } else { if (widget.isRepeatingAnimation) { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: _fadeOut[i].value, @@ -164,7 +176,7 @@ class _TypewriterState )); } else { textWidgetList.add(AnimatedBuilder( - animation: controller, + animation: _controller, builder: (BuildContext context, Widget child) { return Opacity( opacity: 1, From 3a6157da2177603a2753a37eed41c37f0647c8b9 Mon Sep 17 00:00:00 2001 From: Anders Cheow Date: Tue, 8 Jan 2019 11:03:40 +0800 Subject: [PATCH 4/5] Updated README.md. Added the usage of "textAlign" and "alignment" properties --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 3efb54b..df864bd 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,8 @@ Row( }, text: ["AWESOME", "OPTIMISTIC", "DIFFERENT"], textStyle: TextStyle(fontSize: 40.0, fontFamily: "Horizon"), + textAlign: TextAlign.start, + alignment: AlignmentDirectional.topStart // or Alignment.topLeft ), ], ); @@ -128,6 +130,8 @@ SizedBox( fontSize: 32.0, fontWeight: FontWeight.bold ), + textAlign: TextAlign.start, + alignment: AlignmentDirectional.topStart // or Alignment.topLeft ), ); ``` @@ -153,6 +157,8 @@ SizedBox( fontSize: 30.0, fontFamily: "Bobbers" ), + textAlign: TextAlign.start, + alignment: AlignmentDirectional.topStart // or Alignment.topLeft ), ); ``` @@ -177,6 +183,8 @@ SizedBox( fontSize: 30.0, fontFamily: "Agne" ), + textAlign: TextAlign.start, + alignment: AlignmentDirectional.topStart // or Alignment.topLeft ), ); ``` @@ -201,6 +209,8 @@ SizedBox( fontSize: 70.0, fontFamily: "Canterbury" ), + textAlign: TextAlign.start, + alignment: AlignmentDirectional.topStart // or Alignment.topLeft ), ); ``` @@ -231,6 +241,8 @@ SizedBox( Colors.yellow, Colors.red, ], + textAlign: TextAlign.start, + alignment: AlignmentDirectional.topStart // or Alignment.topLeft ), ); ``` From c11643b2e376887fe8734a851e45581e90c0d8d2 Mon Sep 17 00:00:00 2001 From: aagarwal1012 Date: Thu, 31 Jan 2019 04:06:06 +0530 Subject: [PATCH 5/5] :tada: updated to 1.3.0 --- CHANGELOG.md | 5 + README.md | 2 +- example/pubspec.lock | 255 +------------------------------------------ pubspec.yaml | 2 +- 4 files changed, 12 insertions(+), 252 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 582bf2c..4bed22d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.3.0 +**Feature Enhancement** +* Added attribute to align text. +* Updated Readme. + ## 1.2.0 **Feature Enhancement** * Added attribute to check whether the animation should repeat or not. diff --git a/README.md b/README.md index df864bd..4e8993f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Add this to your package's `pubspec.yaml` file: ```yaml dependencies: - animated_text_kit: ^1.2.0 + animated_text_kit: ^1.3.0 ``` ### 2. Install it diff --git a/example/pubspec.lock b/example/pubspec.lock index 49b8fe5..3e40768 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,27 +1,13 @@ # Generated by pub # See https://www.dartlang.org/tools/pub/glossary#lockfile packages: - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.dartlang.org" - source: hosted - version: "0.33.0" animated_text_kit: dependency: "direct dev" description: path: ".." relative: true source: path - version: "1.1.1" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.0" + version: "1.2.0" async: dependency: transitive description: @@ -50,27 +36,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.11" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.6" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.6" cupertino_icons: dependency: "direct main" description: @@ -88,83 +53,6 @@ packages: description: flutter source: sdk version: "0.0.0" - front_end: - dependency: transitive - description: - name: front_end - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.6" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.7" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.3+3" - http: - dependency: transitive - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.0" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.3" - io: - dependency: transitive - description: - name: io - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.3" - js: - dependency: transitive - description: - name: js - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.1+1" - json_rpc_2: - dependency: transitive - description: - name: json_rpc_2 - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.9" - kernel: - dependency: transitive - description: - name: kernel - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.6" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.dartlang.org" - source: hosted - version: "0.11.3+2" matcher: dependency: transitive description: @@ -179,41 +67,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.6+2" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - node_preamble: - dependency: transitive - description: - name: node_preamble - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.4" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.6" path: dependency: transitive description: @@ -221,81 +74,18 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.6.2" - plugin: - dependency: transitive - description: - name: plugin - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0+3" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.6" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.2" quiver: dependency: transitive description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.0+1" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.dartlang.org" - source: hosted - version: "0.7.3+3" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" - shelf_static: - dependency: transitive - description: - name: shelf_static - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.8" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.2+4" + version: "2.0.1" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.5" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.8" source_span: dependency: transitive description: @@ -331,13 +121,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.1" - test: + test_api: dependency: transitive description: - name: test + name: test_api url: "https://pub.dartlang.org" source: hosted - version: "1.3.4" + version: "0.2.1" typed_data: dependency: transitive description: @@ -345,13 +135,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" - utf: - dependency: transitive - description: - name: utf - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.0+5" vector_math: dependency: transitive description: @@ -359,34 +142,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" - vm_service_client: - dependency: transitive - description: - name: vm_service_client - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.6" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.7+10" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.9" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.15" sdks: dart: ">=2.0.0 <3.0.0" flutter: ">=0.3.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 5142c88..c79ab67 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: animated_text_kit description: A flutter package project which contains a collection of cool and beautiful text animations. -version: 1.2.0 +version: 1.3.0 author: Ayush Agarwal homepage: https://github.com/aagarwal1012/Animated-Text-Kit/