Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
af790303
Commit
af790303
authored
Oct 28, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1848 from abarth/icon_size
Icon should use an enum rather than an int for size
parents
0f9c179e
eeea4ab7
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
30 additions
and
18 deletions
+30
-18
main.dart
examples/address_book/lib/main.dart
+2
-2
feed.dart
examples/fitness/lib/feed.dart
+1
-1
stock_home.dart
examples/stocks/lib/stock_home.dart
+1
-1
stock_menu.dart
examples/stocks/lib/stock_menu.dart
+1
-1
card_collection.dart
examples/widgets/card_collection.dart
+3
-3
drawer_item.dart
packages/flutter/lib/src/material/drawer_item.dart
+0
-1
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+1
-1
icon.dart
packages/flutter/lib/src/material/icon.dart
+20
-5
icon_button.dart
packages/flutter/lib/src/material/icon_button.dart
+0
-1
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-2
No files found.
examples/address_book/lib/main.dart
View file @
af790303
...
@@ -20,7 +20,7 @@ class Field extends StatelessComponent {
...
@@ -20,7 +20,7 @@ class Field extends StatelessComponent {
return
new
Row
(<
Widget
>[
return
new
Row
(<
Widget
>[
new
Padding
(
new
Padding
(
padding:
const
EdgeDims
.
symmetric
(
horizontal:
16.0
),
padding:
const
EdgeDims
.
symmetric
(
horizontal:
16.0
),
child:
new
Icon
(
type:
icon
,
size:
24
)
child:
new
Icon
(
type:
icon
)
),
),
new
Flexible
(
new
Flexible
(
child:
new
Input
(
child:
new
Input
(
...
@@ -43,7 +43,7 @@ class AddressBookHome extends StatelessComponent {
...
@@ -43,7 +43,7 @@ class AddressBookHome extends StatelessComponent {
Widget
buildFloatingActionButton
(
BuildContext
context
)
{
Widget
buildFloatingActionButton
(
BuildContext
context
)
{
return
new
FloatingActionButton
(
return
new
FloatingActionButton
(
child:
new
Icon
(
type:
'image/photo_camera'
,
size:
24
),
child:
new
Icon
(
type:
'image/photo_camera'
),
backgroundColor:
Theme
.
of
(
context
).
accentColor
backgroundColor:
Theme
.
of
(
context
).
accentColor
);
);
}
}
...
...
examples/fitness/lib/feed.dart
View file @
af790303
...
@@ -200,7 +200,7 @@ class FeedFragmentState extends State<FeedFragment> {
...
@@ -200,7 +200,7 @@ class FeedFragmentState extends State<FeedFragment> {
switch
(
_fitnessMode
)
{
switch
(
_fitnessMode
)
{
case
FitnessMode
.
feed
:
case
FitnessMode
.
feed
:
return
new
FloatingActionButton
(
return
new
FloatingActionButton
(
child:
new
Icon
(
type:
'content/add'
,
size:
24
),
child:
new
Icon
(
type:
'content/add'
),
onPressed:
_handleActionButtonPressed
onPressed:
_handleActionButtonPressed
);
);
case
FitnessMode
.
chart
:
case
FitnessMode
.
chart
:
...
...
examples/stocks/lib/stock_home.dart
View file @
af790303
...
@@ -254,7 +254,7 @@ class StockHomeState extends State<StockHome> {
...
@@ -254,7 +254,7 @@ class StockHomeState extends State<StockHome> {
Widget
buildFloatingActionButton
()
{
Widget
buildFloatingActionButton
()
{
return
new
FloatingActionButton
(
return
new
FloatingActionButton
(
child:
new
Icon
(
type:
'content/add'
,
size:
24
),
child:
new
Icon
(
type:
'content/add'
),
backgroundColor:
Colors
.
redAccent
[
200
],
backgroundColor:
Colors
.
redAccent
[
200
],
onPressed:
_handleStockPurchased
onPressed:
_handleStockPurchased
);
);
...
...
examples/stocks/lib/stock_menu.dart
View file @
af790303
...
@@ -63,7 +63,7 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
...
@@ -63,7 +63,7 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
child:
new
Row
(<
Widget
>[
child:
new
Row
(<
Widget
>[
new
Icon
(
new
Icon
(
type:
'device/dvr'
,
type:
'device/dvr'
,
size:
18
size:
IconSize
.
s
18
),
),
new
Container
(
new
Container
(
width:
8.0
width:
8.0
...
...
examples/widgets/card_collection.dart
View file @
af790303
...
@@ -289,7 +289,7 @@ class CardCollectionState extends State<CardCollection> {
...
@@ -289,7 +289,7 @@ class CardCollectionState extends State<CardCollection> {
child:
new
Container
(
child:
new
Container
(
height:
cardModel
.
height
,
height:
cardModel
.
height
,
padding:
const
EdgeDims
.
all
(
8.0
),
padding:
const
EdgeDims
.
all
(
8.0
),
child:
_editable
?
child:
_editable
?
new
Center
(
new
Center
(
child:
new
Input
(
child:
new
Input
(
key:
new
GlobalObjectKey
(
cardModel
),
key:
new
GlobalObjectKey
(
cardModel
),
...
@@ -329,11 +329,11 @@ class CardCollectionState extends State<CardCollection> {
...
@@ -329,11 +329,11 @@ class CardCollectionState extends State<CardCollection> {
backgroundMessage
=
"Unsupported dismissDirection"
;
backgroundMessage
=
"Unsupported dismissDirection"
;
}
}
Widget
leftArrowIcon
=
new
Icon
(
type:
'navigation/arrow_back'
,
size:
36
);
Widget
leftArrowIcon
=
new
Icon
(
type:
'navigation/arrow_back'
,
size:
IconSize
.
s
36
);
if
(
_dismissDirection
==
DismissDirection
.
right
)
if
(
_dismissDirection
==
DismissDirection
.
right
)
leftArrowIcon
=
new
Opacity
(
opacity:
0.1
,
child:
leftArrowIcon
);
leftArrowIcon
=
new
Opacity
(
opacity:
0.1
,
child:
leftArrowIcon
);
Widget
rightArrowIcon
=
new
Icon
(
type:
'navigation/arrow_forward'
,
size:
36
);
Widget
rightArrowIcon
=
new
Icon
(
type:
'navigation/arrow_forward'
,
size:
IconSize
.
s
36
);
if
(
_dismissDirection
==
DismissDirection
.
left
)
if
(
_dismissDirection
==
DismissDirection
.
left
)
rightArrowIcon
=
new
Opacity
(
opacity:
0.1
,
child:
rightArrowIcon
);
rightArrowIcon
=
new
Opacity
(
opacity:
0.1
,
child:
rightArrowIcon
);
...
...
packages/flutter/lib/src/material/drawer_item.dart
View file @
af790303
...
@@ -49,7 +49,6 @@ class DrawerItem extends StatelessComponent {
...
@@ -49,7 +49,6 @@ class DrawerItem extends StatelessComponent {
padding:
const
EdgeDims
.
symmetric
(
horizontal:
16.0
),
padding:
const
EdgeDims
.
symmetric
(
horizontal:
16.0
),
child:
new
Icon
(
child:
new
Icon
(
type:
icon
,
type:
icon
,
size:
24
,
colorFilter:
_getColorFilter
(
themeData
)
colorFilter:
_getColorFilter
(
themeData
)
)
)
)
)
...
...
packages/flutter/lib/src/material/dropdown.dart
View file @
af790303
...
@@ -244,7 +244,7 @@ class DropdownButton<T> extends StatelessComponent {
...
@@ -244,7 +244,7 @@ class DropdownButton<T> extends StatelessComponent {
alignment:
const
FractionalOffset
(
0.5
,
0.0
)
alignment:
const
FractionalOffset
(
0.5
,
0.0
)
),
),
new
Container
(
new
Container
(
child:
new
Icon
(
type:
'navigation/arrow_drop_down'
,
size:
36
),
child:
new
Icon
(
type:
'navigation/arrow_drop_down'
,
size:
IconSize
.
s
36
),
padding:
const
EdgeDims
.
only
(
top:
6.0
)
padding:
const
EdgeDims
.
only
(
top:
6.0
)
)
)
])
])
...
...
packages/flutter/lib/src/material/icon.dart
View file @
af790303
...
@@ -8,10 +8,24 @@ import 'theme.dart';
...
@@ -8,10 +8,24 @@ import 'theme.dart';
import
'icon_theme.dart'
;
import
'icon_theme.dart'
;
import
'icon_theme_data.dart'
;
import
'icon_theme_data.dart'
;
enum
IconSize
{
s18
,
s24
,
s36
,
s48
,
}
const
Map
<
IconSize
,
int
>
_kIconSize
=
const
<
IconSize
,
int
>{
IconSize
.
s18
:
18
,
IconSize
.
s24
:
24
,
IconSize
.
s36
:
36
,
IconSize
.
s48
:
48
,
};
class
Icon
extends
StatelessComponent
{
class
Icon
extends
StatelessComponent
{
Icon
({
Icon
({
Key
key
,
Key
key
,
this
.
size
,
this
.
size
:
IconSize
.
s24
,
this
.
type
:
''
,
this
.
type
:
''
,
this
.
color
,
this
.
color
,
this
.
colorFilter
this
.
colorFilter
...
@@ -20,7 +34,7 @@ class Icon extends StatelessComponent {
...
@@ -20,7 +34,7 @@ class Icon extends StatelessComponent {
assert
(
type
!=
null
);
assert
(
type
!=
null
);
}
}
final
int
size
;
final
IconSize
size
;
final
String
type
;
final
String
type
;
final
IconThemeColor
color
;
final
IconThemeColor
color
;
final
ColorFilter
colorFilter
;
final
ColorFilter
colorFilter
;
...
@@ -55,10 +69,11 @@ class Icon extends StatelessComponent {
...
@@ -55,10 +69,11 @@ class Icon extends StatelessComponent {
// Should we use the ios images on ios?
// Should we use the ios images on ios?
String
density
=
'drawable-xxhdpi'
;
String
density
=
'drawable-xxhdpi'
;
String
colorSuffix
=
_getColorSuffix
(
context
);
String
colorSuffix
=
_getColorSuffix
(
context
);
int
iconSize
=
_kIconSize
[
size
];
return
new
AssetImage
(
return
new
AssetImage
(
name:
'
$category
/
$density
/ic_
${subtype}
_
${colorSuffix}
_
${
s
ize}
dp.png'
,
name:
'
$category
/
$density
/ic_
${subtype}
_
${colorSuffix}
_
${
iconS
ize}
dp.png'
,
width:
s
ize
.
toDouble
(),
width:
iconS
ize
.
toDouble
(),
height:
s
ize
.
toDouble
(),
height:
iconS
ize
.
toDouble
(),
colorFilter:
colorFilter
colorFilter:
colorFilter
);
);
}
}
...
...
packages/flutter/lib/src/material/icon_button.dart
View file @
af790303
...
@@ -28,7 +28,6 @@ class IconButton extends StatelessComponent {
...
@@ -28,7 +28,6 @@ class IconButton extends StatelessComponent {
padding:
const
EdgeDims
.
all
(
8.0
),
padding:
const
EdgeDims
.
all
(
8.0
),
child:
new
Icon
(
child:
new
Icon
(
type:
icon
,
type:
icon
,
size:
24
,
color:
color
,
color:
color
,
colorFilter:
colorFilter
colorFilter:
colorFilter
)
)
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
af790303
...
@@ -27,7 +27,6 @@ const double _kTabIndicatorHeight = 2.0;
...
@@ -27,7 +27,6 @@ const double _kTabIndicatorHeight = 2.0;
const
double
_kMinTabWidth
=
72.0
;
const
double
_kMinTabWidth
=
72.0
;
const
double
_kMaxTabWidth
=
264.0
;
const
double
_kMaxTabWidth
=
264.0
;
const
EdgeDims
_kTabLabelPadding
=
const
EdgeDims
.
symmetric
(
horizontal:
12.0
);
const
EdgeDims
_kTabLabelPadding
=
const
EdgeDims
.
symmetric
(
horizontal:
12.0
);
const
int
_kTabIconSize
=
24
;
const
double
_kTabBarScrollDrag
=
0.025
;
const
double
_kTabBarScrollDrag
=
0.025
;
const
Duration
_kTabBarScroll
=
const
Duration
(
milliseconds:
200
);
const
Duration
_kTabBarScroll
=
const
Duration
(
milliseconds:
200
);
...
@@ -321,7 +320,7 @@ class Tab extends StatelessComponent {
...
@@ -321,7 +320,7 @@ class Tab extends StatelessComponent {
assert
(
label
.
icon
!=
null
);
assert
(
label
.
icon
!=
null
);
Color
iconColor
=
selected
?
selectedColor
:
color
;
Color
iconColor
=
selected
?
selectedColor
:
color
;
ColorFilter
filter
=
new
ColorFilter
.
mode
(
iconColor
,
TransferMode
.
srcATop
);
ColorFilter
filter
=
new
ColorFilter
.
mode
(
iconColor
,
TransferMode
.
srcATop
);
return
new
Icon
(
type:
label
.
icon
,
size:
_kTabIconSize
,
colorFilter:
filter
);
return
new
Icon
(
type:
label
.
icon
,
colorFilter:
filter
);
}
}
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment