SmartVisible class

A widget that conditionally shows its child based on breakpoints.

Use SmartVisible to show content only on specific breakpoints.

Example:

// Show only on tablet and desktop
SmartVisible(
  visibleOn: [SmartBreakpoint.tablet, SmartBreakpoint.desktop],
  child: Sidebar(),
)

// Hide on mobile
SmartVisible(
  hiddenOn: [SmartBreakpoint.mobile, SmartBreakpoint.watch],
  child: AdvancedOptions(),
)

With animated transitions:

SmartVisible(
  visibleOn: [SmartBreakpoint.desktop],
  transition: SmartTransition.fade,
  transitionDuration: Duration(milliseconds: 200),
  child: DesktopSidebar(),
)
Inheritance
Available extensions

Constructors

SmartVisible({required Widget child, Key? key, List<SmartBreakpoint>? visibleOn, List<SmartBreakpoint>? hiddenOn, Widget? replacement, bool maintainState = false, bool maintainAnimation = false, bool maintainSize = false, SmartTransition transition = SmartTransition.none, Duration transitionDuration = const Duration(milliseconds: 200), Curve transitionCurve = Curves.easeInOut})
Creates a SmartVisible widget.
const
SmartVisible.except({required Widget child, required List<SmartBreakpoint> breakpoints, Key? key, Widget? replacement, bool maintainState = false, bool maintainAnimation = false, bool maintainSize = false, SmartTransition transition = SmartTransition.none, Duration transitionDuration = const Duration(milliseconds: 200), Curve transitionCurve = Curves.easeInOut})
Creates a SmartVisible that hides on specific breakpoints.
const
SmartVisible.on({required Widget child, required List<SmartBreakpoint> breakpoints, Key? key, Widget? replacement, bool maintainState = false, bool maintainAnimation = false, bool maintainSize = false, SmartTransition transition = SmartTransition.none, Duration transitionDuration = const Duration(milliseconds: 200), Curve transitionCurve = Curves.easeInOut})
Creates a SmartVisible that shows on specific breakpoints.
const

Properties

child Widget
The child widget to conditionally show.
final
hashCode int
The hash code for this object.
no setterinherited
hiddenOn List<SmartBreakpoint>?
The breakpoints on which to hide the child.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maintainAnimation bool
Whether to maintain animations when hidden.
final
maintainSize bool
Whether to maintain the size when hidden.
final
maintainState bool
Whether to maintain the state of the child when hidden.
final
replacement Widget?
Widget to show when the child is hidden.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
transition SmartTransition
The type of transition animation to use.
final
transitionCurve Curve
The curve to use for the transition animation.
final
transitionDuration Duration
The duration of the transition animation.
final
visibleOn List<SmartBreakpoint>?
The breakpoints on which to show the child.
final

Methods

aligned(AlignmentGeometry alignment) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Aligns this widget within its parent.
build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
centered() Widget

Available on Widget, provided by the SmartWidgetExtension extension

Centers this widget.
clipped({BorderRadius borderRadius = BorderRadius.zero}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget with a ClipRRect.
constrained({double? minWidth, double? maxWidth, double? minHeight, double? maxHeight}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a ConstrainedBox.
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
decorated(BoxDecoration decoration) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a DecoratedBox.
expanded({int flex = 1}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Expands this widget to fill available space.
flexible({int flex = 1, FlexFit fit = FlexFit.loose}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Makes this widget flexible.
hideOn(List<SmartBreakpoint> breakpoints, {Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Hides this widget on the specified breakpoints.
hideOnDesktop({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Hides this widget on desktop and TV breakpoints.
hideOnMobile({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Hides this widget on mobile and watch breakpoints.
inkWell({VoidCallback? onTap, BorderRadius? borderRadius}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget with Material and InkWell for ripple effects.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTap(VoidCallback? onTap) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a GestureDetector.
opacity(double opacity) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds opacity to this widget.
padded(EdgeInsets padding) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds padding using EdgeInsets.
paddedAll(double value) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds equal padding on all sides.
paddedHorizontal(double value) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds horizontal padding.
paddedSymmetric({double horizontal = 0, double vertical = 0}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds symmetric padding.
paddedVertical(double value) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds vertical padding.
responsivePadding({EdgeInsets? watch, EdgeInsets? mobile, EdgeInsets? tablet, EdgeInsets? desktop, EdgeInsets? tv}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds responsive padding to this widget.
safeArea({bool left = true, bool top = true, bool right = true, bool bottom = true}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a SafeArea.
scrollable({Axis scrollDirection = Axis.vertical, EdgeInsets? padding}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a SingleChildScrollView.
showOnDesktop({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on desktop and TV breakpoints.
showOnly(List<SmartBreakpoint> breakpoints, {Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on the specified breakpoints.
showOnMobile({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on mobile and watch breakpoints.
showOnTablet({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on tablet breakpoint.
sized({double? width, double? height}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a SizedBox with the given dimensions.
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
withPadding(SpacingSize size) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds padding using spacing tokens.
withPaddingOnly({SpacingSize? left, SpacingSize? top, SpacingSize? right, SpacingSize? bottom}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds padding on specific sides using spacing tokens.
withSymmetricPadding({SpacingSize? horizontal, SpacingSize? vertical}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds symmetric padding using spacing tokens.

Operators

operator ==(Object other) bool
The equality operator.
inherited