Last updated:
0 purchases
long hold down press button
Hold Press Button #
Simple Usage #
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
children: [
const SizedBox(
height: 100,
),
SizedBox(
width: 300,
child: Center(
child: HoldPressButton(
pressTime: 1,
contents: "1",
backgroundColor: Colors.blue,
fontColor: Colors.black,
pressFunc: () {
setState(() {});
},
)),
),
],
)),
);
}
}
copied to clipboard
Tags Parameters #
PropName
Description
default Value
pressTime
Time to press it
required
contents
button text
null
pressFunc
Functions that will run when pressed all the way
function
textSize
text Size
30
fontColor
text Color
Colors.white
textWeight
text Weight
Weight.normal
backgroundColor
button background
Colors.amber
Use this package as a library #
Depend on it
Run this command:
With Dart:
$ dart pub add long_hold_down_press_button
copied to clipboard
With Flutter:
$ flutter pub add long_hold_down_press_button
copied to clipboard
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
long_hold_down_press_button: ^0.0.1
copied to clipboard
Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:long_hold_down_press_button/hold_down_press_button.dart';
copied to clipboard
ScreenShot #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.