SConnectivityOverlay class
A convenience wrapper that sets up the Modal overlay system so that SConnectivity's "No Internet" snackbar (and any other Modal features) work without the user having to know about Modal.appBuilder.
Safe to use even if you already wrap with Modal.appBuilder.
Modal.appBuilder is idempotent — calling it more than once simply
returns the child as-is, so no double-nesting can occur.
Usage
Option 1 – static builder (simplest, replaces Modal.appBuilder):
MaterialApp(
builder: SConnectivityOverlay.appBuilder,
home: MyHomePage(),
)
Option 2 – widget wrapper (if you need to chain multiple builders or customise Modal parameters):
MaterialApp(
builder: (context, child) {
return SConnectivityOverlay(
child: child!,
);
},
home: MyHomePage(),
)
Option 3 – used alongside an existing Modal.appBuilder (safe):
MaterialApp(
builder: (context, child) {
// Either order is fine — Modal.appBuilder is idempotent.
child = Modal.appBuilder(context, child);
return SConnectivityOverlay(child: child!);
},
home: MyHomePage(),
)
In all cases the full Modal system (snackbars, dialogs, sheets) is available throughout the app.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- SConnectivityOverlay
- Available extensions
Constructors
- SConnectivityOverlay({Key? key, required Widget child, BorderRadius? borderRadius, bool shouldBounceOnTap = true, Color backgroundColor = Colors.black, bool showDebugPrints = false})
-
const
Properties
- backgroundColor → Color
-
Background color visible behind the scaled app content when a sheet
modal is active.
final
- borderRadius → BorderRadius?
-
Border radius applied to the background when a sheet modal is active.
final
- child → Widget
-
The app content to wrap.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldBounceOnTap → bool
-
Whether the modal background should bounce when the dismiss barrier
is tapped.
final
- showDebugPrints → bool
-
Whether to print debug information for Modal events.
final
Methods
-
addMaterialWidget(
) → Material -
Available on Widget, provided by the GenericExtensions extension
-
addTooltipWidget(
String toolTip) → Tooltip -
Available on Widget, provided by the GenericExtensions extension
-
animate(
{Key? key, List< Effect> ? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) → Animate -
Available on Widget, provided by the AnimateWidgetExtensions extension
Wraps the target Widget in anAnimateinstance, and returns the instance for chaining calls. Ex.myWidget.animate()is equivalent toAnimate(child: myWidget). -
borderRadius(
[BorderRadiusGeometry? borderRadius]) → Widget -
Available on Widget, provided by the GenericExtensions extension
-
boxDecoration(
[BoxDecoration? boxDecoration]) → Widget -
Available on Widget, provided by the GenericExtensions extension
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
colorFilter(
[ColorFilter? colorFilter]) → Widget -
Available on Widget, provided by the GenericExtensions extension
set parent widget in center -
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
appBuilder(
BuildContext context, Widget? child) → Widget -
Drop-in replacement for Modal.appBuilder that can be passed directly
to
MaterialApp(builder: ...).