showModal method

void showModal(
  1. Component component, {
  2. String? top,
  3. String? left,
  4. String? bottom,
  5. String? right,
  6. double shading = 0.75,
})

Implementation

void showModal(Component component, {String? top, String? left, String? bottom, String? right, double shading = 0.75}) {
  onClick.listen((event) {
    close();
  });
  modalPanel.element.style.background = 'rgba(0, 0, 0, ${shading.toString()})';
  component.element.style.position = 'absolute';
  if (top != null) {
    component.element.style.top = top;
  } else {
    component.element.style.top = '';
  }
  if (left != null) {
    component.element.style.left = left;
  } else {
    component.element.style.left = '';
  }
  if (bottom != null) {
    component.element.style.bottom = bottom;
  } else {
    component.element.style.bottom = '';
  }
  if (right != null) {
    component.element.style.right = right;
  } else {
    component.element.style.right = '';
  }
  modalPanel
    ..clear()
    ..add(component)
    ..visible = true;
}