ketanchoyal / custom_radio_grouped_button

Custom Flutter widgets that makes Checkbox and Radio Buttons much cleaner and easier.
MIT License
150 stars 42 forks source link

How to block clicks #67

Closed giantss closed 1 year ago

giantss commented 1 year ago

expected:

When clicking an option, if it is intercepted, the clicked option does not change anything。

reality: When the option is clicked, it is intercepted in the radioButtonValue callback method, and the clicked option still changes color, which has the same effect as before the interception.

May I ask how to achieve the desired effect?

giantss commented 1 year ago

image

Can the above forbidden state be achieved? @ketanchoyal

ketanchoyal commented 1 year ago

expected:

When clicking an option, if it is intercepted, the clicked option does not change anything。

reality: When the option is clicked, it is intercepted in the radioButtonValue callback method, and the clicked option still changes color, which has the same effect as before the interception.

May I ask how to achieve the desired effect?

Can you explain it a bit, I don't quite get the idea what you're trying to say

ketanchoyal commented 1 year ago

image

Can the above forbidden state be achieved? @ketanchoyal

Disabling a Button?

giantss commented 1 year ago

yes! thank you very much.

giantss commented 1 year ago

@ketanchoyal hi, I updated the local plug-in to v2.1.3, and I can already see the two attributes disabledValues and disabledColor, but after using it, I found that there is no difference from before, as if these two attributes have no effect.

Here is an example:

CustomRadioButton(
                  elevation: 0,
                  width: 115,
                  height: 40,
                  absoluteZeroSpacing: true,
                  enableShape: true,
                  defaultSelected: "0",
                  unSelectedColor:Colors.transparent,
                  unSelectedBorderColor: Colors.transparent,
                  selectedBorderColor: Colors.transparent,
                  selectedColor: Colors.red,
                  buttonTextStyle: const ButtonTextStyle(
                      selectedColor: Colors.white,
                      unSelectedColor:Colors.black,
                      textStyle: TextStyle(fontSize: 16)
                  ),

                  buttonLables: const [
                    '考试模式',
                    '课本模式',
                    '敬请期待',
                  ],
                  disabledValues: const ["考试模式"],
                  disabledColor: Colors.grey,
                  buttonValues: const [
                    "0",
                    "1",
                    "2",
                  ],
                  radioButtonValue: (value){

                  },
                )
ketanchoyal commented 1 year ago

it says disable values not disable label

giantss commented 1 year ago

Is it possible to disable clicking? And the click has no effect.

giantss commented 1 year ago

@ketanchoyal hello,

Is this need likely to be met?

ketanchoyal commented 1 year ago

It's already available, if you pass the values in disabled values I'll disable the button click action

giantss commented 1 year ago

@ketanchoyal oh, i found a bug。

When the horizontal property is set to false, the disabledValues configuration item is invalid.