WayFar
Search…
KitSwitch

Description

A switch widget that can select between multiple options.

Preview

Code

switch.dart
1
class KitSwitch extends StatefulWidget {
2
final Map<String, String> options;
3
String? selected;
4
double itemWidth;
5
final Function(String key, String value) onChange;
6
7
KitSwitch({required this.options, required this.onChange, this.selected = null, this.itemWidth = 100, Key? key}) : super(key: key);
8
....
9
}
Copied!

API

Property
Description
Type
Default
options
List of options represented by key-value pairs (Map)
Map<String,String>
-
selected
Selected key
String
-
onChange
Callback when the selected item has changed
Function(String, String)
-
itemWidth
Width value of one item
double
-
Copy link