OneContext class
Constructors
- OneContext()
-
factory
Properties
- context ↔ BuildContext?
-
The almost top root context of the app,
use it carefully or don't use it directly!
getter/setter pair
- darkThemeData → ThemeData?
-
no setter
- defaultRouteName → String
-
Push a named route onto the navigator that most tightly encloses the given
context.
no setterinherited
- dialog → DialogController
-
Return dialog utility class
DialogController
no setterinherited -
dialogNotifier
→ ValueNotifier<
List< Widget> > -
no setterinherited
- focusScope → FocusScopeNode
-
no setter
- hasDialogVisible → bool
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- heroController ↔ HeroController
-
getter/setter pair
-
key
↔ GlobalKey<
NavigatorState> -
Get the global key
GlobalKey<NavigatorState>()
getter/setter pairinherited - locale → Locale
-
Locale
no setter
- mediaQuery → MediaQueryData
-
If you need reactive changes, do not use OneContext().mediaQuery
Use
MediaQuery.of(context)
instead.no setter -
Return navigator utility class
NavigatorController
no setterinherited - oneNotifier ↔ OneNotificationController
-
getter/setter pair
- oneTheme ↔ OneThemeController
-
getter/setter pair
- overlay → OverlayController
-
Return overlay utility class
OverlayController
no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textTheme → TextTheme
-
If you need reactive changes, do not use OneContext().textTheme
Use
Theme.of(context).textTheme
instead.no setter - theme → ThemeData
-
If you need reactive changes, do not use OneContext().theme
Use
Theme.of(context)
instead.no setter - themeData → ThemeData?
-
no setter
- themeMode → ThemeMode
-
no setter
Methods
-
addDialogVisible(
Widget widget) → void -
inherited
-
addOverlay(
{required String overlayId, required Widget builder(BuildContext context), OverlayEntry? below, OverlayEntry? above}) → Future< String> -
Add an widget to overlay stack
inherited
-
builder(
BuildContext context, Widget? widget, {Key? key, MediaQueryData? mediaQueryData, String? initialRoute, Route onGenerateRoute(RouteSettings)?, Route onUnknownRoute(RouteSettings)?, List< NavigatorObserver> observers = const <NavigatorObserver>[]}) → Widget -
Use
OneContext().builder
in MaterialApp builder, in order to show dialogs and overlays. -
canPop(
) → bool -
Whether the navigator can be popped.
inherited
-
debugIsVisible(
OverlayEntry entry) → bool -
(DEBUG ONLY) Check whether a given entry is visible (i.e., not behind an
opaque entry).
inherited
-
getOverlayById(
String id) → OverlayEntry? -
Get OverlayEntry by id, if overlay with this id exists,
else it will return null
inherited
-
hideCurrentSnackBar(
{SnackBarClosedReason reason = SnackBarClosedReason.hide}) → void -
Removes the current SnackBar by running its normal exit animation.
inherited
-
hideOverlay(
) → dynamic -
Hide the overlay widget keeped by this class (it's like a single instance)
It can be used many times, without an
overlayId
inherited -
hideProgressIndicator(
) → void -
Hide progress indicator if it is visible
inherited
-
maybePop<
T extends Object?> ([T? result]) → Future< bool> -
Tries to pop the current route, while honoring the route's Route.willPop
state.
inherited
-
The state from the closest instance of this class that encloses the given context.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pop<
T extends Object?> ([T? result]) → void -
Pop the top-most route off the navigator.
inherited
-
popAllDialogs(
) → void -
inherited
-
popAndPushNamed<
T extends Object?, TO extends Object?> (String routeName, {TO? result, Object? arguments}) → Future< T?> -
Pop the current route off the navigator and push a named route in its
place.
inherited
-
popDialog<
T extends Object> ([T? result]) → dynamic -
Pop the top-most dialog off the OneContext.dialog.
inherited
-
popUntil(
RoutePredicate predicate) → void -
Calls pop repeatedly until the predicate returns true.
inherited
-
push<
T extends Object?> (Route< T> route) → Future<T?> -
Push the given route onto the navigator.
inherited
-
pushAndRemoveUntil<
T extends Object?> (Route< T> newRoute, RoutePredicate predicate) → Future<T?> -
Push the given route onto the navigator, and then remove all the previous
routes until the
predicate
returns true.inherited -
pushNamed<
T extends Object?> (String routeName, {Object? arguments}) → Future< T?> -
Push a named route onto the navigator.
inherited
-
pushNamedAndRemoveUntil<
T extends Object?> (String newRouteName, RoutePredicate predicate, {Object? arguments}) → Future< T?> -
Push the route with the given name onto the navigator, and then remove all
the previous routes until the
predicate
returns true.inherited -
pushReplacement<
T extends Object?, TO extends Object?> (Route< T> newRoute, {TO? result}) → Future<T?> -
Replace the current route of the navigator by pushing the given route and
then disposing the previous route once the new route has finished
animating in.
inherited
-
pushReplacementNamed<
T extends Object?, TO extends Object?> (String routeName, {TO? result, Object? arguments}) → Future< T?> -
Replace the current route of the navigator by pushing the route named
routeName
and then disposing the previous route once the new route has finished animating in.inherited -
rearrange(
Iterable< OverlayEntry> newEntries, {OverlayEntry? below, OverlayEntry? above}) → void -
Remove all the entries listed in the given iterable, then reinsert them
into the overlay in the given order.
inherited
-
registerCallback(
{Future< T?> showDialog<T>({bool? barrierDismissible, required Widget builder(BuildContext), })?, Future<T?> showModalBottomSheet<T>({Color? backgroundColor, required Widget builder(BuildContext), Clip? clipBehavior, double? elevation, bool? isDismissible, bool? isScrollControlled, ShapeBorder? shape, })?, ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showSnackBar(SnackBar builder(BuildContext?))?, PersistentBottomSheetController showBottomSheet<T>({Color? backgroundColor, Widget builder(BuildContext)?, Clip? clipBehavior, double? elevation, ShapeBorder? shape})? }) → void -
Register callbacks
inherited
-
registerDialogCallback(
{Future< T?> showDialog<T>({bool? barrierDismissible, required Widget builder(BuildContext), })?, Future<T?> showModalBottomSheet<T>({Color? backgroundColor, required Widget builder(BuildContext), Clip? clipBehavior, double? elevation, bool? isDismissible, bool? isScrollControlled, ShapeBorder? shape, })?, ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showSnackBar(SnackBar builder(BuildContext?))?, PersistentBottomSheetController showBottomSheet<T>({Color? backgroundColor, Widget builder(BuildContext)?, Clip? clipBehavior, double? elevation, ShapeBorder? shape})? }) → void - Register all necessary callbacks from main widget, automatically
-
removeAllOverlays(
) → dynamic -
Remove all overlays previously added from stack
inherited
-
removeCurrentSnackBar(
{SnackBarClosedReason reason = SnackBarClosedReason.hide}) → void -
Removes the current SnackBar (if any) immediately.
inherited
-
removeDialogVisible(
{Widget? widget}) → void -
inherited
-
removeOverlay(
String overlayId) → dynamic -
Remove a widget from overlay stack by widget id
overlayId
inherited -
removeRoute(
Route route) → void -
Immediately remove
route
from the navigator, and Route.dispose it.inherited -
removeRouteBelow(
Route anchorRoute) → void -
Immediately remove a route from the navigator, and Route.dispose it. The
route to be replaced is the one below the given
anchorRoute
.inherited -
replace<
T extends Object?> ({required Route oldRoute, required Route< T> newRoute}) → void -
Replaces a route on the navigator with a new route.
inherited
-
replaceRouteBelow<
T extends Object?> ({required Route anchorRoute, required Route< T> newRoute}) → void -
Replaces a route on the navigator with a new route. The route to be
replaced is the one below the given
anchorRoute
.inherited -
showBottomSheet<
T> ({required Widget builder(BuildContext), Color? backgroundColor, double? elevation, ShapeBorder? shape, Clip? clipBehavior}) → Future< PersistentBottomSheetController?> -
Shows a material design bottom sheet in the nearest Scaffold ancestor. If
you wish to show a persistent bottom sheet, use Scaffold.bottomSheet.
inherited
-
showDialog<
T> ({required Widget builder(BuildContext), bool barrierDismissible = true, }) → Future< T?> -
Displays a Material dialog above the current contents of the app, with
Material entrance and exit animations, modal barrier color, and modal
barrier behavior (dialog is dismissible with a tap on the barrier).
inherited
-
showModalBottomSheet<
T> ({required Widget builder(BuildContext), Color? backgroundColor, double? elevation, ShapeBorder? shape, Clip? clipBehavior, bool isScrollControlled = false, bool isDismissible = true}) → Future< T?> -
Shows a modal material design bottom sheet.
inherited
-
showOverlay(
{Widget builder(BuildContext context)?}) → Future< OverlayEntry> -
Show the overlay widget keeped by this class (it's like a single instance)
It can be used many times, without an
overlayId
inherited -
showProgressIndicator(
{Widget builder(BuildContext? context)?, Color? backgroundColor, Color? circularProgressIndicatorColor}) → Future< OverlayEntry> -
Show circular progress indicator, or a custom widget.
It can be used generally to show progress indicator,
but you can use a completelly custom widget
inherited
-
showSnackBar(
{required SnackBar builder(BuildContext?)}) → Future< ScaffoldFeatureController< SnackBar, SnackBarClosedReason> ?> -
Shows a SnackBar at the bottom of the scaffold.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- hasContext → bool
-
no setter
- instance ↔ OneContext
-
getter/setter pair