Panel.forContent constructor

Panel.forContent(
  1. int width,
  2. int height, {
  3. Color? background,
  4. int padding = 0,
})

Create a Panel that is sized for the given content width and height, taking the given padding into consideration. The resulting panel will be positioned at (0, 0), so use a child Terminal to render it at the desired location.

See Terminal.childRect

Implementation

factory Panel.forContent(int width, int height,
    {Color? background, int padding = 0}) {
  var bounds =
      Rect(Vec2(0, 0), Vec2(width + (padding * 2), height + (padding * 2)));
  return Panel(bounds, background: background, padding: padding);
}