renderScrollRailLayout function

Component renderScrollRailLayout(
  1. ScrollRailLayoutProps props
)

Renders a Codex scroll rail layout component.

Implementation

Component renderScrollRailLayout(ScrollRailLayoutProps props) {
  final railComponent = renderScrollRail(ScrollRailProps(
    position: props.railPosition,
    size: props.railSize,
    width: props.railWidth,
    topOffset: props.headerHeight,
    showBorder: props.showBorder,
    background: props.railBackground,
    scrollPersistenceId: 'main-rail',
    children: [props.rail],
  ));

  final mainContent = dom.div(
    styles: dom.Styles(raw: {
      'flex': '1',
      'min-width': '0',
      'background': props.contentBackground ?? 'var(--background)',
    }),
    [props.child],
  );

  return dom.div(
    styles: const dom.Styles(raw: {
      'display': 'flex',
      'min-height': '100vh',
      'width': '100%',
    }),
    props.railPosition == ScrollRailPosition.left
        ? [railComponent, mainContent]
        : [mainContent, railComponent],
  );
}