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 backdrop = GestureDetector(
    onTap: dismissible ? () => onDismiss?.call() : null,
    child: Opacity(
      opacity: backdropOpacity,
      child: Container(color: backdropColor ?? theme.background),
    ),
  );

  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: [child, backdrop, positioned]);
}