slide_to_confirm 0.0.1 slide_to_confirm: ^0.0.1 copied to clipboard
A slider that will activate a callback when the user slides it to 100%.
slide_to_confirm #
A customizable slider that will activate a callback when the user slides it to 100%.
Screenshots #
Installation #
In the dependencies:
section of your pubspec.yaml
, add the following line:
slide_to_confirm: <latest_version>
Usage #
import 'package:slide_to_confirm/slide_to_confirm.dart';
class MyWidget extends StatelessWidget {
void confirmed(){
print('Slider confirmed!');
}
Widget build(BuildContext context) {
return ConfirmationSlider(
onConfirmation: () => confirmed(),
);
}
}
Properties #
- height
double
: Height of the slider. Defaults to70
. - width
double
: Width of the slider. Defaults to300
. - backgroundColor
Color
: The color of the background of the slider. Defaults toColors.white
. - foregroundColor
Color
: The color of the moving element of the slider. Defaults toColors.blueAccent
. - iconColor
Color
: The color of the icon on the moving element. Defaults toColors.white
. - icon
IconData
: The icon used on the moving element of the slider. Defaults toIcons.chevron_right
. - shadow
BoxShadow
: The shadow below the slider. Defaults toBoxShadow(color: Colors.black38, offset: Offset(0, 2),blurRadius: 2,spreadRadius: 0,)
. - text
String
: The text showed below the foreground. Used to specify the functionality to the user. Defaults to"Slide to confirm"
. - textStyle
TextStyle
: The style of the text. Defaults toTextStyle(color: Colors.black26, fontWeight: FontWeight.bold,)
. - onConfirmation
VoidCallback
: The callback when slider is completed. This is the only required field.
Example #
View the Flutter app in the example
directory to see a working example of how to use and implement the slider.
Contributors #
Gustav Friis-Hansen: https://github.com/Friiiis?tab=repositories