This reverts commit 437ff210aae48bbe976b1503867d01fab153bb57.
This commit is contained in:
parent
f4dee5c62e
commit
99f19d05c3
@ -20,8 +20,6 @@ import 'scaffold.dart' show Scaffold, ScaffoldMessenger;
|
||||
/// assert(debugCheckHasMaterial(context));
|
||||
/// ```
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasMaterial(BuildContext context) {
|
||||
assert(() {
|
||||
@ -64,11 +62,6 @@ bool debugCheckHasMaterial(BuildContext context) {
|
||||
/// assert(debugCheckHasMaterialLocalizations(context));
|
||||
/// ```
|
||||
///
|
||||
/// This function has the side-effect of establishing an inheritance
|
||||
/// relationship with the nearest [Localizations] widget (see
|
||||
/// [BuildContext.dependOnInheritedWidgetOfExactType]). This is ok if the caller
|
||||
/// always also calls [Localizations.of] or [Localizations.localeOf].
|
||||
///
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasMaterialLocalizations(BuildContext context) {
|
||||
assert(() {
|
||||
@ -109,8 +102,6 @@ bool debugCheckHasMaterialLocalizations(BuildContext context) {
|
||||
/// assert(debugCheckHasScaffold(context));
|
||||
/// ```
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasScaffold(BuildContext context) {
|
||||
assert(() {
|
||||
@ -142,8 +133,6 @@ bool debugCheckHasScaffold(BuildContext context) {
|
||||
/// assert(debugCheckHasScaffoldMessenger(context));
|
||||
/// ```
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasScaffoldMessenger(BuildContext context) {
|
||||
assert(() {
|
||||
|
@ -310,8 +310,6 @@ class Material extends StatefulWidget {
|
||||
/// ```dart
|
||||
/// MaterialInkController inkController = Material.of(context);
|
||||
/// ```
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
static MaterialInkController? of(BuildContext context) {
|
||||
return context.findAncestorRenderObjectOfType<_RenderInkFeatures>();
|
||||
}
|
||||
|
@ -1820,8 +1820,6 @@ class Scaffold extends StatefulWidget {
|
||||
/// If no instance of this class encloses the given context, will cause an
|
||||
/// assert in debug mode, and throw an exception in release mode.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// {@tool dartpad --template=freeform}
|
||||
/// Typical usage of the [Scaffold.of] function is to call it from within the
|
||||
/// `build` method of a child of a [Scaffold].
|
||||
@ -2001,8 +1999,6 @@ class Scaffold extends StatefulWidget {
|
||||
/// If no instance of this class encloses the given context, will return null.
|
||||
/// To throw an exception instead, use [of] instead of this function.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [of], a similar function to this one that throws if no instance
|
||||
@ -2070,8 +2066,6 @@ class Scaffold extends StatefulWidget {
|
||||
/// [Scaffold] so that the client widget gets rebuilt whenever the [hasDrawer]
|
||||
/// value changes.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [Scaffold.of], which provides access to the [ScaffoldState] object as a
|
||||
|
@ -392,8 +392,6 @@ class AnimatedList extends StatefulWidget {
|
||||
/// If no [AnimatedList] surrounds the context given, then this function will
|
||||
/// assert in debug mode and throw an exception in release mode.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [maybeOf], a similar function that will return null if no
|
||||
@ -431,8 +429,6 @@ class AnimatedList extends StatefulWidget {
|
||||
/// If no [AnimatedList] surrounds the context given, then this function will
|
||||
/// return null.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [of], a similar function that will throw if no [AnimatedList] ancestor
|
||||
@ -812,8 +808,6 @@ class SliverAnimatedList extends StatefulWidget {
|
||||
/// If no [SliverAnimatedList] surrounds the context given, then this function
|
||||
/// will assert in debug mode and throw an exception in release mode.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [maybeOf], a similar function that will return null if no
|
||||
@ -849,8 +843,6 @@ class SliverAnimatedList extends StatefulWidget {
|
||||
/// If no [SliverAnimatedList] surrounds the context given, then this function
|
||||
/// will return null.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [of], a similar function that will throw if no [SliverAnimatedList]
|
||||
|
@ -184,8 +184,6 @@ bool debugItemsHaveDuplicateKeys(Iterable<Widget> items) {
|
||||
/// assert(debugCheckHasTable(context));
|
||||
/// ```
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasTable(BuildContext context) {
|
||||
assert(() {
|
||||
@ -217,7 +215,7 @@ bool debugCheckHasTable(BuildContext context) {
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasMediaQuery(BuildContext context) {
|
||||
assert(() {
|
||||
if (context.widget is! MediaQuery && context.getElementForInheritedWidgetOfExactType<MediaQuery>() == null) {
|
||||
if (context.widget is! MediaQuery && context.findAncestorWidgetOfExactType<MediaQuery>() == null) {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary('No MediaQuery widget ancestor found.'),
|
||||
ErrorDescription('${context.widget.runtimeType} widgets require a MediaQuery widget ancestor.'),
|
||||
@ -269,7 +267,7 @@ bool debugCheckHasMediaQuery(BuildContext context) {
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasDirectionality(BuildContext context, { String? why, String? hint, String? alternative }) {
|
||||
assert(() {
|
||||
if (context.widget is! Directionality && context.getElementForInheritedWidgetOfExactType<Directionality>() == null) {
|
||||
if (context.widget is! Directionality && context.findAncestorWidgetOfExactType<Directionality>() == null) {
|
||||
why = why == null ? '' : ' $why';
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary('No Directionality widget found.'),
|
||||
@ -375,8 +373,6 @@ bool debugCheckHasWidgetsLocalizations(BuildContext context) {
|
||||
/// assert(debugCheckHasOverlay(context));
|
||||
/// ```
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// Does nothing if asserts are disabled. Always returns true.
|
||||
bool debugCheckHasOverlay(BuildContext context) {
|
||||
assert(() {
|
||||
|
@ -146,9 +146,6 @@ abstract class InheritedTheme extends InheritedWidget {
|
||||
/// this method is called again to re-capture the updated themes.
|
||||
///
|
||||
/// To wrap a [Widget] in the captured themes, call [CapturedThemes.wrap].
|
||||
///
|
||||
/// This method can be expensive if there are many widgets between `from` and
|
||||
/// `to` (it walks the element tree between those nodes).
|
||||
static CapturedThemes capture({ required BuildContext from, required BuildContext? to }) {
|
||||
assert(from != null);
|
||||
|
||||
|
@ -2712,8 +2712,6 @@ class Navigator extends StatefulWidget {
|
||||
///
|
||||
/// If there is no [Navigator] in the give `context`, this function will throw
|
||||
/// a [FlutterError] in debug mode, and an exception in release mode.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
static NavigatorState of(
|
||||
BuildContext context, {
|
||||
bool rootNavigator = false,
|
||||
@ -2762,8 +2760,6 @@ class Navigator extends StatefulWidget {
|
||||
/// subsequent instances of [Navigator].
|
||||
///
|
||||
/// Will return null if there is no ancestor [Navigator] in the `context`.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
static NavigatorState? maybeOf(
|
||||
BuildContext context, {
|
||||
bool rootNavigator = false,
|
||||
|
@ -284,8 +284,6 @@ class Overlay extends StatefulWidget {
|
||||
/// If `rootOverlay` is set to true, the state from the furthest instance of
|
||||
/// this class is given instead. Useful for installing overlay entries
|
||||
/// above all subsequent instances of [Overlay].
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
static OverlayState? of(
|
||||
BuildContext context, {
|
||||
bool rootOverlay = false,
|
||||
|
@ -267,8 +267,6 @@ class PageStorage extends StatelessWidget {
|
||||
/// ```dart
|
||||
/// PageStorageBucket bucket = PageStorage.of(context);
|
||||
/// ```
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
static PageStorageBucket? of(BuildContext context) {
|
||||
final PageStorage? widget = context.findAncestorWidgetOfExactType<PageStorage>();
|
||||
return widget?.bucket;
|
||||
|
@ -220,8 +220,6 @@ class ReorderableList extends StatefulWidget {
|
||||
/// If no [ReorderableList] surrounds the given context, then this function
|
||||
/// will assert in debug mode and throw an exception in release mode.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [maybeOf], a similar function that will return null if no
|
||||
@ -259,8 +257,6 @@ class ReorderableList extends StatefulWidget {
|
||||
/// If no [ReorderableList] surrounds the context given, then this function will
|
||||
/// return null.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [of], a similar function that will throw if no [ReorderableList] ancestor
|
||||
@ -412,8 +408,6 @@ class SliverReorderableList extends StatefulWidget {
|
||||
/// If no [SliverReorderableList] surrounds the context given, this function
|
||||
/// will assert in debug mode and throw an exception in release mode.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [maybeOf], a similar function that will return null if no
|
||||
@ -453,8 +447,6 @@ class SliverReorderableList extends StatefulWidget {
|
||||
/// If no [SliverReorderableList] surrounds the context given, this function
|
||||
/// will return null.
|
||||
///
|
||||
/// This method can be expensive (it walks the element tree).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [of], a similar function that will throw if no [SliverReorderableList]
|
||||
|
Loading…
x
Reference in New Issue
Block a user