SlideToSubmit class
A customizable slide-to-submit button widget.
Use this widget to create an interactive slider that triggers a callback
when dragged past a certain threshold. The onSubmit callback provides
access to a controller to programmatically reset or complete the slide state.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SlideToSubmit
- Annotations
Constructors
- SlideToSubmit({Key? key, required void onSubmit(SlideToSubmitController controller), Color backgroundColor = const Color(0xff1A4239), String? text, TextStyle textStyle = const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold), IconData? sliderIcon, Color sliderIconColor = Colors.white, Color foregroundColor = const Color(0xff22574A), BorderRadius borderRadius = const BorderRadius.all(Radius.circular(40)), double height = 76, double sliderWidth = 128, double threshold = 0.8, Duration bounceDuration = const Duration(milliseconds: 500), Curve bounceCurve = Curves.bounceOut, bool showArrow = true, EdgeInsetsGeometry padding = const EdgeInsets.all(8)})
-
Creates a styled SlideToSubmit button.
factory
- SlideToSubmit.custom({Key? key, EdgeInsetsGeometry padding = const EdgeInsets.all(8), required void onSubmit(SlideToSubmitController controller), BoxDecoration backgroundDecoration = const BoxDecoration(color: Colors.green, borderRadius: BorderRadius.all(Radius.circular(50))), BoxDecoration foregroundDecoration = const BoxDecoration(color: Color(0xff2e7d32), borderRadius: BorderRadius.all(Radius.circular(50))), required Widget slider, required double sliderWidth, double height = 76, Widget? hint, double threshold = 0.8, Duration bounceDuration = const Duration(milliseconds: 500), Curve bounceCurve = Curves.bounceOut})
-
Creates a fully custom SlideToSubmit button.
const
Properties
- backgroundDecoration → BoxDecoration
-
Decoration for the background container.
final
- bounceCurve → Curve
-
The curve used for the bounce-back animation.
final
- bounceDuration → Duration
-
The duration of the bounce-back animation if the threshold is not reached.
final
- foregroundDecoration → BoxDecoration
-
Decoration for the draggable foreground slider.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
Height of the overall widget.
final
- hint → Widget?
-
Optional hint widget displayed behind the slider (e.g. arrow indicator).
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onSubmit → void Function(SlideToSubmitController controller)
-
Callback executed when the slider completes.
final
- padding → EdgeInsetsGeometry
-
Padding around the widget.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- slider → Widget
-
The slider widget displayed inside the draggable area.
final
- sliderWidth → double
-
Width of the slider.
final
- threshold → double
-
The percentage of the slide required to trigger the onSubmit callback.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SlideToSubmit> -
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
-
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