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
03524a42
Unverified
Commit
03524a42
authored
Jun 04, 2020
by
Tomohiro Hattori
Committed by
GitHub
Jun 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sample code of GestureDetector with no children (#57838)
parent
b915808f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
gesture_detector.dart
packages/flutter/lib/src/widgets/gesture_detector.dart
+27
-2
No files found.
packages/flutter/lib/src/widgets/gesture_detector.dart
View file @
03524a42
...
...
@@ -51,6 +51,7 @@ export 'package:flutter/rendering.dart' show RenderSemanticsGestureHandler;
// bool _lights;
// void setState(VoidCallback fn) { }
// String _last;
// Color _color;
/// Factory for creating gesture recognizers.
///
...
...
@@ -130,8 +131,9 @@ class GestureRecognizerFactoryWithHandlers<T extends GestureRecognizer> extends
///
/// {@tool snippet}
///
/// This example turns the light bulb yellow when the "turn lights on" button is
/// tapped by setting the `_lights` field:
/// This example of a [Container] contains a black light bulb wrapped in a [GestureDetector].
/// It turns the light bulb yellow when the "turn lights on" button is tapped
/// by setting the `_lights` field. Above animation shows the code in use:
///
/// ```dart
/// Container(
...
...
@@ -166,6 +168,29 @@ class GestureRecognizerFactoryWithHandlers<T extends GestureRecognizer> extends
/// ```
/// {@end-tool}
///
/// {@tool snippet}
///
/// This example of a [Container] wraps a [GestureDetector] widget.
/// Since the [GestureDetector] does not have a child it takes on the size of
/// its parent making the entire area of the surrounding [Container] clickable.
/// When tapped the [Container] turns yellow by setting the `_color` field:
///
/// ```dart
/// Container(
/// color: _color,
/// height: 200.0,
/// width: 200.0,
/// child: GestureDetector(
/// onTap: () {
/// setState(() {
/// _color = Colors.yellow;
/// });
/// },
/// ),
/// )
/// ```
/// {@end-tool}
///
/// ## Debugging
///
/// To see how large the hit test box of a [GestureDetector] is for debugging
...
...
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