toWidget method
Builds the current field into a Widget to be used for input in the side panel.
Implementation
@override
Widget toWidget(BuildContext context, String group, T? value) {
final defaultValue = (T == int ? 0 : 0.0) as T;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 8,
child: Slider(
value: (value ?? initialValue)?.toDouble() ?? 0,
min: min.toDouble(),
max: max.toDouble(),
label: codec.toParam(value ?? initialValue ?? defaultValue),
divisions: divisions,
onChanged: (value) {
return updateField(
context,
group,
codec.toValue(value.toString())!,
);
},
),
),
Expanded(
child: Text(
codec.toParam(value ?? initialValue ?? defaultValue),
textAlign: TextAlign.end,
maxLines: 1,
),
),
],
);
}