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
d2e3493a
Commit
d2e3493a
authored
Jun 13, 2016
by
Adam Barth
Committed by
GitHub
Jun 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an example to MediaQuery docs. (#4532)
Fixes #4511
parent
053df166
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
media_query.dart
packages/flutter/lib/src/widgets/media_query.dart
+21
-2
No files found.
packages/flutter/lib/src/widgets/media_query.dart
View file @
d2e3493a
...
...
@@ -18,7 +18,14 @@ enum Orientation {
landscape
}
/// The result of a media query.
/// Information about a piece of media (e.g., a window).
///
/// For example, the [MediaQueryData.size] property contains the width and
/// height of the current window.
///
/// To obtain the current [MediaQueryData] for a given [BuildContext], use the
/// [MediaQuery.of] function. For example, to obtain the size of the current
/// window, use `MediaQuery.of(context).size`.
class
MediaQueryData
{
/// Creates data for a media query with explicit values.
///
...
...
@@ -75,6 +82,15 @@ class MediaQueryData {
}
/// Establishes a subtree in which media queries resolve to the given data.
///
/// For example, to learn the size of the current media (e.g., the window
/// containing your app), you can read the [MediaQueryData.size] property from
/// the [MediaQueryData] returned by [MediaQuery.of]:
/// `MediaQuery.of(context).size`.
///
/// Querying the current media using [MediaQuery.of] will cause your widget to
/// rebuild automatically whenever the [MediaQueryData] changes (e.g., if the
/// user rotates their device).
class
MediaQuery
extends
InheritedWidget
{
/// Creates a widget that provides [MediaQueryData] to its descendants.
///
...
...
@@ -88,7 +104,10 @@ class MediaQuery extends InheritedWidget {
assert
(
data
!=
null
);
}
/// The result of media queries in this subtree.
/// Contains information about the current media.
///
/// For example, the [MediaQueryData.size] property contains the width and
/// height of the current window.
final
MediaQueryData
data
;
/// The data from the closest instance of this class that encloses the given context.
...
...
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