fk_toggle 0.1.2 fk_toggle: ^0.1.2 copied to clipboard
This is simple flutter toggle button widget. Supports show text labels and icons, Possible set multiple value to toggle ui, not only 2 values. Also you can customize size and colors as you like.
fk_toggle v0.1.0 #
This is simple flutter toggle button widget.
Supports show text labels and icons, Possible set multiple value to toggle ui, not only 2 values.
Also you can customize size and colors as you like.
Screenshot of SampleApp #
Features #
- Toggle Items
- Provide toggle change event.
- Show texts
- Show icons
- Customization of Size, And colors when toggle on/off.
How to install #
Add this to your package's pubspec.yaml file:
dependencies:
fk_toggle: ^0.1.1
You can install packages from the command line with Flutter:
$ flutter pub get
Import in your project:
import 'package:fk_toggle/fk_toggle.dart';
Usage #
Scaffold(
appBar: AppBar(title: const Text('Sample Toggle Switches')),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: Padding(
padding: const EdgeInsets.all(10.0),
child: FkToggle(
width: 50,
height: 30,
labels: const ['1', '2']
),
)
)
),
),
);
Parameter descriptions #
Property name | description | default value | required |
---|---|---|---|
width | length of a toogle ⚠️ not full length of widget | 🈚 | ✔️ |
height | height of widget | 🈚 | ✔️ |
labels | toggle button texts. Allow empty text | 🈚 | ✔️ |
cornerRadius | size of corner radius | 10 | |
backgroundColor | unselected toggle color | Colors.black26 | |
selectedColor | selected toggle color | Colors.blue | |
disabledElementColor | unselected label color | Colors.black54 | |
enabledElementColor | selected label color | Colors.white | |
fontSize | font size of labels | 16.0 | |
icons | Allow null value in lists,You can set an icon for any Toggle | 🈚 | |
onSelected | provide toggle change event, Provide index and instance | 🈚 |
Future schedule #
- Implement animation feature
- Improve class paramters to about like auto calulate width and height.
- you can post some issues.
Contacts #
Feel free to work consultation. fukutan.github@gmail.com