WayFar
Search…
⌃K

KitSwitch

Description

A switch widget that can select between multiple options.

Preview

Code

switch.dart
class KitSwitch extends StatefulWidget {
final Map<String, String> options;
String? selected;
double itemWidth;
final Function(String key, String value) onChange;
KitSwitch({required this.options, required this.onChange, this.selected = null, this.itemWidth = 100, Key? key}) : super(key: key);
....
}

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
-