Skip to content

Commit

Permalink
Create exercise 12 (flutter#103)
Browse files Browse the repository at this point in the history
* Add exercise 12 solution and task

* make iconLocation required

* remove null check because iconLocation is required

* nits
  • Loading branch information
maryx authored Apr 11, 2018
1 parent 88e705f commit a5137bd
Show file tree
Hide file tree
Showing 182 changed files with 5,887 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
10 changes: 4 additions & 6 deletions course/04_navigation/solution_04_navigation/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
10 changes: 4 additions & 6 deletions course/04_navigation/task_04_navigation/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,11 @@ class Category extends StatelessWidget {
// See https://www.dartlang.org/guides/language/effective-dart/usage#do-use-collection-literals-when-possible
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
),
padding: EdgeInsets.all(16.0),
child: Icon(
iconLocation,
size: 60.0,
)),
Center(
child: Text(
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
10 changes: 4 additions & 6 deletions course/06_input/solution_06_input/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
10 changes: 4 additions & 6 deletions course/06_input/task_06_input/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ class Category extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: iconLocation != null
? Icon(
iconLocation,
size: 60.0,
)
: null,
child: Icon(
iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
7 changes: 4 additions & 3 deletions course/07_backdrop/solution_07_backdrop/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
}
assert(units != null),
assert(iconLocation != null);
}
10 changes: 4 additions & 6 deletions course/07_backdrop/solution_07_backdrop/lib/category_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ class CategoryTile extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: category.iconLocation != null
? Icon(
category.iconLocation,
size: 60.0,
)
: null,
child: Icon(
category.iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
7 changes: 4 additions & 3 deletions course/07_backdrop/task_07_backdrop/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
}
assert(units != null),
assert(iconLocation != null);
}
10 changes: 4 additions & 6 deletions course/07_backdrop/task_07_backdrop/lib/category_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,10 @@ class CategoryTile extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: category.iconLocation != null
? Icon(
category.iconLocation,
size: 60.0,
)
: null,
child: Icon(
category.iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
7 changes: 4 additions & 3 deletions course/08_responsive/solution_08_responsive/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
}
assert(units != null),
assert(iconLocation != null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ class CategoryTile extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: category.iconLocation != null
? Icon(
category.iconLocation,
size: 60.0,
)
: null,
child: Icon(
category.iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
7 changes: 4 additions & 3 deletions course/08_responsive/task_08_responsive/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
}
assert(units != null),
assert(iconLocation != null);
}
10 changes: 4 additions & 6 deletions course/08_responsive/task_08_responsive/lib/category_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ class CategoryTile extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: category.iconLocation != null
? Icon(
category.iconLocation,
size: 60.0,
)
: null,
child: Icon(
category.iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
5 changes: 3 additions & 2 deletions course/09_units/solution_09_units/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
assert(units != null),
assert(iconLocation != null);
}
10 changes: 4 additions & 6 deletions course/09_units/solution_09_units/lib/category_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ class CategoryTile extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: category.iconLocation != null
? Icon(
category.iconLocation,
size: 60.0,
)
: null,
child: Icon(
category.iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
5 changes: 3 additions & 2 deletions course/09_units/task_09_units/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
assert(units != null),
assert(iconLocation != null);
}
10 changes: 4 additions & 6 deletions course/09_units/task_09_units/lib/category_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ class CategoryTile extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: category.iconLocation != null
? Icon(
category.iconLocation,
size: 60.0,
)
: null,
child: Icon(
category.iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
assert(units != null),
assert(iconLocation != null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ class CategoryTile extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: category.iconLocation != null
? Image.asset(category.iconLocation)
: null,
child: Image.asset(category.iconLocation),
),
Center(
child: Text(
Expand Down
5 changes: 3 additions & 2 deletions course/10_icons_fonts/task_10_icons_fonts/lib/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ class Category {
@required this.name,
@required this.color,
@required this.units,
this.iconLocation,
@required this.iconLocation,
}) : assert(name != null),
assert(color != null),
assert(units != null);
assert(units != null),
assert(iconLocation != null);
}
10 changes: 4 additions & 6 deletions course/10_icons_fonts/task_10_icons_fonts/lib/category_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ class CategoryTile extends StatelessWidget {
Padding(
padding: EdgeInsets.all(16.0),
// TODO: Use an Image instead of an Icon
child: category.iconLocation != null
? Icon(
category.iconLocation,
size: 60.0,
)
: null,
child: Icon(
category.iconLocation,
size: 60.0,
),
),
Center(
child: Text(
Expand Down
Loading

0 comments on commit a5137bd

Please sign in to comment.