dualswitch 1.0.1 copy "dualswitch: ^1.0.1" to clipboard
dualswitch: ^1.0.1 copied to clipboard

A new Flutter package that allows user to take action from user either approve or reject

DualSwitch #

A lightweight Flutter package that provides a simple and customizable switch widget allowing users to take quick Approve or Reject actions with ease.

Ideal for use cases like approvals, verifications, moderation, or any binary decision-making UI.


✨ Features #

  • Toggle between Approve and Reject actions.
  • Fully customizable colors and labels.
  • Optional reset after action.
  • Clean and intuitive UI.

🚀 Getting Started #

Add the package to your pubspec.yaml:

dependencies:
  dual_switch: ^<latest_version>

Then, import it:

import 'package:dual_switch/dual_switch.dart';

🧰 Usage #

Basic Example :

DualSwitch(onChanged: (value) {
    debugPrint("value : $value");
},)

With Customization :

DualSwitch(
    acceptColor: Colors.green,
    rejectColor: Colors.red,
    acceptText: "Accept",
    rejectText: "Reject",
    acceptedText: "Accepted",
    rejectedText: "Rejected",
    reset : true,
    onChanged: (value) {
        debugPrint("value : $value");
    },
)

| -------------- | ---------------- | -------------- | --------------------------------------------------------- |

Parameter Type Default Description
onChanged Function(bool) required Callback when user makes a selection (true or false).
acceptColor Color Colors.green Color for the approve state.
rejectColor Color Colors.red Color for the reject state.
acceptText String "Approve" Label for approve button before selection.
rejectText String "Reject" Label for reject button before selection.
acceptedText String "Approved" Label shown after approve is selected.
rejectedText String "Rejected" Label shown after reject is selected.
reset bool false Whether to reset to neutral state after selection.
18
likes
115
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter package that allows user to take action from user either approve or reject

Repository (GitHub)
View/report issues

Topics

#utility #custom-widgets

Documentation

API reference

License

unknown (license)

Dependencies

flutter, flutter_svg

More

Packages that depend on dualswitch