boringdeveloper / flutterswitch Goto Github PK
View Code? Open in Web Editor NEWA Custom Switch package created for Flutter.
Home Page: https://pub.dev/packages/flutter_switch
License: BSD 3-Clause "New" or "Revised" License
A Custom Switch package created for Flutter.
Home Page: https://pub.dev/packages/flutter_switch
License: BSD 3-Clause "New" or "Revised" License
_FlutterSwitchState#3fb33(ticker active) was disposed with an active Ticker. _FlutterSwitchState created a Ticker via its SingleTickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. The Ticker must be disposed before calling super.dispose(). Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak. The offending ticker was: Ticker(created by _FlutterSwitchState#3fb33(lifecycle state: created)) The stack trace when the Ticker was actually created was: #0 new Ticker.<anonymous closure> (package:flutter/src/scheduler/ticker.dart:67:40) #1 new Ticker (package:flutter/src/scheduler/ticker.dart:69:6) #2 SingleTickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:131:15) #3 new AnimationController (package:flutter/src/animation/animation_controller.dart:248:21) #4 _FlutterSwitchState.initState (package:flutter_switch/flutter_switch.dart:44:28) #5 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4765:58) #6 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) #7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) #8 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6236:32) ... Normal element mounting (4 frames) #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) #13 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6236:32) ... Normal element mounting (16 frames) #29 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) #30 Element.updateChild (package:flutter/src/widgets/framework.dart:3324:20) #31 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16) #32 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:48 <fn>
There's currently no gradient argument that can be provided to be applied to the switch background instead of active color.
Hi there,
I can't find any controller to change the switch's state outside the widget.
I want to check status of some parameters on app start and then toggle switches respectively without calling the onToggle() call routine, but I can't find any way to do so.
I would appreciate any suggestion/solution.
Thanks.
I was unable to add a font awesome icon and an image inside the switch.
I think we should allow all widgets to be displayed inside the switch.
Switch the Button to ON state. Open some other application then come back to our application. The switch will be in the OFF state
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The image should be filled and have a fixed height and width (no red color).
Smartphone (please complete the following information):
Additional context
Source code:
return FlutterSwitch(
value: _currentValue,
onToggle: (newValue) {
setState(() {
_currentValue = newValue;
});
},
height: 30,
activeIcon: Image.asset(
'slider-thumb'.pngAssetsPath,
height: 30,
),
inactiveIcon: Image.asset(
'slider-thumb'.pngAssetsPath,
height: 30,
),
toggleColor: Colors.red,
activeColor: CustomColors.greenIndicator,
inactiveColor: CustomColors.pinkIndicator,
);
Thanks
hello, when I save bool statuts with sharedpreference and I load last value of statut I havn't change...
For exemple If my last statuts is true, and I load statut at the initStat I this print statuts : true but there is no switch of button...
i think will ok if have onChange
Hey, first of all I would like to say thank for all of you guys, you did nice job. Really appreciate that!
The thing I've notice is that:
The Switch doesn't move by swipe gesture from left to right and opposite.
Does the widget have such kind of feature? Maybe I missed that, not sure...
Anyway, this one should be present I suppose.
Are someone doing something like that?
I can basically contribute that.
Thank you
Describe the bug
When changing language to Arabic or any RTL language the text overlaps with button.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should follow RTL layout.
Smartphone (please complete the following information):
In LTR everything looks fine.
Dart 2.12 and Flutter 2 now support sound null safety (https://dart.dev/null-safety). We're using FlutterSwitch and looking to move everything to be null safe. Could you give me an idea of if/when you plan on supporting? Thanks!
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Please consider changing activeText
and inactiveText
to accept a widget instead of a String.
This way you can show images, icons and anything else you like in the track.
I am using this switch in one of the main sections of my app and sometimes, in some occasions, it would be very helpful to be able to disable the flutter_switch until some other parameters or inputs get ready or became available.
It looks like there is no property available to disable/enable the flutter_switch widget at the moment and I think it would be great to be able to do so.
Thanks for your great job.
I'm checking some conditions before witching the button. But when Switch the button for the first
time (ON to OFF or OFF to ON), It is not checking the conditions in onToggle
child: FlutterSwitch(
width: 125.0,
height: 55.0,
valueFontSize: 25.0,
toggleSize: 45.0,
value: value,
borderRadius: 30.0,
padding: 8.0,
showOnOff: true,
onToggle: (val) {
if (conditions) {
setState(() {
this.value = val;
});
} else {
setState(() {
this.value = !val;
});
}
},
),
Version used
pubspec.yaml
flutter_switch: ^0.1.4
I am trying to create a switch like in this image:
However, I cannot find a way to reduce the distance between the toggle and the edges to 0.
It ends up looking like this:
It would be nice if there was a setting that allows to remove this little bit of padding.
I have already looked at the code and by subtracting 9 from the Container width on line 382 I get the following:
This is certainly better, but the 9 is hardcoded for my specific toggle size.
Your widget doesn't have AnimationControllers.dispose() and always is falling down
_FlutterSwitchState#e50c7(ticker active) was disposed with an active Ticker.
I/flutter (20111): _FlutterSwitchState created a Ticker via its SingleTickerProviderStateMixin, but at the time
I/flutter (20111): dispose() was called on the mixin, that Ticker was still active. The Ticker must be disposed before
I/flutter (20111): calling super.dispose().
I/flutter (20111): Tickers used by AnimationControllers should be disposed by calling dispose() on the
I/flutter (20111): AnimationController itself. Otherwise, the ticker will leak.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
能新增一个disabledColor吗。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.