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
fd5668bb
Unverified
Commit
fd5668bb
authored
Feb 04, 2021
by
Abhishek Ghaskata
Committed by
GitHub
Feb 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding hero example (#74415)
parent
7a8bbbd8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+64
-0
No files found.
packages/flutter/lib/src/widgets/heroes.dart
View file @
fd5668bb
...
...
@@ -101,6 +101,70 @@ enum HeroFlightDirection {
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=Be9UH1kXFDw}
///
/// {@tool dartpad --template=stateless_widget_material}
/// This sample shows a [Hero] used within a [ListTile].
///
/// Tapping on the Hero-wrapped rectangle triggers a hero
/// animation as a new [MaterialPageRoute] is pushed. Both the size
/// and location of the rectangle animates.
///
/// Both widgets use the same [Hero.tag].
///
/// The Hero widget uses the matching tags to identify and execute this
/// animation.
///
/// ```dart
/// Widget build(BuildContext context) {
/// return Column(
/// crossAxisAlignment: CrossAxisAlignment.start,
/// children: <Widget>[
/// SizedBox(
/// height: 20.0,
/// ),
/// ListTile(
/// leading: Hero(
/// tag: 'hero-rectangle',
/// child: _blueRectangle(Size(50,50)),
/// ),
/// onTap: () => _gotoDetailsPage(context),
/// title: Text('Tap on the icon to view hero animation transition.'),
/// ),
/// ],
/// );
/// }
///
/// Widget _blueRectangle(Size size) {
/// return Container(
/// width: size.width,
/// height: size.height,
/// color: Colors.blue,
/// );
/// }
///
/// void _gotoDetailsPage(BuildContext context) {
/// Navigator.of(context).push(MaterialPageRoute(
/// builder: (BuildContext context) => Scaffold(
/// appBar: AppBar(
/// title: Text('second Page'),
/// ),
/// body: Center(
/// child: Column(
/// mainAxisAlignment: MainAxisAlignment.center,
/// children: <Widget>[
/// Hero(
/// tag: 'hero-rectangle',
/// child: _blueRectangle(Size(200,200)),
/// ),
/// ],
/// ),
/// ),
/// ),
/// ));
/// }
///
/// ```
/// {@end-tool}
///
/// ## Discussion
///
/// Heroes and the [Navigator]'s [Overlay] [Stack] must be axis-aligned for
...
...
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