import 'package:flutter/material.dart';
import 'package:flut/flut/runtime.dart';

class FlutSwitch {
  FlutSwitch._();

  static Widget? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Switch(
      key: runtime.decodeKey(data),
      value: runtime.unpackRequiredField<bool>(data, 'value'),
      onChanged: runtime.unpackNullableRequiredCallback(data, 'onChangedId'),
      activeThumbColor: runtime.unpackOptionalField<Color>(
        data,
        'activeThumbColor',
      ),
      activeTrackColor: runtime.unpackOptionalField<Color>(
        data,
        'activeTrackColor',
      ),
      inactiveThumbColor: runtime.unpackOptionalField<Color>(
        data,
        'inactiveThumbColor',
      ),
      inactiveTrackColor: runtime.unpackOptionalField<Color>(
        data,
        'inactiveTrackColor',
      ),
      autofocus: runtime.unpackRequiredField<bool>(data, 'autofocus'),
    );
  }
}
