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
608b03c7
Unverified
Commit
608b03c7
authored
Mar 06, 2019
by
Dan Field
Committed by
GitHub
Mar 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs for ancestorWidgetOfExactType (#28675)
* doc update
parent
d4474128
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
about.dart
packages/flutter/lib/src/material/about.dart
+6
-0
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+8
-4
No files found.
packages/flutter/lib/src/material/about.dart
View file @
608b03c7
...
...
@@ -488,6 +488,12 @@ class _LicensePageState extends State<LicensePage> {
}
String
_defaultApplicationName
(
BuildContext
context
)
{
// This doesn't handle the case of the application's title dynamically
// changing. In theory, we should make Title expose the current application
// title using an InheritedWidget, and so forth. However, in practice, if
// someone really wants their application title to change dynamically, they
// can provide an explicit applicationName to the widgets defined in this
// file, instead of relying on the default.
final
Title
ancestorTitle
=
context
.
ancestorWidgetOfExactType
(
Title
);
return
ancestorTitle
?.
title
??
Platform
.
resolvedExecutable
.
split
(
Platform
.
pathSeparator
).
last
;
}
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
608b03c7
...
...
@@ -1942,11 +1942,15 @@ abstract class BuildContext {
/// Returns the nearest ancestor widget of the given type, which must be the
/// type of a concrete [Widget] subclass.
///
/// This should not be used from build methods, because the build context will
/// not be rebuilt if the value that would be returned by this method changes.
/// In general, [inheritFromWidgetOfExactType] is more useful. This method is
/// In general, [inheritFromWidgetOfExactType] is more useful, since inherited
/// widgets will trigger consumers to rebuild when they change. This method is
/// appropriate when used in interaction event handlers (e.g. gesture
/// callbacks), or for performing one-off tasks.
/// callbacks) or for performing one-off tasks such as asserting that you have
/// or don't have a widget of a specific type as an ancestor. The return value
/// of a Widget's build method should not depend on the value returned by this
/// method, because the build context will not rebuild if the return value of
/// this method changes. This could lead to a situation where data used in the
/// build method changes, but the widget is not rebuilt.
///
/// Calling this method is relatively expensive (O(N) in the depth of the
/// tree). Only call this method if the distance from this widget to the
...
...
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