sliding_action_button 0.0.8

SDKflutter
Platformandroidioswindowslinuxmacosweb

Sliding action button package provide pre build functionality for sliding(swipe) action button with some pre define shapes

About This Package

Slide action button package developed to provide an easy way to flutter developers implemending button that slides to perform an action. It is customizable by providing the option to change button container color, adding custom icon to draggable buttons, enable or disable button with applying different color per status.

Available Features:

  • CircleSlidingActionButton
  • SquareSlidingActionButton
  • The above options with the ability to show loading state when the sliding action is completed

What are the benefits of using this package:

  • Save development time
  • With only few lines of code you can have the sliding action functionaly

Requirements

Minimum Flutter SDK: 3.0.0

Example usage of the current supported features

Configurations

General parameters used in all options

ParametersDescription
heightThis is the height of the whole widget.
widthThis is the width of the whole widget
parentBoxRadiusValueThis is the double value for the BorderRadius.circular() attribute to configure the corners of parent box.
parentBoxBackgroundColorThis is the background color of the parent box when isEnable is True. NOTE: You cannot set this and also, set the parentBoxGradientBackgroundColor or parentBoxDisableGradientBackgroundColor.
parentBoxDisableBackgroundColorThis is the background color of the parent box when isEnable is False. NOTE: You cannot set this and also, set the parentBoxGradientBackgroundColor or parentBoxDisableGradientBackgroundColor.
parentBoxGradientBackgroundColorThis is the background color of the parent box in case you want to use gradient when isEnable is True. NOTE: You cannot set this and also, set the parentBoxBackgroundColor or parentBoxDisableBackgroundColor.
parentBoxDisableGradientBackgroundColorThis will be the background color of the parent box in case you want to use gradient when isEnable is False. NOTE: You cannot set this and also, set the parentBoxBackgroundColor or parentBoxDisableBackgroundColor.
initialSlidingActionLabelThis is the text appear in the parent box before the sliding action.
finalSlidingActionLabelThis is the text appear in the parent box after the sliding action.
initialSlidingActionLabelTextStyleThis is the text styling of the label appear before the sliding action.
finalSlidingActionLabelTextStyleThis is the text styling of the label appear after the sliding action. In case this field is null the same style as the initialSlidingActionLabelTextStyle will be used.
isEnableThis is used to enable or disable the sliding action. The default value is True.
loaderColorThis is the color of the loader once the sliding action is completed. By default is White.
animationDurationThis is the time needed for the visibility change from slide to action button to loader. By Default is 700 milliseconds.
onSlideActionCompletedThis is a callback used to indicate the end of the sliding action with success.
onSlideActionCanceledThis is a callback used to indicate the end of the sliding action without suceed.
SlideToActionControllerThis is used to handle the state of the button (i.e initial, loading, reset). By default is initial. NOTE: In case you don't pass an instance of SlideToActionController on will be created to handle the slide action but you will not be able to change button state.

CircleSlidingActionButton

ParametersDescription
circleSlidingButtonSizeThis is the width and height of the circle(draggable) button.
circleSlidingButtonRadiusValueThis is the double value for the BorderRadius.circular() attribute on the circle button.
leftEdgeSpacingThis is used to align the left side of circle button.
rightEdgeSpacingThis is used to determined the space between the circle sliding button widget and the parent widget on the right end.
circleSlidingButtonIconThis is the icon appear on the sliding button.
circleSlidingButtonBackgroundColorThis is the background color of the circle sliding button when isEnable = True.
circleSlidingButtonDisableBackgroundColorThis is the background color of the circle sliding button when isEnable = False.
slideActionButtonTypeThis field indicating the basic behavior of the slide action (Type). By default is SlideActionButtonType.basicSlideActionButton.
            CircleSlideToActionButton(
              width: 250,
              parentBoxRadiusValue: 27,
              circleSlidingButtonSize: 47,
              leftEdgeSpacing: 3,
              initialSlidingActionLabel: 'Add To Basket',
              finalSlidingActionLabel: 'Added To Basket',
              circleSlidingButtonIcon: const Icon(
                Icons.add_shopping_cart,
                color: Colors.orange,
              ),
              parentBoxBackgroundColor: Colors.orange,
              parentBoxDisableBackgroundColor: Colors.grey,
              /*  parentBoxGradientBackgroundColor:
                  LinearGradient(colors: [Colors.red, Colors.white]),
              parentBoxDisableGradientBackgroundColor:
                  LinearGradient(colors: [Colors.red, Colors.white]),*/
              circleSlidingButtonBackgroundColor: Colors.white,
              isEnable: true,
              onSlideActionCompleted: () {
                print("Sliding action completed");
              },
              onSlideActionCanceled: () {
                print("Sliding action cancelled");
              },
            ),

SquareSlidingActionButton

ParametersDescription
squareSlidingButtonSizeThis is the width and height of the square(draggable) button.
squareSlidingButtonRadiusValueThis is the double value for the BorderRadius.circular() attribute on the square button.
leftEdgeSpacingThis is used to align the left side of square button.
rightEdgeSpacingThis is used to determined the space between the square sliding button widget and the parent widget on the right end.
squareSlidingButtonIconThis is the icon appear on the sliding button.
squareSlidingButtonBackgroundColorThis is the background color of the square sliding button when isEnable = True.
squareSlidingButtonDisableBackgroundColorThisis the background color of the square sliding button when isEnable = False.
slideActionButtonTypeThis field indicating the basic behavior of the slide action (Type). By default is SlideActionButtonType.basicSlideActionButton.
            SquareSlideToActionButton(
              width: 250,
              parentBoxRadiusValue: 15,
              initialSlidingActionLabel: 'Add To Basket',
              finalSlidingActionLabel: 'Added To Basket',
              squareSlidingButtonSize: 50,
              squareSlidingButtonIcon: const Icon(
                Icons.add_shopping_cart,
                color: Colors.orange,
              ),
              squareSlidingButtonBackgroundColor: Colors.white,
              parentBoxGradientBackgroundColor: LinearGradient(
                  colors: [Colors.orange, Colors.grey.withOpacity(0.5)]),
              parentBoxDisableGradientBackgroundColor: LinearGradient(colors: [
                Colors.grey,
              ]),
              leftEdgeSpacing: 2,
              rightEdgeSpacing: 4,
              onSlideActionCompleted: () {
                print("Sliding action completed");
              },
              onSlideActionCanceled: () {
                print("Sliding action cancelled");
              },
            );

Additional information

New features are coming!

Thank you for your interest in my package. If you have any feedback, found a bug or need something that is missing feel free to create an issue in the following link. https://github.com/r1n1os/sliding_action_button/issues