ContextUtils extension

Extensions on BuildContext

on

Properties

colorScheme ColorScheme

Available on BuildContext, provided by the ContextUtils extension

Retrieves the color scheme used in the current theme of the given context using Theme.of(context).colorScheme.
no setter
devicePixelRatio double

Available on BuildContext, provided by the ContextUtils extension

Retrieves the device pixel ratio of the current media query in the current context, similar to MediaQuery.of(this).devicePixelRatio.
no setter
height double

Available on BuildContext, provided by the ContextUtils extension

Retrieves the height of the media query size in the current context, equivalent to MediaQuery.of(context).size.height. Note: This value updates when the screen is resized, such as in a browser or desktop window. Example: double height = context.height;
no setter
iconTheme IconThemeData?

Available on BuildContext, provided by the ContextUtils extension

Retrieves the current icon theme data used in the theme of the given context using Theme.of(context).iconTheme.
no setter
isAndroid bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the application is running on the Android platform.
no setter
isDarkMode bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the dark mode theme is enabled in the current context.
no setter
isDesktop bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the device is a desktop.
no setter
isFuchsia bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the application is running on the Fuchsia platform.
no setter
isIOS bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the application is running on the iOS platform.
no setter
isLandscape bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the device is in landscape mode based on the orientation.
no setter
isLargeDesktop bool

Available on BuildContext, provided by the ContextUtils extension

Returns true if the width is greater than 1280 pixels.
no setter
isLargeTablet bool

Available on BuildContext, provided by the ContextUtils extension

Returns true if the width is greater than 720 and less than or equal to 1080 pixels.
no setter
isLinux bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the application is running on the Linux platform.
no setter
isMacOS bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the application is running on the macOS platform.
no setter
isPhone bool

Available on BuildContext, provided by the ContextUtils extension

Returns true if the width is less than or equal to 480 pixels.
no setter
isPortrait bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the device is in portrait mode based on the orientation.
no setter
isSmallDesktop bool

Available on BuildContext, provided by the ContextUtils extension

Returns true if the width is greater than 1080 and less than or equal to 1280 pixels.
no setter
isSmallTablet bool

Available on BuildContext, provided by the ContextUtils extension

Returns true if the width is greater than 480 and less than or equal to 720 pixels.
no setter
isTablet bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the device is a tablet.
no setter
isWatch bool

Available on BuildContext, provided by the ContextUtils extension

Determines the device type based on screen width. Assumes width as the shortest side, consider using actual screen dimensions for better accuracy. Returns true if the width is less than or equal to 180 pixels.
no setter
isWeb bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the application is running on the web platform.
no setter
isWindows bool

Available on BuildContext, provided by the ContextUtils extension

Checks if the application is running on the Windows platform.
no setter
mediaQuery MediaQueryData

Available on BuildContext, provided by the ContextUtils extension

Retrieves the media query data in the current context, similar to MediaQuery.of(context).
no setter
mediaQuerySize Size

Available on BuildContext, provided by the ContextUtils extension

Retrieves the size of the media query in the current context, equivalent to MediaQuery.sizeOf(context). Example: final size = context.mediaQuerySize;
no setter
orientation Orientation

Available on BuildContext, provided by the ContextUtils extension

Retrieves the orientation of the current media query in the current context, similar to MediaQuery.of(context).orientation.
no setter
padding EdgeInsets

Available on BuildContext, provided by the ContextUtils extension

Retrieves the padding of the current media query in the current context, similar to MediaQuery.of(context).padding.
no setter
shortestSide double

Available on BuildContext, provided by the ContextUtils extension

Retrieves the text scale factor of the current media query in the current context, similar to MediaQuery.textScalerOf(this). Retrieves the shortest side of the screen in the current context.
no setter
textTheme TextTheme

Available on BuildContext, provided by the ContextUtils extension

Retrieves the text theme used in the current theme of the given context, similar to MediaQuery.of(context).padding.
no setter
theme ThemeData

Available on BuildContext, provided by the ContextUtils extension

Retrieves the current theme used in the given context using Theme.of(context).
no setter
viewInsets EdgeInsets

