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
2f60932d
Commit
2f60932d
authored
Apr 12, 2016
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds nice photos and hero animations to the Grid gallery demo (#3258)
parent
0f70464e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
13 deletions
+101
-13
flutter.yaml
examples/material_gallery/flutter.yaml
+12
-0
grid_list_demo.dart
examples/material_gallery/lib/demo/grid_list_demo.dart
+88
-12
pubspec.yaml
examples/material_gallery/pubspec.yaml
+1
-1
No files found.
examples/material_gallery/flutter.yaml
View file @
2f60932d
...
...
@@ -25,3 +25,15 @@ assets:
-
packages/flutter_gallery_assets/jumpingjack.png
-
packages/flutter_gallery_assets/grain.png
-
packages/flutter_gallery_assets/fancylines.png
-
packages/flutter_gallery_assets/landscape_0.jpg
-
packages/flutter_gallery_assets/landscape_1.jpg
-
packages/flutter_gallery_assets/landscape_2.jpg
-
packages/flutter_gallery_assets/landscape_3.jpg
-
packages/flutter_gallery_assets/landscape_4.jpg
-
packages/flutter_gallery_assets/landscape_5.jpg
-
packages/flutter_gallery_assets/landscape_6.jpg
-
packages/flutter_gallery_assets/landscape_7.jpg
-
packages/flutter_gallery_assets/landscape_8.jpg
-
packages/flutter_gallery_assets/landscape_9.jpg
-
packages/flutter_gallery_assets/landscape_10.jpg
-
packages/flutter_gallery_assets/landscape_11.jpg
examples/material_gallery/lib/demo/grid_list_demo.dart
View file @
2f60932d
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:collection'
;
import
'dart:math'
as
math
;
import
'package:flutter/material.dart'
;
...
...
@@ -14,19 +15,80 @@ enum GridDemoTileStyle {
}
class
Photo
{
const
Photo
({
this
.
assetName
});
const
Photo
({
this
.
assetName
,
this
.
title
,
this
.
caption
});
final
String
assetName
;
String
get
title
=>
'Safari'
;
String
get
caption
=>
'March 2015'
;
final
String
title
;
final
String
caption
;
bool
get
isValid
=>
assetName
!=
null
;
}
final
List
<
Photo
>
photos
=
new
List
<
Photo
>.
generate
(
16
,
(
int
index
)
{
return
const
Photo
(
assetName:
'packages/flutter_gallery_assets/kangaroo_valley_safari.png'
);
});
final
List
<
Photo
>
photos
=
<
Photo
>[
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_0.jpg'
,
title:
'Philippines'
,
caption:
'Batad rice terraces'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_1.jpg'
,
title:
'Italy'
,
caption:
'Ceresole Reale'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_2.jpg'
,
title:
'Somewhere'
,
caption:
'Beautiful mountains'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_3.jpg'
,
title:
'A place'
,
caption:
'Beautiful hills'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_4.jpg'
,
title:
'New Zealand'
,
caption:
'View from the van'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_5.jpg'
,
title:
'Autumn'
,
caption:
'The golden season'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_6.jpg'
,
title:
'Germany'
,
caption:
'Englischer Garten'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_7.jpg'
,
title:
'A country'
,
caption:
'Grass fields'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_8.jpg'
,
title:
'Mountain country'
,
caption:
'River forest'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_9.jpg'
,
title:
'Alpine place'
,
caption:
'Green hills'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_10.jpg'
,
title:
'Desert land'
,
caption:
'Blue skies'
),
const
Photo
(
assetName:
'packages/flutter_gallery_assets/landscape_11.jpg'
,
title:
'Narnia'
,
caption:
'Rocks and rivers'
),
];
const
String
photoHeroTag
=
'Photo'
;
class
GridDemoPhotoItem
extends
StatelessWidget
{
GridDemoPhotoItem
({
Key
key
,
this
.
photo
,
this
.
tileStyle
})
:
super
(
key:
key
)
{
...
...
@@ -38,16 +100,26 @@ class GridDemoPhotoItem extends StatelessWidget {
final
GridDemoTileStyle
tileStyle
;
void
showPhoto
(
BuildContext
context
)
{
Key
photoKey
=
new
Key
(
photo
.
assetName
);
Set
<
Key
>
mostValuableKeys
=
new
HashSet
<
Key
>();
mostValuableKeys
.
add
(
photoKey
);
Navigator
.
push
(
context
,
new
MaterialPageRoute
<
Null
>(
settings:
new
RouteSettings
(
mostValuableKeys:
mostValuableKeys
),
builder:
(
BuildContext
context
)
{
return
new
Scaffold
(
appBar:
new
AppBar
(
title:
new
Text
(
photo
.
title
)
),
body:
new
Material
(
child:
new
AssetImage
(
name:
photo
.
assetName
,
fit:
ImageFit
.
cover
child:
new
Hero
(
tag:
photoHeroTag
,
child:
new
AssetImage
(
name:
photo
.
assetName
,
fit:
ImageFit
.
cover
)
)
)
);
...
...
@@ -59,9 +131,13 @@ class GridDemoPhotoItem extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
final
Widget
image
=
new
GestureDetector
(
onTap:
()
{
showPhoto
(
context
);
},
child:
new
AssetImage
(
name:
photo
.
assetName
,
fit:
ImageFit
.
cover
child:
new
Hero
(
key:
new
Key
(
photo
.
assetName
),
tag:
photoHeroTag
,
child:
new
AssetImage
(
name:
photo
.
assetName
,
fit:
ImageFit
.
cover
)
)
);
...
...
examples/material_gallery/pubspec.yaml
View file @
2f60932d
...
...
@@ -10,4 +10,4 @@ dependencies:
path
:
../../packages/flutter_sprites
flutter_markdown
:
path
:
../../packages/flutter_markdown
flutter_gallery_assets
:
'
0.0.1
3
'
flutter_gallery_assets
:
'
0.0.1
5
'
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