call method
Implementation
@override
Object? call(Interpreter interpreter, List<Object?> arguments,
Map<Symbol, Object?> namedArguments) {
var icon = namedArguments[const Symbol('icon')];
if (icon == null) {
throw "icon required in IconButton";
}
var onPressed = namedArguments[const Symbol('onPressed')];
if (onPressed == null) {
throw "onPressed required in IconButton";
}
double iconSize =
parseDouble(namedArguments[const Symbol('iconSize')]) ?? 24;
EdgeInsetsGeometry padding = const EdgeInsets.all(8);
var paddingParse = namedArguments[const Symbol('padding')];
if (paddingParse != null) {
padding = paddingParse as EdgeInsetsGeometry;
}
AlignmentGeometry alignment = Alignment.center;
var alignmentParse = namedArguments[const Symbol('alignment')];
if (alignmentParse != null) {
alignment = alignmentParse as AlignmentGeometry;
}
BoxConstraints? constraints;
var constraintsParse = namedArguments[const Symbol('constraints')];
if (constraintsParse != null) {
constraints = constraintsParse as BoxConstraints;
}
bool autofocus = false;
var autofocusParse = namedArguments[const Symbol('autofocus')];
if (autofocusParse != null) {
autofocus = autofocusParse as bool;
}
Color? color;
var colorParse = namedArguments[const Symbol('color')];
if (colorParse != null) {
color = colorParse as Color;
}
Color? disabledColor;
var disabledColorParse = namedArguments[const Symbol('disabledColor')];
if (disabledColorParse != null) {
disabledColor = disabledColorParse as Color;
}
Color? splashColor;
var splashColorParse = namedArguments[const Symbol('splashColor')];
if (splashColorParse != null) {
splashColor = splashColorParse as Color;
}
Color? focusColor;
var focusColorParse = namedArguments[const Symbol('focusColor')];
if (focusColorParse != null) {
focusColor = focusColorParse as Color;
}
return IconButton(
icon: icon as Widget,
iconSize: iconSize,
autofocus: autofocus,
constraints: constraints,
padding: padding,
color: color,
disabledColor: disabledColor,
focusColor: focusColor,
splashColor: splashColor,
alignment: alignment,
onPressed: () {
(onPressed as LoxFunction).call(interpreter, [], {});
});
}