build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Describes the part of the UI represented by this widget.

Implementation

@override
Widget build(BuildContext context) {
  if (!open) return child;
  final theme = ThemeScope.of(context);
  final dimmedChild = backdropOpacity > 0.0
      ? Tint(
          color: backdropColor ?? theme.background,
          opacity: backdropOpacity,
          child: child,
        )
      : child;

  final dismissLayer = dismissible
      ? GestureDetector(onTap: () => onDismiss?.call(), child: Container())
      : Container();

  final panel = SizedBox(width: width, child: drawer);
  final positioned = side == SidebarSide.left
      ? Positioned(left: 0, top: 0, bottom: 0, width: width, child: panel)
      : Positioned(right: 0, top: 0, bottom: 0, width: width, child: panel);

  return Stack(
    fit: StackFit.expand,
    children: [
      IgnorePointer(ignoring: true, child: dimmedChild),
      Positioned(
        left: 0,
        right: 0,
        top: 0,
        bottom: 0,
        child: dismissLayer,
      ),
      positioned,
    ],
  );
}