prefValue method

  1. @override
Widget prefValue()
override

Implementation

@override
Widget prefValue() {
  switch (pref.format) {
    case Pref.FORMAT_BOOL_CHECKBOX:
      return Checkbox(
          value: pref.value,
          onChanged: !pref.enabled
              ? null
              : (bool) {
                  pref.value = bool;
                  if (callback != null) {
                    callback!(pref);
                  }
                });
    case Pref.FORMAT_BOOL_SWITCH:
    default:
      return Switch(
          value: pref.value,
          onChanged: !pref.enabled
              ? null
              : (bool) {
                  pref.value = bool;
                  if (callback != null) {
                    callback!(pref);
                  }
                });
  }
}