build method

  1. @override
Widget build(
  1. BuildContext context,
  2. Widget child
)

Implementation

@override
Widget build(BuildContext context, Widget child) {
  if (value.device is NoneDevice) {
    return child;
  }

  return Padding(
    padding: const EdgeInsets.all(32),
    child: Center(
      child: DeviceFrame(
        orientation: value.orientation,
        device: value.device,
        isFrameVisible: value.hasFrame,
        // A navigator below the device frame is necessary to make
        // the popup routes (e.g. dialogs and bottom sheets) work within
        // the device frame, otherwise they would use the navigator from
        // the app builder, causing these routes to fill the whole
        // workbench and not just the device frame.
        screen: Navigator(
          onGenerateRoute: (_) => PageRouteBuilder(
            pageBuilder: (context, _, __) => value.hasFrame
                ? child
                : SafeArea(
                    child: child,
                  ),
          ),
        ),
      ),
    ),
  );
}