customtimerbutton 0.1.21 copy "customtimerbutton: ^0.1.21" to clipboard
customtimerbutton: ^0.1.21 copied to clipboard

Very simple customizable widgets allowing you to create very nice and super ergonomic miniuter buttons that deactivate after exerting pressure on it and reactivate automatically once the defined time [...]

Example #

there are a number of properties that you can modify

  • color
  • disabledColor,
  • buttonType
  • activeTextStyle,
  • disabledTextStyle
  • borderRadius,
  • textAlign,
  • shape,
  • elevation
  • width,
  • height,

class TimerButton extends StatelessWidget {
  const TimerButton({
    Key? key,
    required String label,
    required TextAlign textAlign,
    required String disabledLabel,
    required Color color,
    ShapeBorder? shape,
    double? width,
    required int height,
    required int timeOutInSeconds,
    required int elevation,
    BorderRadius? borderRadius,
    required void Function() onPressed,
    required TextStyle disabledTextStyle,
    required TextStyle activeTextStyle,
    required ButtonType buttonType,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Timer Button'),
      ),
      body: Center(
        child: ctmTimeButtom(
            text: 'Click here',
            disableText: 'Retry in',
            width: size(context).width * 0.53,
            onPressed: () {},
            time: 180,
            shape: const RoundedRectangleBorder(
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(20),
                    bottomLeft: Radius.circular(20))),
            borderRadius: const BorderRadius.only(
                topLeft: Radius.circular(20), bottomLeft: Radius.circular(20))),
      ),
    );
  }

  // custom Timeer button
  Widget ctmTimeButtom({
    required final String text,
    required final String disableText,
    final Color? color,
    required void Function() onPressed,
    final BorderRadius? borderRadius,
    final double? width,
    final ShapeBorder? shape,
    final double? elevation,
    int? time,
  }) {
    return TimerButton(
      label: text,
      textAlign: TextAlign.center,
      disabledLabel: disableText,
      color: color ?? Colors.red,
      shape: shape,
      width: width,
      height: 55,
      timeOutInSeconds: time ?? 5,
      elevation: 18,
      borderRadius: borderRadius,
      onPressed: onPressed,
      disabledTextStyle: const TextStyle(
        fontSize: 17,
        color: Colors.black38,
        fontWeight: FontWeight.bold,
      ),
      activeTextStyle: const TextStyle(
        color: Colors.white,
        fontSize: 17,
        fontWeight: FontWeight.bold,
      ),
      buttonType: ButtonType.CupertinoButton,
    );
  }
}

copied to clipboard
First Screen shoot
Second Screen shoot
Third Screen shoot
2
likes
130
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

2024.07.08 - 2025.01.20

Very simple customizable widgets allowing you to create very nice and super ergonomic miniuter buttons that deactivate after exerting pressure on it and reactivate automatically once the defined time has passed.

Repository (GitHub)

Documentation

Documentation
API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on customtimerbutton