maybeOf static method
Returns the height of the app bar if it exists, otherwise returns null.
The returned height already includes the status bar, because that is what
a real AppBar reports — do not add MediaQuery.padding.top to it.
The Scaffold is resolved with ScaffoldFinder, so this also works when
context sits above the Scaffold it belongs to.
Example:
final appBarHeight = AppBarHeight.maybeOf(context);
Implementation
static double? maybeOf(BuildContext context) =>
ScaffoldFinder.maybeOf(context)?.appBarMaxHeight;