Skip to content

Commit 35f6cb5

Browse files
committed
Code Cleanup #1
1 parent 3eb6806 commit 35f6cb5

7 files changed

Lines changed: 66 additions & 55 deletions

File tree

lib/components/components.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export 'colors.dart';
2-
export 'spacing.dart';
32
export 'typography.dart';

lib/components/spacing.dart

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/components/typography.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ const TextStyle linkTitleTextStyle = TextStyle(
1515
fontSize: 20, color: linkTitleColor, height: 1.6, fontFamily: fontFamily);
1616

1717
const TextStyle bodyTextStyle = TextStyle(
18-
fontSize: 14, color: textPrimaryColor, height: 1.5, fontFamily: "Roboto");
18+
fontSize: 14, color: textPrimaryColor, height: 1.5, fontFamily: 'Roboto');
1919

2020
const TextStyle footerLinkTextStyle = TextStyle(
2121
fontSize: 14,
2222
color: textWhiteDarkBackgroundColor,
2323
height: 1.6,
24-
fontFamily: "Roboto");
24+
fontFamily: 'Roboto');

lib/main.dart

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,46 @@ class MyApp extends StatelessWidget {
1919
breakpoints: [
2020
ResponsiveBreakpoint.resize(360),
2121
ResponsiveBreakpoint.resize(480, name: MOBILE),
22-
ResponsiveBreakpoint.resize(640, name: "MOBILE_LARGE"),
22+
ResponsiveBreakpoint.resize(640, name: 'MOBILE_LARGE'),
2323
ResponsiveBreakpoint.resize(850, name: TABLET),
2424
ResponsiveBreakpoint.resize(1080, name: DESKTOP),
2525
],
2626
),
2727
home: Scaffold(
2828
body: SingleChildScrollView(
2929
scrollDirection: Axis.vertical,
30-
child: Column(
31-
children: <Widget>[
32-
MenuBar(),
33-
Header(),
34-
FlutterFavorites(),
35-
// Background squares image container.
36-
Container(
37-
constraints: BoxConstraints(maxWidth: 1440, minWidth: 1440),
38-
decoration: BoxDecoration(
39-
image: DecorationImage(
40-
image: AssetImage('assets/images/bg_squares.png'),
41-
fit: BoxFit.fitWidth,
42-
alignment: Alignment.center)),
43-
child: Column(
44-
mainAxisSize: MainAxisSize.min,
45-
crossAxisAlignment: CrossAxisAlignment.center,
46-
children: [
47-
MostPopular(),
48-
TopFlutter(),
49-
TopDart(),
50-
Container(height: 92),
51-
],
30+
child: Listener(
31+
onPointerDown: (event) {
32+
// Clear Header search TextField focus.
33+
FocusScope.of(context).requestFocus(FocusNode());
34+
},
35+
child: Column(
36+
children: <Widget>[
37+
MenuBar(),
38+
Header(),
39+
FlutterFavorites(),
40+
// Background squares image container.
41+
Container(
42+
constraints: BoxConstraints(maxWidth: 1440, minWidth: 1440),
43+
decoration: BoxDecoration(
44+
image: DecorationImage(
45+
image: AssetImage('assets/images/bg_squares.png'),
46+
fit: BoxFit.fitWidth,
47+
alignment: Alignment.center)),
48+
child: Column(
49+
mainAxisSize: MainAxisSize.min,
50+
crossAxisAlignment: CrossAxisAlignment.center,
51+
children: [
52+
MostPopular(),
53+
TopFlutter(),
54+
TopDart(),
55+
Container(height: 92),
56+
],
57+
),
5258
),
53-
),
54-
Footer(),
55-
],
59+
Footer(),
60+
],
61+
),
5662
),
5763
),
5864
backgroundColor: Colors.white,

lib/model/model_package.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ class PackageModel {
2828
String toJson() => json.encode(toMap());
2929

3030
factory PackageModel.fromMap(Map<String, dynamic> json) => PackageModel(
31-
name: json["name"] == null ? null : json["name"],
32-
description: json["description"] == null ? null : json["description"],
33-
publisher: json["publisher"] == null ? null : json["publisher"],
31+
name: json['name'] == null ? null : json['name'],
32+
description: json['description'] == null ? null : json['description'],
33+
publisher: json['publisher'] == null ? null : json['publisher'],
3434
);
3535

3636
Map<String, dynamic> toMap() => {
37-
"name": name == null ? null : name,
38-
"description": description == null ? null : description,
39-
"publisher": publisher == null ? null : publisher,
37+
'name': name == null ? null : name,
38+
'description': description == null ? null : description,
39+
'publisher': publisher == null ? null : publisher,
4040
};
4141

4242
@override

lib/packages_data.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,14 @@ List<PackageModel> favoritePackages = [
2525

2626
List<PackageModel> popularPackages = [
2727
PackageModel(
28-
name: 'cloud_firestore',
29-
description:
30-
'Flutter plugin for Cloud Firestore, a cloud-hosted, noSQL database with live synchronization and offline support on Android and iOS.',
31-
publisher: 'firebase.google.com'),
32-
PackageModel(
33-
name: 'auto_size_text',
28+
name: 'flushbar',
3429
description:
35-
'Flutter widget that automatically resizes text to fit perfectly within its bounds.',
30+
'A flexible widget for user notification. Customize your text, button, duration, animations and much more. For Android devs, it is made to replace Snackbars and Toasts.',
3631
publisher: ''),
3732
PackageModel(
38-
name: 'flushbar',
33+
name: 'sounds',
3934
description:
40-
'A flexible widget for user notification. Customize your text, button, duration, animations and much more. For Android devs, it is made to replace Snackbars and Toasts.',
35+
'Sounds provide a complete api and Widgets for audio playback and recording. Both iOS and Android are supported.',
4136
publisher: ''),
4237
PackageModel(
4338
name: 'shimmer',
@@ -49,6 +44,11 @@ List<PackageModel> popularPackages = [
4944
description:
5045
'Customizable animated page indicator with a set of built-in effects.',
5146
publisher: ''),
47+
PackageModel(
48+
name: 'auto_size_text',
49+
description:
50+
'Flutter widget that automatically resizes text to fit perfectly within its bounds.',
51+
publisher: ''),
5252
PackageModel(
5353
name: 'confetti',
5454
description:

lib/ui/blocks.dart

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ class Header extends StatelessWidget {
8484
return Container(
8585
width: double.infinity,
8686
decoration: BoxDecoration(
87-
image: DecorationImage(
88-
image: AssetImage('assets/images/bg_header.jpg'),
89-
fit: BoxFit.cover)),
87+
image: DecorationImage(
88+
image: AssetImage('assets/images/bg_header.jpg'),
89+
fit: BoxFit.cover),
90+
color: backgroundColor,
91+
),
9092
padding: EdgeInsets.symmetric(vertical: 110),
9193
child: Column(
9294
mainAxisSize: MainAxisSize.min,
@@ -126,7 +128,7 @@ class Header extends StatelessWidget {
126128
TextSpan(
127129
recognizer: TapGestureRecognizer()
128130
..onTap = () {
129-
openUrl("https://dart.dev");
131+
openUrl('https://dart.dev');
130132
},
131133
text: 'Dart',
132134
style: TextStyle(color: linkDarkBackgroundColor)),
@@ -135,7 +137,7 @@ class Header extends StatelessWidget {
135137
recognizer: TapGestureRecognizer()
136138
..onTap = () {
137139
openUrl(
138-
"https://gallery.codelessly.com/flutterwebsites/flutterwebsite");
140+
'https://gallery.codelessly.com/flutterwebsites/flutterwebsite');
139141
},
140142
text: 'Flutter',
141143
style: TextStyle(color: linkDarkBackgroundColor)),
@@ -174,6 +176,11 @@ class FlutterFavorites extends StatelessWidget {
174176
text: 'Packages that demonstrate the ',
175177
),
176178
TextSpan(
179+
recognizer: TapGestureRecognizer()
180+
..onTap = () {
181+
openUrl(
182+
'https://flutter.dev/docs/development/packages-and-plugins/favorites');
183+
},
177184
text: 'highest levels of quality',
178185
style: TextStyle(color: linkColor)),
179186
TextSpan(
@@ -198,7 +205,7 @@ class FlutterFavorites extends StatelessWidget {
198205
return PackageCard(package: favoritePackages[index]);
199206
},
200207
),
201-
if (ResponsiveWrapper.of(context).isSmallerThan("MOBILE_LARGE"))
208+
if (ResponsiveWrapper.of(context).isSmallerThan('MOBILE_LARGE'))
202209
...favoritePackages.map((e) => Padding(
203210
padding: EdgeInsets.symmetric(vertical: 8),
204211
child: PackageCard(package: e),
@@ -278,7 +285,7 @@ class MostPopular extends StatelessWidget {
278285
),
279286
),
280287
),
281-
if (ResponsiveWrapper.of(context).isSmallerThan("MOBILE_LARGE"))
288+
if (ResponsiveWrapper.of(context).isSmallerThan('MOBILE_LARGE'))
282289
...popularPackages.map((e) => Padding(
283290
padding: EdgeInsets.symmetric(vertical: 8),
284291
child: PackageCard(package: e),
@@ -355,7 +362,7 @@ class TopFlutter extends StatelessWidget {
355362
),
356363
),
357364
),
358-
if (ResponsiveWrapper.of(context).isSmallerThan("MOBILE_LARGE"))
365+
if (ResponsiveWrapper.of(context).isSmallerThan('MOBILE_LARGE'))
359366
...topFlutterPackages.map((e) => Padding(
360367
padding: EdgeInsets.symmetric(vertical: 8),
361368
child: PackageCard(package: e),
@@ -456,7 +463,7 @@ class TopDart extends StatelessWidget {
456463
),
457464
),
458465
),
459-
if (ResponsiveWrapper.of(context).isSmallerThan("MOBILE_LARGE"))
466+
if (ResponsiveWrapper.of(context).isSmallerThan('MOBILE_LARGE'))
460467
...topDartPackages.map((e) => Padding(
461468
padding: EdgeInsets.symmetric(vertical: 8),
462469
child: PackageCard(package: e),
@@ -516,7 +523,7 @@ class PackageCard extends StatelessWidget {
516523
maxLines: 3,
517524
overflow: TextOverflow.clip),
518525
Padding(padding: EdgeInsets.only(bottom: 16)),
519-
if (ResponsiveWrapper.of(context).isLargerThan("MOBILE_LARGE"))
526+
if (ResponsiveWrapper.of(context).isLargerThan('MOBILE_LARGE'))
520527
Spacer(),
521528
if (package.publisher.isNotEmpty)
522529
Row(

0 commit comments

Comments
 (0)