ContextExtensions extension

Extensions for BuildContext to simplify common UI and navigation tasks.

on

Properties

colorScheme ColorScheme

Available on BuildContext, provided by the ContextExtensions extension

Access the current ColorScheme quickly
no setter
height double

Available on BuildContext, provided by the ContextExtensions extension

Access current screen height
no setter
isDarkMode bool

Available on BuildContext, provided by the ContextExtensions extension

Check if the current theme is dark mode
no setter
isDesktop bool

Available on BuildContext, provided by the ContextExtensions extension

Check if the screen width corresponds to a desktop
no setter
isLandscape bool

Available on BuildContext, provided by the ContextExtensions extension

Check if the screen is in landscape mode
no setter
isTablet bool

Available on BuildContext, provided by the ContextExtensions extension

Check if the screen width corresponds to a tablet
no setter
keyboardHeight double

Available on BuildContext, provided by the ContextExtensions extension

Access current keyboard height
no setter
mediaQueryPadding EdgeInsets

Available on BuildContext, provided by the ContextExtensions extension

Access current padding (e.g., safe area)
no setter
orientation Orientation

Available on BuildContext, provided by the ContextExtensions extension

Access current screen orientation
no setter
safeHeight double

Available on BuildContext, provided by the ContextExtensions extension

Access safe height (excluding top and bottom safe area paddings)
no setter
safeWidth double

Available on BuildContext, provided by the ContextExtensions extension

Access safe width (excluding left and right safe area paddings)
no setter
textTheme TextTheme

Available on BuildContext, provided by the ContextExtensions extension

Access the current TextTheme quickly
no setter
theme ThemeData

Available on BuildContext, provided by the ContextExtensions extension

Access the current ThemeData quickly
no setter
viewInsets EdgeInsets

Available on BuildContext, provided by the ContextExtensions extension

Access current viewInsets (e.g., keyboard height)
no setter
width double

Available on BuildContext, provided by the ContextExtensions extension

Access current screen width
no setter

Methods

hideKeyboard() → void

Available on BuildContext, provided by the ContextExtensions extension

Hides the soft keyboard
pop<T>([T? result]) → void

Available on BuildContext, provided by the ContextExtensions extension

Simplifies Navigator.pop
push<T>(Widget page) Future<T?>

Available on BuildContext, provided by the ContextExtensions extension

Simplifies Navigator.push
pushAndRemoveUntil<T>(Widget page) Future<T?>

Available on BuildContext, provided by the ContextExtensions extension

Simplifies Navigator.pushAndRemoveUntil
pushReplacement<T, TO>(Widget page) Future<T?>

Available on BuildContext, provided by the ContextExtensions extension

Simplifies Navigator.pushReplacement
showSnackBar(String message, {Duration duration = const Duration(seconds: 2)}) → void

Available on BuildContext, provided by the ContextExtensions extension

Show a snackbar quickly