From acace3ff640e1dbaaf17cf558dd0a2f711226529 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 23 Oct 2020 03:57:06 -0700 Subject: [PATCH 1/6] Added pedantic lint rules. --- analysis_options.yaml | 1 + pubspec.yaml | 1 + 2 files changed, 2 insertions(+) create mode 100644 analysis_options.yaml diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..108d105 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1 @@ +include: package:pedantic/analysis_options.yaml diff --git a/pubspec.yaml b/pubspec.yaml index 12084b6..f309f9d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + pedantic: ^1.9.2 flutter: From fca8467e26cc26b597c488dd0007b48811024da7 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 23 Oct 2020 05:04:12 -0700 Subject: [PATCH 2/6] Need to add pedantic to example too. --- example/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f47c4b6..38f5c10 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -12,9 +12,9 @@ dev_dependencies: sdk: flutter animated_text_kit: path: ../ + pedantic: ^1.9.2 flutter: - uses-material-design: true assets: From f3dfd316c939cc2d027538291e26ff2ef00bff50 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 23 Oct 2020 05:39:44 -0700 Subject: [PATCH 3/6] Revised example to pass pedantic rules. --- example/lib/main.dart | 78 +++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 1fcb0d5..21bbaa5 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -4,14 +4,14 @@ import 'package:animated_text_kit/animated_text_kit.dart'; void main() => runApp(MyApp()); const List labels = [ - "Rotate", - "Fade", - "Typer", - "Typewriter", - "Scale", - "Colorize", - "TextLiquidFill", - "Wavy Text" + 'Rotate', + 'Fade', + 'Typer', + 'Typewriter', + 'Scale', + 'Colorize', + 'TextLiquidFill', + 'Wavy Text' ]; class MyApp extends StatefulWidget { @@ -47,7 +47,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - List _textAnimationKit = [ + final _textAnimationKit = [ ListView( scrollDirection: Axis.horizontal, children: [ @@ -59,7 +59,7 @@ class _MyHomePageState extends State { height: 100.0, ), Text( - "Be", + 'Be', style: TextStyle(fontSize: 43.0), ), SizedBox( @@ -68,13 +68,13 @@ class _MyHomePageState extends State { ), RotateAnimatedTextKit( onTap: () { - print("Tap Event"); + print('Tap Event'); }, isRepeatingAnimation: true, totalRepeatCount: 10, - text: ["AWESOME", "OPTIMISTIC", "DIFFERENT"], + text: ['AWESOME', 'OPTIMISTIC', 'DIFFERENT'], // alignment: Alignment(1.0, 0.5), - textStyle: TextStyle(fontSize: 40.0, fontFamily: "Horizon"), + textStyle: TextStyle(fontSize: 40.0, fontFamily: 'Horizon'), ), ], ), @@ -82,60 +82,60 @@ class _MyHomePageState extends State { ), FadeAnimatedTextKit( onTap: () { - print("Tap Event"); + print('Tap Event'); }, - text: ["do IT!", "do it RIGHT!!", "do it RIGHT NOW!!!"], + 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"); + print('Tap Event'); }, text: [ - "It is not enough to do your best,", - "you must know what to do,", - "and then do your best", - "- W.Edwards Deming", + 'It is not enough to do your best,', + 'you must know what to do,', + 'and then do your best', + '- W.Edwards Deming', ], - textStyle: TextStyle(fontSize: 30.0, fontFamily: "Bobbers"), + textStyle: TextStyle(fontSize: 30.0, fontFamily: 'Bobbers'), ), ), SizedBox( width: 250.0, child: TypewriterAnimatedTextKit( onTap: () { - print("Tap Event"); + print('Tap Event'); }, text: [ - "Discipline is the best tool", - "Design first, then code", - "Do not patch bugs out, rewrite them", - "Do not test bugs out, design them out", + 'Discipline is the best tool', + 'Design first, then code', + 'Do not patch bugs out, rewrite them', + 'Do not test bugs out, design them out', ], - textStyle: TextStyle(fontSize: 30.0, fontFamily: "Agne"), + textStyle: TextStyle(fontSize: 30.0, fontFamily: 'Agne'), ), ), ScaleAnimatedTextKit( onTap: () { - print("Tap Event"); + print('Tap Event'); }, - text: ["Think", "Build", "Ship"], - textStyle: TextStyle(fontSize: 70.0, fontFamily: "Canterbury"), + text: ['Think', 'Build', 'Ship'], + textStyle: TextStyle(fontSize: 70.0, fontFamily: 'Canterbury'), ), /// colors.length >= 2 ColorizeAnimatedTextKit( onTap: () { - print("Tap Event"); + print('Tap Event'); }, text: [ - "Larry Page", - "Bill Gates", - "Steve Jobs", + 'Larry Page', + 'Bill Gates', + 'Steve Jobs', ], - textStyle: TextStyle(fontSize: 50.0, fontFamily: "Horizon"), + textStyle: TextStyle(fontSize: 50.0, fontFamily: 'Horizon'), colors: [ Colors.purple, Colors.blue, @@ -157,14 +157,14 @@ class _MyHomePageState extends State { WavyAnimatedTextKit( textStyle: TextStyle(fontSize: 20), text: [ - "Hello World", - "Look at the waves", - "They look so Amazing", + 'Hello World', + 'Look at the waves', + 'They look so Amazing', ], ), ]; - List _colors = [ + final _colors = [ Colors.orange[800], Colors.brown[600], Colors.lightGreen[800], From c7c1f6dfd289facbfd31bf809f06eb126e8551aa Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 23 Oct 2020 15:29:28 -0700 Subject: [PATCH 4/6] Added a lint ignore because the build needs zero analyze issues. --- test/smoke_test.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/test/smoke_test.dart b/test/smoke_test.dart index aadcf14..7bed99e 100644 --- a/test/smoke_test.dart +++ b/test/smoke_test.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +// ignore: avoid_relative_lib_imports import '../example/lib/main.dart'; void main() { From a5b0ff51862208929e429cc5dc207af9697ca1e2 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 23 Oct 2020 15:57:34 -0700 Subject: [PATCH 5/6] Removed async from _nextAnimation. --- lib/src/wavy.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/wavy.dart b/lib/src/wavy.dart index f1854a3..917df38 100644 --- a/lib/src/wavy.dart +++ b/lib/src/wavy.dart @@ -119,7 +119,7 @@ class _WavyAnimatedTextKitState extends State ); } - Future _nextAnimation() async { + void _nextAnimation() { final isLast = _index == widget.text.length - 1; // Handling onNext callback From 95322205bd9a63d41d30a0f8d0635470c00ae9e2 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 23 Oct 2020 15:58:11 -0700 Subject: [PATCH 6/6] Removed unnecessary null guard. --- lib/src/colorize.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/colorize.dart b/lib/src/colorize.dart index 9cf612e..3d76511 100644 --- a/lib/src/colorize.dart +++ b/lib/src/colorize.dart @@ -225,7 +225,7 @@ class _ColorizeTextState extends State ), )..addStatusListener(_animationEndCallback); - _controller?.forward(); + _controller.forward(); } void _animationEndCallback(state) {