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
5bacc9f8
Commit
5bacc9f8
authored
May 12, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GridTileBar uses ellipsis, etc (#3881)
parent
a590ee26
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
52 deletions
+52
-52
grid_list_demo.dart
examples/flutter_gallery/lib/demo/grid_list_demo.dart
+44
-50
icons_demo.dart
examples/flutter_gallery/lib/demo/icons_demo.dart
+1
-1
tooltip_demo.dart
examples/flutter_gallery/lib/demo/tooltip_demo.dart
+1
-1
grid_tile_bar.dart
packages/flutter/lib/src/material/grid_tile_bar.dart
+6
-0
No files found.
examples/flutter_gallery/lib/demo/grid_list_demo.dart
View file @
5bacc9f8
...
...
@@ -31,23 +31,23 @@ class Photo {
const
String
photoHeroTag
=
'Photo'
;
typedef
void
PhotoFavorite
Callback
(
Photo
photo
);
typedef
void
BannerTap
Callback
(
Photo
photo
);
class
GridDemoPhotoItem
extends
StatelessWidget
{
GridDemoPhotoItem
({
Key
key
,
this
.
photo
,
this
.
tileStyle
,
this
.
on
PressedFavorite
this
.
on
BannerTap
})
:
super
(
key:
key
)
{
assert
(
photo
!=
null
&&
photo
.
isValid
);
assert
(
tileStyle
!=
null
);
assert
(
on
PressedFavorite
!=
null
);
assert
(
on
BannerTap
!=
null
);
}
final
Photo
photo
;
final
GridDemoTileStyle
tileStyle
;
final
PhotoFavoriteCallback
onPressedFavorite
;
final
BannerTapCallback
onBannerTap
;
// User taps on the photo's header or footer.
void
showPhoto
(
BuildContext
context
)
{
Key
photoKey
=
new
Key
(
photo
.
assetName
);
...
...
@@ -99,28 +99,32 @@ class GridDemoPhotoItem extends StatelessWidget {
case
GridDemoTileStyle
.
oneLine
:
return
new
GridTile
(
header:
new
GridTileBar
(
backgroundColor:
Colors
.
black45
,
leading:
new
IconButton
(
icon:
icon
,
color:
Colors
.
white
,
onPressed:
()
{
onPressedFavorite
(
photo
);
}
),
title:
new
Text
(
photo
.
title
)
header:
new
GestureDetector
(
onTap:
()
{
onBannerTap
(
photo
);
},
child:
new
GridTileBar
(
title:
new
Text
(
photo
.
title
),
backgroundColor:
Colors
.
black45
,
leading:
new
Icon
(
icon:
icon
,
color:
Colors
.
white
)
)
),
child:
image
);
case
GridDemoTileStyle
.
twoLine
:
return
new
GridTile
(
footer:
new
GridTileBar
(
backgroundColor:
Colors
.
black45
,
title:
new
Text
(
photo
.
title
),
subtitle:
new
Text
(
photo
.
caption
),
trailing:
new
IconButton
(
icon:
icon
,
color:
Colors
.
white
,
onPressed:
()
{
onPressedFavorite
(
photo
);
}
footer:
new
GestureDetector
(
onTap:
()
{
onBannerTap
(
photo
);
},
child:
new
GridTileBar
(
backgroundColor:
Colors
.
black45
,
title:
new
Text
(
photo
.
title
),
subtitle:
new
Text
(
photo
.
caption
),
trailing:
new
Icon
(
icon:
icon
,
color:
Colors
.
white
)
)
),
child:
image
...
...
@@ -204,31 +208,9 @@ class GridListDemoState extends State<GridListDemo> {
),
];
void
showTileStyleMenu
(
BuildContext
context
)
{
final
List
<
PopupMenuItem
<
GridDemoTileStyle
>>
items
=
<
PopupMenuItem
<
GridDemoTileStyle
>>[
new
PopupMenuItem
<
GridDemoTileStyle
>(
value:
GridDemoTileStyle
.
imageOnly
,
child:
new
Text
(
'Image only'
)
),
new
PopupMenuItem
<
GridDemoTileStyle
>(
value:
GridDemoTileStyle
.
oneLine
,
child:
new
Text
(
'One line'
)
),
new
PopupMenuItem
<
GridDemoTileStyle
>(
value:
GridDemoTileStyle
.
twoLine
,
child:
new
Text
(
'Two line'
)
)
];
final
EdgeInsets
padding
=
MediaQuery
.
of
(
context
).
padding
;
final
RelativeRect
position
=
new
RelativeRect
.
fromLTRB
(
0.0
,
padding
.
top
+
16.0
,
padding
.
right
+
16.0
,
0.0
);
showMenu
(
context:
context
,
position:
position
,
items:
items
).
then
((
GridDemoTileStyle
value
)
{
setState
(()
{
tileStyle
=
value
;
});
void
changeTileStyle
(
GridDemoTileStyle
value
)
{
setState
(()
{
tileStyle
=
value
;
});
}
...
...
@@ -242,10 +224,22 @@ class GridListDemoState extends State<GridListDemo> {
appBar:
new
AppBar
(
title:
new
Text
(
'Grid list'
),
actions:
<
Widget
>[
new
IconButton
(
icon:
Icons
.
more_vert
,
onPressed:
()
{
showTileStyleMenu
(
context
);
},
tooltip:
'Show menu'
new
PopupMenuButton
<
GridDemoTileStyle
>(
onSelected:
changeTileStyle
,
itemBuilder:
(
BuildContext
context
)
=>
<
PopupMenuItem
<
GridDemoTileStyle
>>[
new
PopupMenuItem
<
GridDemoTileStyle
>(
value:
GridDemoTileStyle
.
imageOnly
,
child:
new
Text
(
'Image only'
)
),
new
PopupMenuItem
<
GridDemoTileStyle
>(
value:
GridDemoTileStyle
.
oneLine
,
child:
new
Text
(
'One line'
)
),
new
PopupMenuItem
<
GridDemoTileStyle
>(
value:
GridDemoTileStyle
.
twoLine
,
child:
new
Text
(
'Two line'
)
)
]
)
]
),
...
...
@@ -264,7 +258,7 @@ class GridListDemoState extends State<GridListDemo> {
return
new
GridDemoPhotoItem
(
photo:
photo
,
tileStyle:
tileStyle
,
on
PressedFavorite
:
(
Photo
photo
)
{
on
BannerTap
:
(
Photo
photo
)
{
setState
(()
{
photo
.
isFavorite
=
!
photo
.
isFavorite
;
});
...
...
examples/flutter_gallery/lib/demo/icons_demo.dart
View file @
5bacc9f8
...
...
@@ -50,7 +50,7 @@ class IconsDemoState extends State<IconsDemo> {
size:
size
,
icon:
icon
,
color:
iconColor
,
tooltip:
"
${enabled ? '
enabled' : 'd
isabled'}
icon button"
,
tooltip:
"
${enabled ? '
Enabled' : 'D
isabled'}
icon button"
,
onPressed:
enabled
?
handleIconButtonPress
:
null
);
}
...
...
examples/flutter_gallery/lib/demo/tooltip_demo.dart
View file @
5bacc9f8
...
...
@@ -44,7 +44,7 @@ class TooltipDemo extends StatelessWidget {
size:
48.0
,
icon:
Icons
.
call
,
color:
theme
.
primaryColor
,
tooltip:
'
p
lace a phone call'
,
tooltip:
'
P
lace a phone call'
,
onPressed:
()
{
Scaffold
.
of
(
context
).
showSnackBar
(
new
SnackBar
(
content:
new
Text
(
'That was an ordinary tap.'
)
...
...
packages/flutter/lib/src/material/grid_tile_bar.dart
View file @
5bacc9f8
...
...
@@ -85,10 +85,14 @@ class GridTileBar extends StatelessWidget {
children:
<
Widget
>[
new
DefaultTextStyle
(
style:
Typography
.
white
.
subhead
,
softWrap:
false
,
overflow:
TextOverflow
.
ellipsis
,
child:
title
),
new
DefaultTextStyle
(
style:
Typography
.
white
.
caption
,
softWrap:
false
,
overflow:
TextOverflow
.
ellipsis
,
child:
subtitle
)
]
...
...
@@ -100,6 +104,8 @@ class GridTileBar extends StatelessWidget {
new
Flexible
(
child:
new
DefaultTextStyle
(
style:
Typography
.
white
.
subhead
,
softWrap:
false
,
overflow:
TextOverflow
.
ellipsis
,
child:
title
??
subtitle
)
)
...
...
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