-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
customer: posse (eap)d: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
It appears that AppBar always requires a Scaffold. If you try to add an AppBar to a Widget that doesn't have a Scaffold you will get the following error:
Scaffold.of() called with a context that does not contain a Scaffold.
No Scaffold ancestor could be found starting from the context that was passed to
Scaffold.of(). This usually happens when the context provided is from the same
StatefulWidget as that whose build function actually creates the Scaffold widget
being sought.
The documentation implies that it should be possible to use an AppBar outside of a Scaffold:
/// App bars are typically used in the [Scaffold.appBar] property, which places
/// the app bar as a fixed-height widget at the top of the screen.
It looks like there are a lot of cases where there are direct references to Scaffold.of(...) without checks.
Metadata
Metadata
Assignees
Labels
customer: posse (eap)d: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.