Skip to content

Commit 91b7f04

Browse files
author
Gordon Hayes
committed
refactor: analysis
1 parent 6e97a04 commit 91b7f04

13 files changed

+121
-155
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:very_good_analysis/analysis_options.yaml
2+
3+
analyzer:
4+
strong-mode:
5+
implicit-casts: false
6+
implicit-dynamic: false
7+
8+
linter:
9+
rules:
10+
public_member_api_docs: false

section_4/login_example_sequence_animation/lib/main.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ import 'package:flutter/material.dart';
22

33
import 'pages/auth_page.dart';
44

5-
void main() => runApp(MyApp());
5+
void main() => runApp(const MyApp());
66

77
class MyApp extends StatelessWidget {
8+
const MyApp({Key key}) : super(key: key);
9+
810
@override
911
Widget build(BuildContext context) {
10-
return MaterialApp(
12+
return const MaterialApp(
1113
debugShowCheckedModeBanner: false,
1214
title: 'Sequence Animation App',
1315
home: Scaffold(
14-
body: const AuthPage(),
16+
body: AuthPage(),
1517
),
1618
);
1719
}

section_4/login_example_sequence_animation/lib/pages/auth_page.dart

+15-9
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class _AuthPageState extends State<AuthPage>
4949
void initState() {
5050
_controller = AnimationController(
5151
vsync: this,
52-
duration: Duration(milliseconds: 1200),
52+
duration: const Duration(milliseconds: 1200),
5353
)..addStatusListener(_animationStatusListener);
5454

5555
_initSequenceAnimation();
@@ -176,7 +176,10 @@ class _AuthPageState extends State<AuthPage>
176176

177177
Future<void> _routeTransition() {
178178
return Future.delayed(const Duration(milliseconds: 500), () {
179-
Navigator.pushReplacement(context, FadeRoute(HomePage()));
179+
Navigator.pushReplacement<dynamic, dynamic>(
180+
context,
181+
FadeRoute(const HomePage()),
182+
);
180183
});
181184
}
182185

@@ -188,8 +191,8 @@ class _AuthPageState extends State<AuthPage>
188191
children: <Widget>[
189192
ConstrainedBox(
190193
constraints: const BoxConstraints.expand(),
191-
child: FlutterLogo(
192-
colors: Colors.blueGrey,
194+
child: const FlutterLogo(
195+
textColor: Colors.blueGrey,
193196
style: FlutterLogoStyle.markOnly,
194197
),
195198
),
@@ -203,20 +206,23 @@ class _AuthPageState extends State<AuthPage>
203206
child: BackdropFilter(
204207
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
205208
child: Container(
206-
height: _sequenceAnimation['height'].value,
207-
width: _sequenceAnimation['width'].value,
209+
height: _sequenceAnimation['height'].value as double,
210+
width: _sequenceAnimation['width'].value as double,
208211
decoration: BoxDecoration(
209212
color: Colors.grey.shade300.withOpacity(0.1),
210-
borderRadius: _sequenceAnimation['borderRadius'].value,
213+
borderRadius: _sequenceAnimation['borderRadius'].value
214+
as BorderRadiusGeometry,
211215
),
212216
child: Stack(
213217
children: <Widget>[
214218
Center(
215219
child: body,
216220
),
217221
Header(
218-
scale: _sequenceAnimation['scale'].value,
219-
height: _sequenceAnimation['headerHight'].value,
222+
scale:
223+
_sequenceAnimation['scale'].value as double,
224+
height: _sequenceAnimation['headerHight'].value
225+
as double,
220226
isLogin: _isLogin),
221227
],
222228
),

section_4/login_example_sequence_animation/lib/pages/home_page.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
33
import '../styles/backgrounds.dart';
44

55
class HomePage extends StatefulWidget {
6-
HomePage({Key key}) : super(key: key);
6+
const HomePage({Key key}) : super(key: key);
77

88
@override
99
_HomePageState createState() => _HomePageState();

section_4/login_example_sequence_animation/lib/styles/backgrounds.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BoxDecoration backgroundAuthDecoration() {
77
gradient: LinearGradient(
88
begin: Alignment.bottomLeft,
99
end: Alignment.topRight,
10-
stops: [0.1, 0.5, 0.9],
10+
stops: const [0.1, 0.5, 0.9],
1111
colors: [
1212
authPageBackgroundColor[700],
1313
authPageBackgroundColor[600],
@@ -25,7 +25,7 @@ LinearGradient linearGradientHomeDecoration() {
2525
return LinearGradient(
2626
begin: Alignment.bottomLeft,
2727
end: Alignment.topRight,
28-
stops: [0.1, 0.5, 0.7, 0.9],
28+
stops: const [0.1, 0.5, 0.7, 0.9],
2929
colors: [
3030
homePageBackgroundColor[800],
3131
homePageBackgroundColor[700],

section_4/login_example_sequence_animation/lib/utils/fade_route.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import 'package:flutter/widgets.dart';
22

3-
class FadeRoute extends PageRoute {
4-
final Widget child;
5-
3+
class FadeRoute extends PageRoute<dynamic> {
64
FadeRoute(this.child);
75

6+
final Widget child;
7+
88
@override
99
Color get barrierColor => null;
1010

section_4/login_example_sequence_animation/lib/widgets/expanding_page_animation.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ExpandingPageAnimation extends StatelessWidget {
2121
Widget build(BuildContext context) {
2222
return Center(
2323
child: AnimatedContainer(
24-
duration: Duration(milliseconds: 500),
24+
duration: const Duration(milliseconds: 500),
2525
curve: Curves.ease,
2626
width: _width,
2727
height: _height,

section_4/login_example_sequence_animation/lib/widgets/forms/call_to_action_button.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CallToActionButton extends StatelessWidget {
1515

1616
@override
1717
Widget build(BuildContext context) {
18-
return FlatButton(
18+
return TextButton(
1919
onPressed: () {
2020
if (onPressed != null) {
2121
onPressed();

section_4/login_example_sequence_animation/lib/widgets/forms/login_form.dart

+31-33
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,37 @@ class LoginForm extends StatelessWidget {
2424
child: SingleChildScrollView(
2525
child: Padding(
2626
padding: EdgeInsets.only(top: safeArea),
27-
child: Container(
28-
child: Column(
29-
children: <Widget>[
30-
Padding(
31-
padding: const EdgeInsets.only(bottom: 16.0),
32-
child: CallToActionText('Please sign in to continue')),
33-
TextInputBox(
34-
icon: Icons.email,
35-
hintText: 'Email',
36-
),
37-
TextInputBox(
38-
icon: Icons.lock_outline,
39-
hintText: 'Password',
40-
obscureText: true,
41-
),
42-
CallToActionButton(
43-
onPressed: onLoginPressed,
44-
text: 'Login',
45-
color: headerLoginColor,
46-
),
47-
Row(
48-
mainAxisAlignment: MainAxisAlignment.center,
49-
children: <Widget>[
50-
CallToActionText("Don't have an account?"),
51-
CallToActionButton(
52-
onPressed: onSignUpPressed,
53-
text: 'Sign Up',
54-
color: headerSignUpColor,
55-
),
56-
],
57-
),
58-
],
59-
),
27+
child: Column(
28+
children: <Widget>[
29+
const Padding(
30+
padding: EdgeInsets.only(bottom: 16.0),
31+
child: CallToActionText('Please sign in to continue')),
32+
const TextInputBox(
33+
icon: Icons.email,
34+
hintText: 'Email',
35+
),
36+
const TextInputBox(
37+
icon: Icons.lock_outline,
38+
hintText: 'Password',
39+
obscureText: true,
40+
),
41+
CallToActionButton(
42+
onPressed: onLoginPressed,
43+
text: 'Login',
44+
color: headerLoginColor,
45+
),
46+
Row(
47+
mainAxisAlignment: MainAxisAlignment.center,
48+
children: <Widget>[
49+
const CallToActionText("Don't have an account?"),
50+
CallToActionButton(
51+
onPressed: onSignUpPressed,
52+
text: 'Sign Up',
53+
color: headerSignUpColor,
54+
),
55+
],
56+
),
57+
],
6058
),
6159
),
6260
),

section_4/login_example_sequence_animation/lib/widgets/forms/signup_form.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ class SignUpForm extends StatelessWidget {
2626
padding: EdgeInsets.only(top: safeArea),
2727
child: Column(
2828
children: <Widget>[
29-
Padding(
30-
padding: const EdgeInsets.all(16.0),
29+
const Padding(
30+
padding: EdgeInsets.all(16.0),
3131
child: CallToActionText('Create an account'),
3232
),
33-
TextInputBox(
33+
const TextInputBox(
3434
icon: Icons.portrait,
3535
hintText: 'Name',
3636
),
37-
TextInputBox(
37+
const TextInputBox(
3838
icon: Icons.email,
3939
hintText: 'Email',
4040
),
41-
TextInputBox(
41+
const TextInputBox(
4242
icon: Icons.lock_outline,
4343
hintText: 'Password',
4444
obscureText: true,
@@ -50,7 +50,7 @@ class SignUpForm extends StatelessWidget {
5050
Row(
5151
mainAxisAlignment: MainAxisAlignment.center,
5252
children: <Widget>[
53-
CallToActionText('Already have an account?'),
53+
const CallToActionText('Already have an account?'),
5454
CallToActionButton(
5555
text: 'Sign in',
5656
onPressed: onLoginPressed,

section_4/login_example_sequence_animation/lib/widgets/forms/text_input_box.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ class TextInputBox extends StatelessWidget {
1818
padding: const EdgeInsets.all(8.0),
1919
child: TextFormField(
2020
obscureText: obscureText,
21-
style: TextStyle(color: Colors.white),
21+
style: const TextStyle(color: Colors.white),
2222
decoration: InputDecoration(
2323
prefixIcon: Icon(icon, color: Colors.white54),
2424
focusedBorder: OutlineInputBorder(
2525
borderRadius: BorderRadius.circular(30),
26-
borderSide: BorderSide(color: Colors.white, width: 2.0),
26+
borderSide: const BorderSide(color: Colors.white, width: 2.0),
2727
),
2828
enabledBorder: OutlineInputBorder(
2929
borderRadius: BorderRadius.circular(30),
30-
borderSide: BorderSide(color: Colors.white54, width: 2.0),
30+
borderSide: const BorderSide(color: Colors.white54, width: 2.0),
3131
),
3232
hintText: hintText,
33-
hintStyle: TextStyle(color: Colors.white70),
33+
hintStyle: const TextStyle(color: Colors.white70),
3434
),
3535
),
3636
);

0 commit comments

Comments
 (0)