maybeOf static method
Returns the height of the bottom navigation bar if it exists, otherwise returns null.
It supports BottomAppBar, NavigationBar, and BottomNavigationBar.
Example:
final bottomBarHeight = BottomBarHeight.maybeOf(context);
Implementation
static double? maybeOf(BuildContext context) =>
switch (Scaffold.maybeOf(context)?.widget.bottomNavigationBar) {
BottomAppBar _ => Theme.of(context).bottomAppBarTheme.height ?? 80,
NavigationBar _ => Theme.of(context).navigationBarTheme.height ?? 80,
BottomNavigationBar _ => kBottomNavigationBarHeight, // 58 actually
null => null,
_ => _fallbackHeight(context),
};