Comments (1)
The problem seems to stem from having too many parent widgets above the toggle_switch.
Scaffold body: Container>Column>toggle_wtich does the trick.
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:toggle_switch/toggle_switch.dart';
class ToggleDemo extends StatefulWidget {
@override
_ToggleDemoState createState() => _ToggleDemoState();
}
class _ToggleDemoState extends State<ToggleDemo> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Toggle Demo")),
body: Container(
child: Column(
children: [
ToggleSwitch(
changeOnTap: true,
minWidth: 110.0,
initialLabelIndex: 0,
cornerRadius: 20.0,
activeFgColor: Colors.white,
// activeBgColors: Colors.white,
inactiveBgColor: Colors.grey,
inactiveFgColor: Colors.white,
labels: ['Macho', 'Hembra'],
icons: [FontAwesomeIcons.mars, FontAwesomeIcons.venus],
activeBgColors: [Colors.blue, Colors.pink],
onToggle: (index) async {
print('switched to: $index');
},
),
],
),
),
);
}
}
from toggle_switch.
Related Issues (20)
- transparent inactiveBgColor with colored border HOT 1
- Border around toggle? HOT 7
- do not limit the maximum width HOT 1
- onToggle's returned index is nullable on Macbook but non-nullable on PC HOT 1
- Toggle dowsn't switch (visually) if there is a "SetState()" inside "onToggle" HOT 1
- setState function doesnot work with the toggle HOT 4
- Switch not displayed when only one border side is desired (activeBorders) HOT 2
- Option to disable click of toggle event when clicking on same status HOT 2
- Safari (I can't toggle on Safari) HOT 3
- Allow RichTitle or Widget for labels HOT 3
- How to add TextField between two switches? HOT 2
- Allow disable tab HOT 2
- Allow Custom Font Style but still respect activeFgColor and inactiveFgColor HOT 3
- How to deselect the selected option (switch) programmatically? HOT 1
- expanding the view HOT 2
- Allow intialValueIndex to be null HOT 2
- toggle_switch stretched to full width inside CustomScrollView HOT 2
- Swipe Feature
- Add a field "selectedIndex" to change selected tab programmatically HOT 2
- Widget refuse to update/switch to next index when used with provider management. HOT 8
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 toggle_switch.