Skip to content

Commit

Permalink
Code Review (#81)
Browse files Browse the repository at this point in the history
* Code Review
 - Removed obsolete `new` keywords.
 - Added types to collection and function variables.
 - Added `final` and `const` keywords.
 - Replaced `null` guards with concise `?.` and `??` operators.
 - Added missing null check on `dispose` for `FadeAnimatedTextKit`.
 - In `fade.dart`, renamed the `_RotatingTextState` class to `_FadeTextState` to be consistent with the overall pattern and avoid confusion with `_RotatingTextState` in `rotate.dart`.

**Warning**:
 - Removed `onNextBeforePause` from `ColorizeAnimatedTextKit` because it was not referenced.

* Renamed more internal State classes to match their counterpart Stateful Widget name better.

* Further optimization for AnimatedBuilder.

* More consistency.  Simplified some comparison expressions, added child to some AnimatedBuilders, and added const keyword.
  • Loading branch information
awhitford committed May 26, 2020
1 parent 715541c commit 425c3ef
Show file tree
Hide file tree
Showing 9 changed files with 1,565 additions and 1,696 deletions.
12 changes: 6 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:animated_text_kit/animated_text_kit.dart';

void main() => runApp(new MyApp());
void main() => runApp(MyApp());

const List<String> labels = [
"Rotate",
Expand All @@ -17,18 +17,18 @@ class MyApp extends StatefulWidget {
/// This widget is the root of your application.
@override
MyAppState createState() {
return new MyAppState();
return MyAppState();
}
}

class MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
title: 'Animated Text Kit',
debugShowCheckedModeBanner: false,
theme: ThemeData.dark(),
home: new MyHomePage(title: 'Animated Text Kit'),
home: MyHomePage(title: 'Animated Text Kit'),
);
}
}
Expand All @@ -42,7 +42,7 @@ class MyHomePage extends StatefulWidget {
}) : super(key: key);

@override
_MyHomePageState createState() => new _MyHomePageState();
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Expand Down Expand Up @@ -168,7 +168,7 @@ class _MyHomePageState extends State<MyHomePage> {

@override
Widget build(BuildContext context) {
return new Scaffold(
return Scaffold(
body: Column(
children: <Widget>[
SizedBox(
Expand Down
Loading

0 comments on commit 425c3ef

Please sign in to comment.