build method

  1. @override
Slider build({
  1. required BuildContext context,
  2. required FormMapper mapper,
  3. required TypeProperty property,
  4. required Keywords args,
})
override

build and bind the corresponding widget context a FormMapper mapper the FormMapper property a TypeProperty args and parameters that will be handled by the adapter

Implementation

@override
Slider build({required BuildContext context, required FormMapper mapper, required TypeProperty property, required Keywords args}) {
  var initialValue = mapper.getValue(property);

  Slider widget = Slider(
    value:  double.parse(initialValue.toString()),
    min: double.parse(args["min"].toString()),
    max: double.parse(args["max"].toString()),
    divisions: 10,
    onChanged: (newValue) {
      (context as Element).markNeedsBuild();

      mapper.notifyChange(property: property, value: newValue.round());
    },
  );

  mapper.map(property: property, widget: widget, adapter: this);

  return widget;
}