PipControls.fromJson constructor

PipControls.fromJson(
  1. Map<String, dynamic>? json
)

Implementation

factory PipControls.fromJson(Map<String, dynamic>? json) {
  if (json == null) return const PipControls();
  return PipControls(
    draggable: optBool(json, 'draggable', true),
    snapToCorner: optBool(json, 'snapToEdge', true),
    showClose: optBool(json, 'showClose', true),
    showMute: optBool(json, 'showMute', true),
    showPlayPause: optBool(json, 'showPlayPause', false),
    showProgress: optBool(json, 'showProgress', false),
    showExpand: optBool(json, 'showExpand', true),
    showCollapse: optBool(json, 'showCollapse', true),
    iconSize: optDouble(json, 'iconSize', 16).clamp(10, 24),
    margin: PipEdges.fromJsonWithDefault(
      optMap(json, 'marginDp'),
      const PipEdges(top: 4, right: 4, bottom: 4, left: 4),
    ),
  );
}