GetSnackBar class
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GetSnackBar
- Available extensions
Constructors
-
GetSnackBar.new({Key? key, String? title, String? message, Widget? titleText, Widget? messageText, Widget? icon, bool shouldIconPulse = true, double? maxWidth, EdgeInsets margin = const EdgeInsets.all(0.0), EdgeInsets padding = const EdgeInsets.all(16), double borderRadius = 0.0, Color? borderColor, double? borderWidth = 1.0, Color backgroundColor = const Color(0xFF303030), Color? leftBarIndicatorColor, List<
BoxShadow> ? boxShadows, Gradient? backgroundGradient, Widget? mainButton, OnTap? onTap, Duration? duration, bool isDismissible = true, DismissDirection? dismissDirection, bool showProgressIndicator = false, AnimationController? progressIndicatorController, Color? progressIndicatorBackgroundColor, Animation<Color> ? progressIndicatorValueColor, SnackPosition snackPosition = SnackPosition.BOTTOM, SnackStyle snackStyle = SnackStyle.FLOATING, Curve forwardAnimationCurve = Curves.easeOutCirc, Curve reverseAnimationCurve = Curves.easeOutCirc, Duration animationDuration = const Duration(seconds: 1), double barBlur = 0.0, double overlayBlur = 0.0, Color? overlayColor = Colors.transparent, Form? userInputForm, SnackbarStatusCallback? snackbarStatus}) -
const
Properties
- animationDuration → Duration
-
Use it to speed up or slow down the animation duration
final
- backgroundColor → Color
-
Will be ignored if backgroundGradient is not null
final
- backgroundGradient → Gradient?
-
Give to GetSnackbar a gradient background.
It Makes backgroundColor be ignored.
final
- barBlur → double
-
Default is 0.0. If different than 0.0, blurs only Snack's background.
To take effect, make sure your backgroundColor has some opacity.
The greater the value, the greater the blur.
final
- borderColor → Color?
-
Adds a border to every side of Snack
I do not recommend using it with showProgressIndicator
or leftBarIndicatorColor.
final
- borderRadius → double
-
Adds a radius to all corners of Snack. Best combined with margin.
I do not recommend using it with showProgressIndicator
or leftBarIndicatorColor.
final
- borderWidth → double?
-
Changes the width of the border if borderColor is specified
final
-
boxShadows
→ List<
BoxShadow> ? -
boxShadows The shadows generated by Snack. Leave it null
if you don't want a shadow.
You can use more than one if you feel the need.
Check (this example)
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/shadows.dart
final - debugRandomColor → Widget
-
Available on Widget, provided by the WidgetExtensions extension
no setter - dismissDirection → DismissDirection?
-
The direction in which the SnackBar can be dismissed.
final
- duration → Duration?
-
How long until Snack will hide itself (be dismissed).
To make it indefinite, leave it null.
final
- forwardAnimationCurve → Curve
-
The Curve animation used when show() is called.
Curves.easeOut is default
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Widget?
-
You can use any widget here, but I recommend Icon or Image as
indication of what kind
of message you are displaying. Other widgets may break the layout
final
- isDismissible → bool
-
Determines if the user can swipe or click the overlay
(if overlayBlur > 0) to dismiss.
It is recommended that you set duration != null if this is false.
If the user swipes to dismiss or clicks the overlay, no value
will be returned.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leftBarIndicatorColor → Color?
-
If not null, shows a left vertical colored bar on notification.
It is not possible to use it with a Form and I do not recommend
using it with LinearProgressIndicator
final
- mainButton → Widget?
-
(optional) An action that the user can take based on the snack bar.
final
- margin → EdgeInsets
-
Adds a custom margin to Snack
final
- marginZero → Widget
-
Available on Widget, provided by the WidgetMarginX extension
no setter - maxWidth → double?
-
Used to limit Snack width (usually on large screens)
final
- message → String?
-
The message displayed to the user.
final
- messageText → Widget?
-
Replaces message. Although this accepts a Widget, it is meant
to receive Text or RichText
final
- onTap → OnTap?
-
A callback that registers the user's click anywhere.
An alternative to mainButton
final
- overlayBlur → double
-
Default is 0.0. If different than 0.0, creates a blurred
overlay that prevents the user from interacting with the screen.
The greater the value, the greater the blur.
final
- overlayColor → Color?
-
Default is Colors.transparent. Only takes effect if overlayBlur > 0.0.
Make sure you use a color with transparency here e.g.
Colors.grey
600
.withOpacity(0.2).final - padding → EdgeInsets
-
Adds a custom padding to Snack
The default follows material design guide line
final
- paddingZero → Widget
-
Available on Widget, provided by the WidgetPaddingX extension
no setter - progressIndicatorBackgroundColor → Color?
-
A LinearProgressIndicator configuration parameter.
final
- progressIndicatorController → AnimationController?
-
An optional AnimationController when you want to control the
progress of your LinearProgressIndicator.
final
-
progressIndicatorValueColor
→ Animation<
Color> ? -
A LinearProgressIndicator configuration parameter.
final
- reverseAnimationCurve → Curve
-
The Curve animation used when dismiss() is called.
Curves.fastOutSlowIn is default
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldIconPulse → bool
-
An option to animate the icon (if present). Defaults to true.
final
- showProgressIndicator → bool
-
True if you want to show a LinearProgressIndicator.
final
- sliverBox → Widget
-
Available on Widget, provided by the WidgetSliverBoxX extension
no setter - snackbarStatus → SnackbarStatusCallback?
-
A callback for you to listen to the different Snack status
final
- snackPosition → SnackPosition
-
Snack can be based on SnackPosition.TOP or on SnackPosition.BOTTOM
of your screen.
SnackPosition.BOTTOM is the default.
final
- snackStyle → SnackStyle
-
Snack can be floating or be grounded to the edge of the screen.
If grounded, I do not recommend using margin or borderRadius.
SnackStyle.FLOATING is the default
If grounded, I do not recommend using a backgroundColor with
transparency or barBlur
final
- title → String?
-
The title displayed to the user
final
- titleText → Widget?
-
Replaces title. Although this accepts a Widget, it is meant
to receive Text or RichText
final
- userInputForm → Form?
-
A TextFormField in case you want a simple user input.
Every other widget is ignored if this is not null.
final
Methods
-
align(
AlignmentGeometry alignment, {Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
对齐 -
alignBottom(
) → Widget -
Available on Widget, provided by the WidgetExtensions extension
对齐 底部 -
alignCenter(
) → Widget -
Available on Widget, provided by the WidgetExtensions extension
对齐 中间 -
alignLeft(
) → Widget -
Available on Widget, provided by the WidgetExtensions extension
对齐 左边 -
alignRight(
) → Widget -
Available on Widget, provided by the WidgetExtensions extension
对齐 右边 -
alignTop(
) → Widget -
Available on Widget, provided by the WidgetExtensions extension
对齐 顶部 -
aspectRatio(
{Key? key, required double aspectRatio}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
-
backgroundColor(
Color color, {Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
背景颜色 -
backgroundImage(
DecorationImage image, {Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
背景图片 -
border(
{Key? key, double? all, double? left, double? right, double? top, double? bottom, Color color = const Color(0xFF000000), BorderStyle style = BorderStyle.solid}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
边框 -
borderRadius(
{Key? key, double? all, double? topLeft, double? topRight, double? bottomLeft, double? bottomRight}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
圆角 -
boxShadow(
{Key? key, Color color = const Color(0xFF000000), Offset offset = Offset.zero, double blurRadius = 0.0, double spreadRadius = 0.0}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
阴影 -
card(
{Key? key, double? radius, Color? color, Color? shadowColor, double? blurRadius}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
卡片 -
center(
{Key? key, double? widthFactor, double? heightFactor}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
-
clipOval(
{Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
裁剪 oval -
clipRect(
{Key? key, CustomClipper< Rect> ? clipper, Clip clipBehavior = Clip.hardEdge}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
裁剪 rect -
clipRRect(
{Key? key, double? all, double? topLeft, double? topRight, double? bottomLeft, double? bottomRight, CustomClipper< RRect> ? clipper, Clip clipBehavior = Clip.antiAlias}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
裁剪圆角 -
constrained(
{Key? key, double? width, double? height, double minWidth = 0.0, double maxWidth = double.infinity, double minHeight = 0.0, double maxHeight = double.infinity}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
约束 -
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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(
{Key? key, Color? color, DecorationImage? image, BoxBorder? border, BorderRadius? borderRadius, List< BoxShadow> ? boxShadow, Gradient? gradient, BlendMode? backgroundBlendMode, BoxShape shape = BoxShape.rectangle, DecorationPosition position = DecorationPosition.background}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
盒子装饰器 -
elevation(
double elevation, {Key? key, BorderRadiusGeometry borderRadius = BorderRadius.zero, Color shadowColor = const Color(0xFF000000)}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
elevation -
expanded(
{Key? key, int flex = 1}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
expanded 撑满 -
fittedBox(
{Key? key, BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.centerLeft, Clip clipBehavior = Clip.none}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
-
flexible(
{Key? key, int flex = 1, FlexFit fit = FlexFit.loose}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
弹性布局 flexible -
fractionallySizedBox(
{Key? key, AlignmentGeometry alignment = Alignment.center, double? widthFactor, double? heightFactor}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
-
gestures(
{Key? key, GestureOnTapChangeCallback? onTapChange, GestureTapDownCallback? onTapDown, GestureTapUpCallback? onTapUp, GestureTapCallback? onTap, GestureTapCancelCallback? onTapCancel, GestureTapDownCallback? onSecondaryTapDown, GestureTapUpCallback? onSecondaryTapUp, GestureTapCancelCallback? onSecondaryTapCancel, GestureTapCallback? onDoubleTap, GestureLongPressCallback? onLongPress, GestureLongPressStartCallback? onLongPressStart, GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate, GestureLongPressUpCallback? onLongPressUp, GestureLongPressEndCallback? onLongPressEnd, GestureDragDownCallback? onVerticalDragDown, GestureDragStartCallback? onVerticalDragStart, GestureDragUpdateCallback? onVerticalDragUpdate, GestureDragEndCallback? onVerticalDragEnd, GestureDragCancelCallback? onVerticalDragCancel, GestureDragDownCallback? onHorizontalDragDown, GestureDragStartCallback? onHorizontalDragStart, GestureDragUpdateCallback? onHorizontalDragUpdate, GestureDragEndCallback? onHorizontalDragEnd, GestureDragCancelCallback? onHorizontalDragCancel, GestureDragDownCallback? onPanDown, GestureDragStartCallback? onPanStart, GestureDragUpdateCallback? onPanUpdate, GestureDragEndCallback? onPanEnd, GestureDragCancelCallback? onPanCancel, GestureScaleStartCallback? onScaleStart, GestureScaleUpdateCallback? onScaleUpdate, GestureScaleEndCallback? onScaleEnd, GestureForcePressStartCallback? onForcePressStart, GestureForcePressPeakCallback? onForcePressPeak, GestureForcePressUpdateCallback? onForcePressUpdate, GestureForcePressEndCallback? onForcePressEnd, HitTestBehavior? behavior, bool excludeFromSemantics = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
手势 -
height(
double height, {Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
约束 高度 -
inkWell(
{Key? key, dynamic onTap()?, double? borderRadius}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
-
limitedBox(
{Key? key, double maxWidth = double.infinity, double maxHeight = double.infinity}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
限制盒子 最大宽高 -
marginAll(
double margin) → Widget -
Available on Widget, provided by the WidgetMarginX extension
-
marginOnly(
{double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) → Widget -
Available on Widget, provided by the WidgetMarginX extension
-
marginSymmetric(
{double horizontal = 0.0, double vertical = 0.0}) → Widget -
Available on Widget, provided by the WidgetMarginX extension
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offstage(
{Key? key, bool offstage = true}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
偏移 -
onLongPress(
GestureTapCallback? onLongPress, {Key? key, HitTestBehavior? behavior, bool excludeFromSemantics = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
长按手势 -
onTap(
GestureTapCallback? onTap, {Key? key, HitTestBehavior? behavior, bool excludeFromSemantics = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
手势 -
opacity(
double opacity, {Key? key, bool alwaysIncludeSemantics = false}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
透明度 -
overflow(
{Key? key, AlignmentGeometry alignment = Alignment.center, double? minWidth, double? maxWidth, double? minHeight, double? maxHeight}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
溢出 -
padding(
{Key? key, EdgeInsetsGeometry? value, double? all, double? horizontal, double? vertical, double? top, double? bottom, double? left, double? right}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 -
paddingAll(
double padding) → Widget -
Available on Widget, provided by the WidgetPaddingX extension
-
paddingBottom(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 下 -
paddingHorizontal(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 横向 -
paddingLeft(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 左 -
paddingOnly(
{double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) → Widget -
Available on Widget, provided by the WidgetPaddingX extension
-
paddingRight(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 右 -
paddingSymmetric(
{double horizontal = 0.0, double vertical = 0.0}) → Widget -
Available on Widget, provided by the WidgetPaddingX extension
-
paddingTop(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 上 -
paddingVertical(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 纵向 -
positioned(
{Key? key, double? left, double? top, double? right, double? bottom, double? width, double? height}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
stack布局 位置 -
ripple(
{Key? key, Color? focusColor, Color? hoverColor, Color? highlightColor, Color? splashColor, InteractiveInkFeatureFactory? splashFactory, double? radius, ShapeBorder? customBorder, bool enableFeedback = true, bool excludeFromSemantics = false, FocusNode? focusNode, bool canRequestFocus = true, bool autoFocus = false, bool enable = true}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
涟漪 -
safeArea(
{Key? key, bool top = true, bool bottom = true, bool left = true, bool right = true, EdgeInsets minimum = EdgeInsets.zero}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
安全区 -
scale(
{Key? key, double? all, double? x, double? y, Offset? origin, AlignmentGeometry alignment = Alignment.center, bool transformHitTests = true}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
比例缩放 -
scrollable(
{Key? key, Axis scrollDirection = Axis.vertical, bool reverse = false, bool? primary, ScrollPhysics? physics, ScrollController? controller, DragStartBehavior dragStartBehavior = DragStartBehavior.start, EdgeInsetsGeometry? padding}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
滚动视图 -
semanticsLabel(
String label, {Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
语义调试 MaterialApp.showSemanticsDebugger: true, -
show(
) → SnackbarController - Show the snack. It's call SnackbarStatus.OPENING state followed by SnackbarStatus.OPEN
-
sliverPadding(
{Key? key, EdgeInsetsGeometry? value, double? all, double? horizontal, double? vertical, double? top, double? bottom, double? left, double? right}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 -
sliverPaddingBottom(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 下 -
sliverPaddingHorizontal(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 横向 -
sliverPaddingLeft(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 左 -
sliverPaddingRight(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 右 -
sliverPaddingTop(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 上 -
sliverPaddingVertical(
double val) → Widget -
Available on Widget, provided by the WidgetExtensions extension
内间距 纵向 -
sliverToBoxAdapter(
{Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
SliverToBoxAdapter -
tight(
{double? width, double? height, Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
约束 宽高 -
tightSize(
double size, {Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
约束 宽高 size -
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
-
transform(
{Key? key, required Matrix4 transform, Offset? origin, AlignmentGeometry? alignment, bool transformHitTests = true}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
transforms Matrix4 -
translate(
{Key? key, required Offset offset, bool transformHitTests = true}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
translate 变化位置 -
unconstrained(
{Key? key, TextDirection? textDirection, AlignmentGeometry alignment = Alignment.center, Axis? constrainedAxis, Clip clipBehavior = Clip.none}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
-
width(
double width, {Key? key}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
约束 宽度
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited