BuildContextExension extension

on

Properties

accentColor Color

Available on BuildContext, provided by the BuildContextExension extension

Returns the accentColor of the current theme. This property retrieves the accent color from the theme, typically used for highlighting interactive or focusable elements. In many themes, this is the same as the secondary color.
no setter
canPop bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current route can be popped (i.e., the current route is not the root route or the only route in the navigator stack).
no setter
cardColor Color

Available on BuildContext, provided by the BuildContextExension extension

Returns the cardColor of the current theme. This property retrieves the color applied to cards in the app, typically used for elements that need to stand out, such as cards or containers with elevated content.
no setter
defaultTextStyle DefaultTextStyle

Available on BuildContext, provided by the BuildContextExension extension

Returns the DefaultTextStyle of the context. This property retrieves the default text style applied to the text in the widget tree.
no setter
dividerColor Color

Available on BuildContext, provided by the BuildContextExension extension

Returns the dividerColor of the current theme. This property retrieves the color used for dividers in the UI, typically applied to separating content or sections in lists, settings, or menus.
no setter
formState FormState?

Available on BuildContext, provided by the BuildContextExension extension

Returns the FormState of the context, if available. This property retrieves the state of a Form widget if present in the widget tree. It allows for interacting with form validation, saving, or resetting.
no setter
getArguments → dynamic

Available on BuildContext, provided by the BuildContextExension extension

Gets the arguments passed to the current named route. This property retrieves any arguments that were passed when navigating to the current route using Navigator.pushNamed.
no setter
height double

Available on BuildContext, provided by the BuildContextExension extension

Returns the screen height. This property provides the height of the current screen using the size property.
no setter
iconColor Color

Available on BuildContext, provided by the BuildContextExension extension

Returns the iconColor of the current theme. This property retrieves the color applied to icons in the current theme. It is useful for setting the color of icons in buttons, menus, or toolbars.
no setter
isAndroid bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current platform is Android.
no setter
isFuchsia bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current platform is Fuchsia.
no setter
isIOS bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current platform is iOS.
no setter
isLandscape bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current screen orientation is landscape.
no setter
isLinux bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current platform is Linux.
no setter
isMacOS bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current platform is macOS.
no setter
isPortrait bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current screen orientation is portrait.
no setter
isWeb bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current platform is Web.
no setter
isWindows bool

Available on BuildContext, provided by the BuildContextExension extension

Returns true if the current platform is Windows.
no setter
maxScreenSize double

Available on BuildContext, provided by the BuildContextExension extension

Returns the maximum screen size (either width or height). This property returns the larger dimension between the width and height of the screen.
no setter
minScreenSize double

Available on BuildContext, provided by the BuildContextExension extension

Returns the minimum screen size (either width or height). This property returns the smaller dimension between the width and height of the screen.
no setter

Available on BuildContext, provided by the BuildContextExension extension

Returns the height of the navigation bar. This property retrieves the height of the system's navigation bar (e.g., the bar with back/home buttons). If no MediaQuery context is available, it defaults to 0.0.
no setter
orientation Orientation

Available on BuildContext, provided by the BuildContextExension extension

Gets the current screen orientation. This property retrieves the current device orientation, either portrait or landscape.
no setter
overlayState OverlayState?

Available on BuildContext, provided by the BuildContextExension extension

Returns the OverlayState of the context, if available. This property retrieves the state of the Overlay widget, allowing access to overlays for things like showing floating widgets or positioning other types of overlays.
no setter
pixelRatio double

Available on BuildContext, provided by the BuildContextExension extension

Returns the screen's devicePixelRatio. This property retrieves the device's pixel density. A higher value means more pixels per logical pixel. If MediaQuery is unavailable, it defaults to a ratio of 1.0.
no setter
platform TargetPlatform

Available on BuildContext, provided by the BuildContextExension extension

Returns the current platform as a TargetPlatform.
no setter
platformBrightness Brightness

Available on BuildContext, provided by the BuildContextExension extension

Returns the current platform's brightness. This property returns the brightness of the platform (either light or dark) based on the system's settings.
no setter
primaryColor Color

Available on BuildContext, provided by the BuildContextExension extension

Returns the primaryColor of the current theme. This property retrieves the primary color defined in the theme, which is typically used for main elements such as buttons, app bars, and other prominent UI components.
no setter
scaffoldBackgroundColor Color

Available on BuildContext, provided by the BuildContextExension extension

