ContextExtensions extension

Extensions for BuildContext operations and utilities.

on

Properties

colorScheme ColorScheme

Available on BuildContext, provided by the ContextExtensions extension

Gets the current color scheme.
no setter
devicePixelRatio double

Available on BuildContext, provided by the ContextExtensions extension

Gets the device pixel ratio.
no setter
isDarkMode bool

Available on BuildContext, provided by the ContextExtensions extension

Checks if the current screen is in dark mode.
no setter
isDesktop bool

Available on BuildContext, provided by the ContextExtensions extension

Returns true if the screen is a desktop (width >= 1200).
no setter
isLandscape bool

Available on BuildContext, provided by the ContextExtensions extension

Returns true if the screen is in landscape mode.
no setter
isLightMode bool

Available on BuildContext, provided by the ContextExtensions extension

Checks if the current screen is in light mode.
no setter
isMobile bool

Available on BuildContext, provided by the ContextExtensions extension

Returns true if the screen is a mobile device (width < 600).
no setter
isPortrait bool

Available on BuildContext, provided by the ContextExtensions extension

Returns true if the screen is in portrait mode.
no setter
isTablet bool

Available on BuildContext, provided by the ContextExtensions extension

Returns true if the screen is a tablet (600 <= width < 1200).
no setter
mediaQuery MediaQueryData

Available on BuildContext, provided by the ContextExtensions extension

Gets the current media query data.
no setter
orientation Orientation

Available on BuildContext, provided by the ContextExtensions extension

Gets the orientation (portrait or landscape).
no setter
screenHeight double

Available on BuildContext, provided by the ContextExtensions extension

Gets the screen height.
no setter
screenPadding EdgeInsets

Available on BuildContext, provided by the ContextExtensions extension

Gets the screen padding.
no setter
screenSize Size

Available on BuildContext, provided by the ContextExtensions extension

Gets the screen size.
no setter
screenWidth double

Available on BuildContext, provided by the ContextExtensions extension

Gets the screen width.
no setter
sizeOf Size

Available on BuildContext, provided by the ContextExtensions extension

Gets the screen size (alias for MediaQuery.sizeOf).
no setter
textScaleFactor double

Available on BuildContext, provided by the ContextExtensions extension

Gets the text scale factor.
no setter
textTheme TextTheme

Available on BuildContext, provided by the ContextExtensions extension

Gets the current text theme.
no setter
theme ThemeData

Available on BuildContext, provided by the ContextExtensions extension

Gets the current theme.
no setter
viewInsets EdgeInsets

Available on BuildContext, provided by the ContextExtensions extension

Gets the screen view insets (e.g., keyboard height).
no setter
viewPadding EdgeInsets

Available on BuildContext, provided by the ContextExtensions extension

Gets the screen view padding.
no setter

Methods

hideKeyboard() → void

Available on BuildContext, provided by the ContextExtensions extension

Hides the keyboard if it's currently visible.
isLargeScreen(double width) bool

Available on BuildContext, provided by the ContextExtensions extension

Returns true if the screen width is greater than or equal to the given value.
isSmallScreen(double width) bool

Available on BuildContext, provided by the ContextExtensions extension

Returns true if the screen width is less than the given value.
pop<T extends Object?>([T? result]) → void

Available on BuildContext, provided by the ContextExtensions extension

Pops the current route.
popUntil(String routeName) → void

Available on BuildContext, provided by the ContextExtensions extension

Pops until a route with the given name is found.
push<T extends Object?>(Widget route) Future<T?>

Available on BuildContext, provided by the ContextExtensions extension

Navigates to a new route.
pushReplacement<T extends Object?, TO extends Object?>(Widget route) Future<T?>

Available on BuildContext, provided by the ContextExtensions extension

Replaces the current route.
requestFocus(FocusNode node) → void

Available on BuildContext, provided by the ContextExtensions extension

Requests focus on the given focus node.
showCustomDialog<T>({required WidgetBuilder builder, bool barrierDismissible = true, Color? barrierColor, String? barrierLabel, bool useSafeArea = true, bool useRootNavigator = false, RouteSettings? routeSettings, Offset? anchorPoint}) Future<T?>

Available on BuildContext, provided by the ContextExtensions extension

Shows a custom dialog.
showSnackBar(String message, {Duration duration = const Duration(seconds: 3), SnackBarAction? action, Color? backgroundColor, Color? textColor}) → void

Available on BuildContext, provided by the ContextExtensions extension

Shows a snackbar with the given message.
toggleTheme() → void

Available on BuildContext, provided by the ContextExtensions extension

Toggles between light and dark theme.