Available on BuildContext, provided by the ContextUtils extension

Retrieves the view insets of the current media query in the current context, similar to MediaQuery.of(context).viewInsets.
no setter
viewPadding EdgeInsets

Available on BuildContext, provided by the ContextUtils extension

Retrieves the view padding of the current media query in the current context, similar to MediaQuery.of(context).viewPadding.
no setter
width double

Available on BuildContext, provided by the ContextUtils extension

Retrieves the width of the media query size in the current context, equivalent to MediaQuery.of(context).size.width. Note: This value updates when the screen is resized, such as in a browser or desktop window. Example: double width = context.width;
no setter

Methods

hideLoader() → void

Available on BuildContext, provided by the ContextUtils extension

Hides the loader dialog if it is currently displayed.
popAndPushNamedRoute<T extends Object?, TO extends Object?>(String routeName, {TO? result, Object? args}) → void

Available on BuildContext, provided by the ContextUtils extension

Pops the current route off the navigator stack and pushes a named route onto the stack.
popRoute<T extends Object?>([T? result]) → void

Available on BuildContext, provided by the ContextUtils extension

Pops the current route off the navigator stack.
popRouteUntil(RoutePredicate predicate) → void

Available on BuildContext, provided by the ContextUtils extension

Pops routes from the navigator stack until the predicate returns true.
pushNamedRoute<T extends Object?>(String routeName, {Object? args}) Future<T?>

Available on BuildContext, provided by the ContextUtils extension

Pushes a named route onto the navigator stack.
pushNamedRouteAndRemoveUntil<T extends Object?>(String newRouteName, RoutePredicate predicate, {Object? args}) Future<T?>

Available on BuildContext, provided by the ContextUtils extension

Pushes a named route onto the navigator stack and removes all previous routes until the predicate returns true.
pushReplacementNamedRoute<T extends Object?, TO extends Object?>(String routeName, {TO? result, Object? args}) → void

Available on BuildContext, provided by the ContextUtils extension

Replaces the current route with a named route.
pushReplacementRoute<T extends Object?, TO extends Object?>(Widget route, {RouteSettings? settings, bool maintainState = true, bool fullscreenDialog = false, bool allowSnapshotting = true, TO? result}) → void

Available on BuildContext, provided by the ContextUtils extension

Replaces the current route with a new route widget.
pushRoute<T extends Object?>(Widget route, {RouteSettings? settings, bool maintainState = true, bool fullscreenDialog = false, bool allowSnapshotting = true}) Future<T?>

Available on BuildContext, provided by the ContextUtils extension

Pushes a new route onto the navigator stack using the provided route widget.
pushRouteAndRemoveUntil<T extends Object?>(Widget route, RoutePredicate predicate, {RouteSettings? settings, bool maintainState = true, bool fullscreenDialog = false, bool allowSnapshotting = true}) Future<T?>

Available on BuildContext, provided by the ContextUtils extension

Pushes a new route onto the navigator stack and removes all previous routes until the predicate returns true.
showLoader<T>({bool enableTimeOut = false, int timeOut = 5000, bool canPop = false, Widget? child}) Future<void>

Available on BuildContext, provided by the ContextUtils extension

Shows a loader dialog with optional timeout and back button handling.
showSnackBar({String? message, Icon? icon, Color? color, Color? textColor, double height = 60, SnackBar? snackBar, Color? borderColor, bool? showCloseIcon, int duration = 2000, double elevation = 0, Color? closeIconColor, EdgeInsetsGeometry? margin, EdgeInsetsGeometry? padding, SnackBarBehavior behavior = SnackBarBehavior.fixed}) → void

Available on BuildContext, provided by the ContextUtils extension

Displays a bottom sheet with the specified child widget.
showTextBar(String text, [SnackBarBehavior? behavior]) → void

Available on BuildContext, provided by the ContextUtils extension

Shows a snackbar with the specified text message.

Static Properties

dialogCtx BuildContext

Available on BuildContext, provided by the ContextUtils extension

getter/setter pair