Returns the scaffoldBackgroundColor of the current theme. This property retrieves the background color of the Scaffold, which is usually applied to the main body of the app's layout.
no setter
scaffoldState ScaffoldState?

Available on BuildContext, provided by the BuildContextExension extension

Returns the ScaffoldState of the context, if available. This property retrieves the state of a Scaffold widget, enabling access to methods like opening/closing drawers, showing snackbars, or navigating.
no setter
secondaryColor Color

Available on BuildContext, provided by the BuildContextExension extension

Returns the secondaryColor of the current theme. This property retrieves the secondary color defined in the theme, often used for elements that need to complement the primary color, like accents and secondary UI components.
no setter
size Size

Available on BuildContext, provided by the BuildContextExension extension

Returns the screen size. This method returns the size of the screen using MediaQuery, which includes the width and height. If the MediaQuery context is unavailable, it returns a default size of (0, 0).
no setter
statusBarHeight double

Available on BuildContext, provided by the BuildContextExension extension

Returns the height of the status bar. This property retrieves the height of the system's status bar (e.g., the area with time and network indicators). If no MediaQuery context is available, it defaults to 0.0.
no setter
textTheme TextTheme

Available on BuildContext, provided by the BuildContextExension extension

Returns the textTheme of the current theme. This property provides access to the text styles defined in the current theme's textTheme. It can be used to retrieve predefined text styles like headline1, bodyText1, etc.
no setter
theme ThemeData

Available on BuildContext, provided by the BuildContextExension extension

Returns the current ThemeData of the context. This property retrieves the ThemeData of the current context, which contains various theme-related properties like colors, typography, and other styles.
no setter
width double

Available on BuildContext, provided by the BuildContextExension extension

Returns the screen width. This property provides the width of the current screen using the size property.
no setter

Methods

clearSnackBars() → void

Available on BuildContext, provided by the BuildContextExension extension

Clears all SnackBars from the build context. This method removes all SnackBars that are in the queue, ensuring no SnackBars are displayed.
hideCurrentSnackBar() → void

Available on BuildContext, provided by the BuildContextExension extension

Hides the current SnackBar from the build context. This method dismisses the currently displayed SnackBar from the screen without removing it from the queue.
openDrawer() → void

Available on BuildContext, provided by the BuildContextExension extension

Opens the app drawer using the current ScaffoldState. This method triggers the opening of the main drawer, which is typically used for navigation.
openEndDrawer() → void

Available on BuildContext, provided by the BuildContextExension extension

Opens the end drawer using the current ScaffoldState. This method triggers the opening of the secondary drawer (if available), often used for additional options or settings.
pop<T extends Object>([T? result]) → void

Available on BuildContext, provided by the BuildContextExension extension

Pops the current route and optionally returns a result to the previous route. The result type should match the type expected by the previous route.
removeCurrentSnackBar() → void

Available on BuildContext, provided by the BuildContextExension extension

Removes the current SnackBar from the build context. This method removes the currently visible SnackBar and ensures no further SnackBars are displayed until new ones are added.
requestFocus(FocusNode focus) → void

Available on BuildContext, provided by the BuildContextExension extension

Requests focus on the given FocusNode. This method moves the focus to the provided focus node, making it the active input field.
showSnackBar({Key? key, Color? backgroundColor, double? elevation, EdgeInsetsGeometry? margin, EdgeInsetsGeometry? padding, double? width, HitTestBehavior? hitTestBehavior, SnackBarBehavior? behavior = SnackBarBehavior.floating, SnackBarAction? action, double? actionOverflowThreshold, bool? showCloseIcon, Color? closeIconColor, Animation<double>? animation, void onVisible()?, DismissDirection dismissDirection = DismissDirection.down, Clip clipBehavior = Clip.hardEdge, Duration duration = const Duration(seconds: 4), TextStyle? style, TextDirection? direction, BorderRadius? borderRadius, double horizontalPadding = 16, double verticalPadding = 8, Widget? leading, double leadingPadding = 4, Widget? title, Widget? description, Widget? trailing, double trailingPadding = 4}) → void

Available on BuildContext, provided by the BuildContextExension extension

Displays a custom SnackBar from the build context with various customizable options.
unFocus(FocusNode focus) → void

Available on BuildContext, provided by the BuildContextExension extension

Unfocuses the given FocusNode. This method removes focus from the provided focus node.
unFocusKeyboard() → void

Available on BuildContext, provided by the BuildContextExension extension

Hides the keyboard by unfocusing the current input field. This method is a shortcut to dismiss the keyboard by unfocusing the currently focused node.