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 3efb54b..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 @@ -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 ), ); ``` 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/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 9f502aa..a3ca73d 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, ), ); 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/