call method
Implementation
@override
Object? call(Interpreter interpreter, List<Object?> arguments,
Map<Symbol, Object?> namedArguments) {
var value = namedArguments[const Symbol('value')];
if (value == null) {
throw "value required in Switch";
}
var onChanged = namedArguments[const Symbol('onChanged')];
if (onChanged == null) {
throw "onChanged required in Switch";
}
bool autofocus = false;
var autofocusParsed = namedArguments[const Symbol('autofocus')];
if (autofocusParsed != null) {
autofocus = autofocusParsed as bool;
}
double? splashRadius =
parseDouble(namedArguments[const Symbol('splashRadius')]);
Color? activeColor;
var activeColorParsed = namedArguments[const Symbol('activeColor')];
if (activeColorParsed != null) {
activeColor = activeColorParsed as Color;
}
Color? activeTrackColor;
var activeTrackColorParsed = namedArguments[const Symbol('inactiveColor')];
if (activeTrackColorParsed != null) {
activeTrackColor = activeTrackColorParsed as Color;
}
Color? inactiveThumbColor;
var inactiveThumbColorParsed = namedArguments[const Symbol('hoverColor')];
if (inactiveThumbColorParsed != null) {
inactiveThumbColor = inactiveThumbColorParsed as Color;
}
Color? inactiveTrackColor;
var inactiveTrackColorParsed = namedArguments[const Symbol('focusColor')];
if (inactiveTrackColorParsed != null) {
inactiveTrackColor = inactiveTrackColorParsed as Color;
}
Color? focusColor;
var focusColorParse = namedArguments[const Symbol('focusColor')];
if (focusColorParse != null) {
focusColor = focusColorParse as Color;
}
return Switch.adaptive(
value: value as bool,
splashRadius: splashRadius,
autofocus: autofocus,
focusColor: focusColor,
activeColor: activeColor,
activeTrackColor: activeTrackColor,
inactiveThumbColor: inactiveThumbColor,
inactiveTrackColor: inactiveTrackColor,
onChanged: (value) {
(onChanged as LoxFunction).call(interpreter, [value], {});
});
}