Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Ability to disable toggle switch #30

Closed
olsonjb opened this issue Apr 10, 2023 · 2 comments · Fixed by #35
Closed

Feature Request: Ability to disable toggle switch #30

olsonjb opened this issue Apr 10, 2023 · 2 comments · Fixed by #35
Assignees
Labels
enhancement New feature or request

Comments

@olsonjb
Copy link

olsonjb commented Apr 10, 2023

I would love to have the ability to disable the toggle switch. My workaround looks something like this:
indicatorColor: isIndicatorDisabled ? Colors.transparent : theme.colorScheme.primary,

Which works for my use case, but does not truly disable the toggle. I would love to be able to pass in a disabled argument to the constructor to prevent interaction. Additionally, I think it would be nice for current to be nullable, and when current is null the indicator is not shown.

@maeddin
Copy link
Member

maeddin commented Apr 11, 2023

I'm sorry for the late reply 😅
A disabled parameter is a good idea. Until I implement such a feature, you can disable the switch by wrapping IgnorePointer and Opacity around AnimatedToggleSwitch.

I'd still have to figure out how to pass that no value is set. Simply setting current to null is currently difficult, as null can also be in values. I could disallow nullable types for the switch but this would be a breaking change.

Currently I don't have much time to implement such features, but I'll get to it as soon as possible.

@maeddin maeddin added the enhancement New feature or request label Jun 21, 2023
@maeddin maeddin self-assigned this Jun 21, 2023
@maeddin
Copy link
Member

maeddin commented Jul 31, 2023

@olsonjb Should the switch have a lower opacity by default when inactivate, or should it be left to the users to implement this themselves?

@maeddin maeddin added the question Further information is requested label Jul 31, 2023
maeddin added a commit that referenced this issue Jul 31, 2023
@maeddin maeddin mentioned this issue Jul 31, 2023
@maeddin maeddin removed the question Further information is requested label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants