Comments (9)
I apologize for the late reply.
When exactly is the wrong value passed into onChanged? Can you provide a reproducible example?
onChanged is basically only called when the user changes the value and not when the state changes.
from animated_toggle_switch.
AnimatedToggleSwitch<bool>.dual(
current:false,
first: false,
second: true,
dif: 50.0,
borderColor: Colors.transparent,
borderWidth: 5.0,
height: 55,
boxShadow: const [
BoxShadow(
color: Colors.black26,
spreadRadius: 1,
blurRadius: 2,
offset: Offset(0, 1.5),
),
],
onChanged: (b) => setState(() => positive = b),
colorBuilder: (b) => b ? Colors.red : Colors.green,
iconBuilder: (value) => value
? Icon(Icons.coronavirus_rounded)
: Icon(Icons.tag_faces_rounded),
textBuilder: (value) => value
? Center(child: Text('Oh no...'))
: Center(child: Text('Nice :)')),
),
in thie above code current is false so I expect b in onchange should be false while I change the switch it should be true but on change returns false while changing the switch
from animated_toggle_switch.
I took this code and always get back true when changing the switch. I do not see the error.
from animated_toggle_switch.
by changing the switch it is changing to true but if my current value is true then I expect false on changing not true
from animated_toggle_switch.
Yes, but with your code above, your current value is never true
because you explicitly inserted false
for current
.
I'm sorry, but I don't understand the problem or the error.
from animated_toggle_switch.
just change the current value to true and print value in on change eg..print(b) in this situation I expect output as false
from animated_toggle_switch.
I'm really sorry, but I've tried both now: With value: false
it always returns true in onChange and with value: true
it always returns false in onChange
. I can't reconstruct or understand the problem.
from animated_toggle_switch.
from animated_toggle_switch.
I'm closing the issue since there was no more response. If the error still occurs, you can reopen it.
from animated_toggle_switch.
Related Issues (19)
- Point releases should not have breaking changes HOT 3
- Range error when dragging the indicator too far in right direction HOT 9
- Change icon or text color HOT 4
- translation example HOT 3
- foreground icon and background icon do mismatch by a few pixel HOT 2
- Indicator hide DecoratedBox hide while dragging HOT 12
- Feature Request: Ability to disable toggle switch HOT 2
- Ability to initialize with null/unselected value HOT 5
- [Feature request] Add the possibility to toggle off the switch HOT 8
- Why is there no option to add an indicatorGradient in ToggleStyle? HOT 2
- problems with backgroundGradient and backgroundColor
- Theme switching occurs with a delay HOT 7
- Option to execute custom code after completion of animation HOT 2
- Setstate() called after dispose
- indicatorSize can't be changed HOT 2
- Indicator boxShadow is clipped HOT 4
- backgroundColor is displayed inaccurately. HOT 4
- Sometimes the toggle gets triggered two times HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animated_toggle_switch.