Skip to content

Commit 37328fe

Browse files
committed
Dart Analyze Fixes
- Add and run dart analyze.
1 parent a082c53 commit 37328fe

File tree

9 files changed

+89
-74
lines changed

9 files changed

+89
-74
lines changed

lib/components/blog.dart

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ImageWrapper extends StatelessWidget {
1616
//TODO Listen to inherited widget width updates.
1717
double width = MediaQuery.of(context).size.width;
1818
return Container(
19-
margin: EdgeInsets.symmetric(vertical: 24),
19+
margin: const EdgeInsets.symmetric(vertical: 24),
2020
child: Image.asset(
2121
image,
2222
width: width,
@@ -57,11 +57,11 @@ class Tag extends StatelessWidget {
5757
tag,
5858
style: GoogleFonts.openSans(color: Colors.white, fontSize: 14),
5959
),
60-
fillColor: Color(0xFF242424),
61-
padding: EdgeInsets.symmetric(horizontal: 16),
60+
fillColor: const Color(0xFF242424),
61+
padding: const EdgeInsets.symmetric(horizontal: 16),
6262
elevation: 0,
6363
hoverElevation: 0,
64-
hoverColor: Color(0xFFC7C7C7),
64+
hoverColor: const Color(0xFFC7C7C7),
6565
highlightElevation: 0,
6666
focusElevation: 0,
6767
);
@@ -102,20 +102,20 @@ class ReadMoreButton extends StatelessWidget {
102102
states.contains(MaterialState.hovered) ||
103103
states.contains(MaterialState.pressed)) {
104104
return GoogleFonts.montserrat(
105-
textStyle: TextStyle(
105+
textStyle: const TextStyle(
106106
fontSize: 14, color: Colors.white, letterSpacing: 1),
107107
);
108108
}
109109

110110
return GoogleFonts.montserrat(
111-
textStyle:
112-
TextStyle(fontSize: 14, color: textPrimary, letterSpacing: 1),
111+
textStyle: const TextStyle(
112+
fontSize: 14, color: textPrimary, letterSpacing: 1),
113113
);
114114
}),
115115
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
116116
const EdgeInsets.symmetric(horizontal: 12, vertical: 16)),
117117
),
118-
child: Text(
118+
child: const Text(
119119
"READ MORE",
120120
),
121121
);
@@ -125,7 +125,7 @@ class ReadMoreButton extends StatelessWidget {
125125
const Widget divider = Divider(color: Color(0xFFEEEEEE), thickness: 1);
126126
Widget dividerSmall = Container(
127127
width: 40,
128-
decoration: BoxDecoration(
128+
decoration: const BoxDecoration(
129129
border: Border(
130130
bottom: BorderSide(
131131
color: Color(0xFFA0A0A0),
@@ -139,14 +139,14 @@ List<Widget> authorSection({String? imageUrl, String? name, String? bio}) {
139139
return [
140140
divider,
141141
Container(
142-
padding: EdgeInsets.symmetric(vertical: 40),
142+
padding: const EdgeInsets.symmetric(vertical: 40),
143143
child: Row(
144144
children: <Widget>[
145145
if (imageUrl != null)
146146
Container(
147-
margin: EdgeInsets.only(right: 25),
147+
margin: const EdgeInsets.only(right: 25),
148148
child: Material(
149-
shape: CircleBorder(),
149+
shape: const CircleBorder(),
150150
clipBehavior: Clip.hardEdge,
151151
color: Colors.transparent,
152152
child: Image.asset(
@@ -184,6 +184,8 @@ List<Widget> authorSection({String? imageUrl, String? name, String? bio}) {
184184
}
185185

186186
class PostNavigation extends StatelessWidget {
187+
const PostNavigation({Key? key}) : super(key: key);
188+
187189
// TODO Get PostID from Global Routing Singleton.
188190
// Example: String currentPage = RouteController.of(context).currentPage;
189191
@override
@@ -193,19 +195,19 @@ class PostNavigation extends StatelessWidget {
193195
children: <Widget>[
194196
Row(
195197
children: <Widget>[
196-
Icon(
198+
const Icon(
197199
Icons.keyboard_arrow_left,
198200
size: 25,
199201
color: textSecondary,
200202
),
201203
Text("PREVIOUS POST", style: buttonTextStyle),
202204
],
203205
),
204-
Spacer(),
206+
const Spacer(),
205207
Row(
206208
children: <Widget>[
207209
Text("NEXT POST", style: buttonTextStyle),
208-
Icon(
210+
const Icon(
209211
Icons.keyboard_arrow_right,
210212
size: 25,
211213
color: textSecondary,
@@ -218,26 +220,28 @@ class PostNavigation extends StatelessWidget {
218220
}
219221

220222
class ListNavigation extends StatelessWidget {
223+
const ListNavigation({Key? key}) : super(key: key);
224+
221225
@override
222226
Widget build(BuildContext context) {
223227
return Row(
224228
mainAxisAlignment: MainAxisAlignment.spaceBetween,
225229
children: <Widget>[
226230
Row(
227231
children: <Widget>[
228-
Icon(
232+
const Icon(
229233
Icons.keyboard_arrow_left,
230234
size: 25,
231235
color: textSecondary,
232236
),
233237
Text("NEWER POSTS", style: buttonTextStyle),
234238
],
235239
),
236-
Spacer(),
240+
const Spacer(),
237241
Row(
238242
children: <Widget>[
239243
Text("OLDER POSTS", style: buttonTextStyle),
240-
Icon(
244+
const Icon(
241245
Icons.keyboard_arrow_right,
242246
size: 25,
243247
color: textSecondary,
@@ -250,12 +254,14 @@ class ListNavigation extends StatelessWidget {
250254
}
251255

252256
class Footer extends StatelessWidget {
257+
const Footer({Key? key}) : super(key: key);
258+
253259
// TODO Add additional footer components (i.e. about, links, logos).
254260
@override
255261
Widget build(BuildContext context) {
256262
return Container(
257-
padding: EdgeInsets.symmetric(vertical: 40),
258-
child: Align(
263+
padding: const EdgeInsets.symmetric(vertical: 40),
264+
child: const Align(
259265
alignment: Alignment.centerRight,
260266
child: TextBody(text: "Copyright © 2020"),
261267
),
@@ -278,10 +284,8 @@ class ListItem extends StatelessWidget {
278284
return Column(
279285
children: <Widget>[
280286
if (imageUrl != null)
281-
Container(
282-
child: ImageWrapper(
283-
image: imageUrl!,
284-
),
287+
ImageWrapper(
288+
image: imageUrl!,
285289
),
286290
Align(
287291
alignment: Alignment.centerLeft,
@@ -327,13 +331,15 @@ class ListItem extends StatelessWidget {
327331
* a hamburger menu on screens smaller than 400px.
328332
*/
329333
class MenuBar extends StatelessWidget {
334+
const MenuBar({Key? key}) : super(key: key);
335+
330336
@override
331337
Widget build(BuildContext context) {
332338
return Column(
333339
mainAxisSize: MainAxisSize.min,
334340
children: <Widget>[
335341
Container(
336-
margin: EdgeInsets.symmetric(vertical: 30),
342+
margin: const EdgeInsets.symmetric(vertical: 30),
337343
child: Row(
338344
children: <Widget>[
339345
GestureDetector(
@@ -412,8 +418,8 @@ class MenuBar extends StatelessWidget {
412418
),
413419
Container(
414420
height: 1,
415-
margin: EdgeInsets.only(bottom: 30),
416-
color: Color(0xFFEEEEEE)),
421+
margin: const EdgeInsets.only(bottom: 30),
422+
color: const Color(0xFFEEEEEE)),
417423
],
418424
);
419425
}

lib/components/text.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class TextBlockquote extends StatelessWidget {
6262
Widget build(BuildContext context) {
6363
return Container(
6464
margin: marginBottom24,
65-
decoration: BoxDecoration(
65+
decoration: const BoxDecoration(
6666
border: Border(left: BorderSide(width: 2, color: Color(0xFF333333)))),
67-
padding: EdgeInsets.only(left: 20),
67+
padding: const EdgeInsets.only(left: 20),
6868
child: Align(
6969
alignment: Alignment.centerLeft,
7070
child: Text(

lib/components/typography.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ import 'package:minimal/components/color.dart';
44

55
// Simple
66
TextStyle headlineTextStyle = GoogleFonts.montserrat(
7-
textStyle: TextStyle(
7+
textStyle: const TextStyle(
88
fontSize: 26,
99
color: textPrimary,
1010
letterSpacing: 1.5,
1111
fontWeight: FontWeight.w300));
1212

1313
TextStyle headlineSecondaryTextStyle = GoogleFonts.montserrat(
14-
textStyle: TextStyle(
14+
textStyle: const TextStyle(
1515
fontSize: 20, color: textPrimary, fontWeight: FontWeight.w300));
1616

1717
TextStyle subtitleTextStyle = GoogleFonts.openSans(
18-
textStyle: TextStyle(fontSize: 14, color: textSecondary, letterSpacing: 1));
18+
textStyle: const TextStyle(fontSize: 14, color: textSecondary, letterSpacing: 1));
1919

2020
TextStyle bodyTextStyle = GoogleFonts.openSans(
21-
textStyle: TextStyle(fontSize: 14, color: textPrimary));
21+
textStyle: const TextStyle(fontSize: 14, color: textPrimary));
2222

2323
TextStyle buttonTextStyle = GoogleFonts.montserrat(
24-
textStyle: TextStyle(fontSize: 14, color: textPrimary, letterSpacing: 1));
24+
textStyle: const TextStyle(fontSize: 14, color: textPrimary, letterSpacing: 1));
2525

2626
// Advanced
2727
// TODO: Add additional text styles.

lib/main.dart

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import 'package:minimal/routes.dart';
44
import 'package:responsive_framework/responsive_framework.dart';
55

66
void main() {
7-
runApp(MyApp());
7+
runApp(const MyApp());
88
}
99

1010
class MyApp extends StatelessWidget {
11+
const MyApp({Key? key}) : super(key: key);
12+
1113
@override
1214
Widget build(BuildContext context) {
1315
return MaterialApp(
@@ -17,25 +19,25 @@ class MyApp extends StatelessWidget {
1719
minWidth: 450,
1820
defaultScale: true,
1921
breakpoints: [
20-
ResponsiveBreakpoint.resize(450, name: MOBILE),
21-
ResponsiveBreakpoint.autoScale(800, name: TABLET),
22-
ResponsiveBreakpoint.autoScale(1000, name: TABLET),
23-
ResponsiveBreakpoint.resize(1200, name: DESKTOP),
24-
ResponsiveBreakpoint.autoScale(2460, name: "4K"),
22+
const ResponsiveBreakpoint.resize(450, name: MOBILE),
23+
const ResponsiveBreakpoint.autoScale(800, name: TABLET),
24+
const ResponsiveBreakpoint.autoScale(1000, name: TABLET),
25+
const ResponsiveBreakpoint.resize(1200, name: DESKTOP),
26+
const ResponsiveBreakpoint.autoScale(2460, name: "4K"),
2527
],
26-
background: Container(color: Color(0xFFF5F5F5))),
28+
background: Container(color: const Color(0xFFF5F5F5))),
2729
initialRoute: Routes.home,
2830
onGenerateRoute: (RouteSettings settings) {
2931
return Routes.fadeThrough(settings, (context) {
3032
switch (settings.name) {
3133
case Routes.home:
32-
return ListPage();
34+
return const ListPage();
3335
case Routes.post:
34-
return PostPage();
36+
return const PostPage();
3537
case Routes.style:
36-
return TypographyPage();
38+
return const TypographyPage();
3739
default:
38-
return SizedBox.shrink();
40+
return const SizedBox.shrink();
3941
}
4042
});
4143
},

lib/pages/page_list.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,55 @@ const String listItemPreviewText =
77
"Sed elementum tempus egestas sed sed risus. Mauris in aliquam sem fringilla ut morbi tincidunt. Placerat vestibulum lectus mauris ultrices eros. Et leo duis ut diam. Auctor neque vitae tempus […]";
88

99
class ListPage extends StatelessWidget {
10+
const ListPage({Key? key}) : super(key: key);
11+
1012
@override
1113
Widget build(BuildContext context) {
1214
return Scaffold(
1315
body: Stack(
1416
children: <Widget>[
1517
SingleChildScrollView(
1618
child: Container(
17-
margin: EdgeInsets.symmetric(horizontal: 32),
19+
margin: const EdgeInsets.symmetric(horizontal: 32),
1820
child: Column(
1921
children: <Widget>[
20-
MenuBar(),
21-
ListItem(
22+
const MenuBar(),
23+
const ListItem(
2224
imageUrl:
2325
"assets/images/paper_flower_overhead_bw_w1080.jpg",
2426
title: listItemTitleText,
2527
description: listItemPreviewText),
2628
divider,
27-
ListItem(
29+
const ListItem(
2830
imageUrl:
2931
"assets/images/iphone_cactus_tea_overhead_bw_w1080.jpg",
3032
title: listItemTitleText,
3133
description: listItemPreviewText),
3234
divider,
33-
ListItem(
35+
const ListItem(
3436
imageUrl:
3537
"assets/images/typewriter_overhead_bw_w1080.jpg",
3638
title: listItemTitleText,
3739
description: listItemPreviewText),
3840
divider,
39-
ListItem(
41+
const ListItem(
4042
imageUrl:
4143
"assets/images/coffee_paperclips_pencil_angled_bw_w1080.jpg",
4244
title: listItemTitleText,
4345
description: listItemPreviewText),
4446
divider,
45-
ListItem(
47+
const ListItem(
4648
imageUrl:
4749
"assets/images/joy_note_coffee_eyeglasses_overhead_bw_w1080.jpg",
4850
title: listItemTitleText,
4951
description: listItemPreviewText),
5052
divider,
5153
Container(
52-
padding: EdgeInsets.symmetric(vertical: 80),
53-
child: ListNavigation(),
54+
padding: const EdgeInsets.symmetric(vertical: 80),
55+
child: const ListNavigation(),
5456
),
5557
divider,
56-
Footer(),
58+
const Footer(),
5759
],
5860
),
5961
),

0 commit comments

Comments
 (0)