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
3d377305
Commit
3d377305
authored
Feb 26, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated per review feedback
parent
179d41e6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
46 deletions
+45
-46
list_demo.dart
examples/material_gallery/lib/demo/list_demo.dart
+12
-12
menu_demo.dart
examples/material_gallery/lib/demo/menu_demo.dart
+6
-6
stock_home.dart
examples/stocks/lib/stock_home.dart
+1
-1
list_item.dart
packages/flutter/lib/src/material/list_item.dart
+15
-15
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+11
-12
No files found.
examples/material_gallery/lib/demo/list_demo.dart
View file @
3d377305
...
...
@@ -21,7 +21,7 @@ class ListDemoState extends State<ListDemo> {
ScaffoldFeatureController
_bottomSheet
;
ListDemoItemSize
_itemSize
=
ListDemoItemSize
.
threeLine
;
bool
_
isD
ense
=
true
;
bool
_
d
ense
=
true
;
bool
_showAvatar
=
true
;
bool
_showIcon
=
false
;
bool
_reverseSort
=
false
;
...
...
@@ -47,7 +47,7 @@ class ListDemoState extends State<ListDemo> {
alignItems:
FlexAlignItems
.
stretch
,
children:
<
Widget
>[
new
ListItem
(
isD
ense:
true
,
d
ense:
true
,
primary:
new
Text
(
'One-line'
),
right:
new
Radio
<
ListDemoItemSize
>(
value:
ListDemoItemSize
.
oneLine
,
...
...
@@ -56,7 +56,7 @@ class ListDemoState extends State<ListDemo> {
)
),
new
ListItem
(
isD
ense:
true
,
d
ense:
true
,
primary:
new
Text
(
'Two-line'
),
right:
new
Radio
<
ListDemoItemSize
>(
value:
ListDemoItemSize
.
twoLine
,
...
...
@@ -65,7 +65,7 @@ class ListDemoState extends State<ListDemo> {
)
),
new
ListItem
(
isD
ense:
true
,
d
ense:
true
,
primary:
new
Text
(
'Three-line'
),
right:
new
Radio
<
ListDemoItemSize
>(
value:
ListDemoItemSize
.
threeLine
,
...
...
@@ -74,7 +74,7 @@ class ListDemoState extends State<ListDemo> {
)
),
new
ListItem
(
isD
ense:
true
,
d
ense:
true
,
primary:
new
Text
(
'Show Avatar'
),
right:
new
Checkbox
(
value:
_showAvatar
,
...
...
@@ -87,7 +87,7 @@ class ListDemoState extends State<ListDemo> {
)
),
new
ListItem
(
isD
ense:
true
,
d
ense:
true
,
primary:
new
Text
(
'Show Icon'
),
right:
new
Checkbox
(
value:
_showIcon
,
...
...
@@ -100,13 +100,13 @@ class ListDemoState extends State<ListDemo> {
)
),
new
ListItem
(
isD
ense:
true
,
d
ense:
true
,
primary:
new
Text
(
'Dense Layout'
),
right:
new
Checkbox
(
value:
_
isD
ense
,
value:
_
d
ense
,
onChanged:
(
bool
value
)
{
setState
(()
{
_
isD
ense
=
value
;
_
d
ense
=
value
;
});
_bottomSheet
?.
setState
(()
{
});
}
...
...
@@ -131,7 +131,7 @@ class ListDemoState extends State<ListDemo> {
}
return
new
ListItem
(
isThreeLine:
_itemSize
==
ListDemoItemSize
.
threeLine
,
isDense:
_isD
ense
,
dense:
_d
ense
,
left:
_showAvatar
?
new
CircleAvatar
(
child:
new
Text
(
item
))
:
null
,
primary:
new
Text
(
'This item represents
$item
'
),
secondary:
secondary
,
...
...
@@ -140,7 +140,7 @@ class ListDemoState extends State<ListDemo> {
}
Widget
build
(
BuildContext
context
)
{
final
String
layoutText
=
_
isD
ense
?
"
\
u2013 Dense"
:
""
;
final
String
layoutText
=
_
d
ense
?
"
\
u2013 Dense"
:
""
;
String
itemSizeText
;
switch
(
_itemSize
)
{
case
ListDemoItemSize
.
oneLine
:
...
...
@@ -176,7 +176,7 @@ class ListDemoState extends State<ListDemo> {
]
),
body:
new
Block
(
padding:
new
EdgeDims
.
all
(
_
isD
ense
?
4.0
:
8.0
),
padding:
new
EdgeDims
.
all
(
_
d
ense
?
4.0
:
8.0
),
children:
items
.
map
((
String
item
)
=>
buildListItem
(
context
,
item
)).
toList
()
)
);
...
...
examples/material_gallery/lib/demo/menu_demo.dart
View file @
3d377305
...
...
@@ -94,7 +94,7 @@ class MenuDemoState extends State<MenuDemo> {
child:
new
Text
(
'Context menu item one'
)
),
new
PopupMenuItem
(
isDisabled:
tru
e
,
enabled:
fals
e
,
child:
new
Text
(
'A disabled menu item'
)
),
new
PopupMenuItem
(
...
...
@@ -178,22 +178,22 @@ class MenuDemoState extends State<MenuDemo> {
items:
<
PopupMenuItem
>[
new
CheckedPopupMenuItem
(
value:
_checkedValue1
,
isC
hecked:
isChecked
(
_checkedValue1
),
c
hecked:
isChecked
(
_checkedValue1
),
child:
new
Text
(
_checkedValue1
)
),
new
CheckedPopupMenuItem
(
isDisabled:
tru
e
,
isC
hecked:
isChecked
(
_checkedValue2
),
enabled:
fals
e
,
c
hecked:
isChecked
(
_checkedValue2
),
child:
new
Text
(
_checkedValue2
)
),
new
CheckedPopupMenuItem
(
value:
_checkedValue3
,
isC
hecked:
isChecked
(
_checkedValue3
),
c
hecked:
isChecked
(
_checkedValue3
),
child:
new
Text
(
_checkedValue3
)
),
new
CheckedPopupMenuItem
(
value:
_checkedValue4
,
isC
hecked:
isChecked
(
_checkedValue4
),
c
hecked:
isChecked
(
_checkedValue4
),
child:
new
Text
(
_checkedValue4
)
)
]
...
...
examples/stocks/lib/stock_home.dart
View file @
3d377305
...
...
@@ -221,7 +221,7 @@ class StockHomeState extends State<StockHome> {
items:
<
PopupMenuItem
>[
new
CheckedPopupMenuItem
(
value:
_StockMenuItem
.
autorefresh
,
isC
hecked:
_autorefresh
,
c
hecked:
_autorefresh
,
child:
new
Text
(
'Autorefresh'
)
),
new
PopupMenuItem
(
...
...
packages/flutter/lib/src/material/list_item.dart
View file @
3d377305
...
...
@@ -11,7 +11,7 @@ import 'theme.dart';
/// Icons are defined with the [left] and [right] parameters. The first line of text
/// is not optional and is specified with [primary]. The value of [secondary] will
/// occupy the space allocated for an aditional line of text, or two lines if
/// isThreeLine: true is specified. If
isD
ense: true is specified then the overall
/// isThreeLine: true is specified. If
d
ense: true is specified then the overall
/// height of this list item and the size of the DefaultTextStyles that wrap
/// the [primary] and [secondary] widget are reduced.
class
ListItem
extends
StatelessComponent
{
...
...
@@ -22,8 +22,8 @@ class ListItem extends StatelessComponent {
this
.
secondary
,
this
.
right
,
this
.
isThreeLine
:
false
,
this
.
isD
ense
:
false
,
this
.
isDisabled
:
fals
e
,
this
.
d
ense
:
false
,
this
.
enabled
:
tru
e
,
this
.
onTap
,
this
.
onLongPress
})
:
super
(
key:
key
)
{
...
...
@@ -36,26 +36,26 @@ class ListItem extends StatelessComponent {
final
Widget
secondary
;
final
Widget
right
;
final
bool
isThreeLine
;
final
bool
isD
ense
;
final
bool
isDis
abled
;
final
bool
d
ense
;
final
bool
en
abled
;
final
GestureTapCallback
onTap
;
final
GestureLongPressCallback
onLongPress
;
TextStyle
primaryTextStyle
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
TextStyle
style
=
theme
.
text
.
subhead
;
if
(
isDis
abled
)
{
if
(
!
en
abled
)
{
final
Color
color
=
theme
.
disabledColor
;
return
isD
ense
?
style
.
copyWith
(
fontSize:
13.0
,
color:
color
)
:
style
.
copyWith
(
color:
color
);
return
d
ense
?
style
.
copyWith
(
fontSize:
13.0
,
color:
color
)
:
style
.
copyWith
(
color:
color
);
}
return
isD
ense
?
style
.
copyWith
(
fontSize:
13.0
)
:
style
;
return
d
ense
?
style
.
copyWith
(
fontSize:
13.0
)
:
style
;
}
TextStyle
secondaryTextStyle
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
Color
color
=
theme
.
text
.
caption
.
color
;
final
TextStyle
style
=
theme
.
text
.
body1
;
return
isD
ense
?
style
.
copyWith
(
color:
color
,
fontSize:
12.0
)
:
style
.
copyWith
(
color:
color
);
return
d
ense
?
style
.
copyWith
(
color:
color
,
fontSize:
12.0
)
:
style
.
copyWith
(
color:
color
);
}
Widget
build
(
BuildContext
context
)
{
...
...
@@ -63,15 +63,15 @@ class ListItem extends StatelessComponent {
final
bool
isOneLine
=
!
isThreeLine
&&
!
isTwoLine
;
double
itemHeight
;
if
(
isOneLine
)
itemHeight
=
isD
ense
?
48.0
:
56.0
;
itemHeight
=
d
ense
?
48.0
:
56.0
;
else
if
(
isTwoLine
)
itemHeight
=
isD
ense
?
60.0
:
72.0
;
itemHeight
=
d
ense
?
60.0
:
72.0
;
else
itemHeight
=
isD
ense
?
76.0
:
88.0
;
itemHeight
=
d
ense
?
76.0
:
88.0
;
double
iconMarginTop
=
0.0
;
if
(
isThreeLine
)
iconMarginTop
=
isD
ense
?
8.0
:
16.0
;
iconMarginTop
=
d
ense
?
8.0
:
16.0
;
// Overall, the list item is a Row() with these children.
final
List
<
Widget
>
children
=
<
Widget
>[];
...
...
@@ -120,8 +120,8 @@ class ListItem extends StatelessComponent {
}
return
new
InkWell
(
onTap:
isDisabled
?
null
:
onTap
,
onLongPress:
isDisabled
?
null
:
onLongPress
,
onTap:
enabled
?
onTap
:
null
,
onLongPress:
enabled
?
onLongPress
:
null
,
child:
new
Container
(
height:
itemHeight
,
padding:
const
EdgeDims
.
symmetric
(
horizontal:
16.0
),
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
3d377305
...
...
@@ -25,26 +25,25 @@ const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
const
double
_kMenuVerticalPadding
=
8.0
;
const
double
_kMenuWidthStep
=
56.0
;
const
double
_kMenuScreenPadding
=
8.0
;
const
double
_kDisabledIconOpacity
=
0.38
;
class
PopupMenuItem
<
T
>
extends
StatelessComponent
{
PopupMenuItem
({
Key
key
,
this
.
value
,
this
.
isDisabled
:
fals
e
,
this
.
enabled
:
tru
e
,
this
.
hasDivider
:
false
,
this
.
child
})
:
super
(
key:
key
);
final
T
value
;
final
bool
isDis
abled
;
final
bool
en
abled
;
final
bool
hasDivider
;
final
Widget
child
;
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
TextStyle
style
=
theme
.
text
.
subhead
;
if
(
isDis
abled
)
if
(
!
en
abled
)
style
=
style
.
copyWith
(
color:
theme
.
disabledColor
);
Widget
item
=
new
DefaultTextStyle
(
...
...
@@ -54,7 +53,7 @@ class PopupMenuItem<T> extends StatelessComponent {
child:
child
)
);
if
(
isDis
abled
)
{
if
(
!
en
abled
)
{
final
bool
isDark
=
theme
.
brightness
==
ThemeBrightness
.
dark
;
item
=
new
IconTheme
(
data:
new
IconThemeData
(
opacity:
isDark
?
0.5
:
0.38
),
...
...
@@ -79,16 +78,16 @@ class CheckedPopupMenuItem<T> extends PopupMenuItem<T> {
CheckedPopupMenuItem
({
Key
key
,
T
value
,
isC
hecked:
false
,
bool
isDisabled:
fals
e
,
c
hecked:
false
,
bool
enabled:
tru
e
,
Widget
child
})
:
super
(
key:
key
,
value:
value
,
isDisabled:
isDis
abled
,
enabled:
en
abled
,
child:
new
ListItem
(
isDisabled:
isDis
abled
,
left:
new
Icon
(
icon:
isC
hecked
?
'action/done'
:
null
),
enabled:
en
abled
,
left:
new
Icon
(
icon:
c
hecked
?
'action/done'
:
null
),
primary:
child
)
);
...
...
@@ -113,7 +112,7 @@ class _PopupMenu<T> extends StatelessComponent {
parent:
route
.
animation
,
curve:
new
Interval
(
start
,
end
)
);
final
bool
isDisabled
=
route
.
items
[
i
].
isDis
abled
;
final
bool
enabled
=
route
.
items
[
i
].
en
abled
;
Widget
item
=
route
.
items
[
i
];
if
(
route
.
initialValue
!=
null
&&
route
.
initialValue
==
route
.
items
[
i
].
value
)
{
item
=
new
Container
(
...
...
@@ -124,7 +123,7 @@ class _PopupMenu<T> extends StatelessComponent {
children
.
add
(
new
FadeTransition
(
opacity:
opacity
,
child:
new
InkWell
(
onTap:
isDisabled
?
null
:
()
{
Navigator
.
pop
(
context
,
route
.
items
[
i
].
value
);
}
,
onTap:
enabled
?
()
{
Navigator
.
pop
(
context
,
route
.
items
[
i
].
value
);
}
:
null
,
child:
item
)
));
...
...
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