buildUseCase method
Wraps use cases with a custom widget depending on the addon setting
that is obtained from valueFromQueryGroup.
Implementation
@override
Widget buildUseCase(
BuildContext context,
Widget child,
DeviceFrameSetting setting,
) {
if (setting.device is NoneDevice) {
return child;
}
return Padding(
padding: const EdgeInsets.all(32),
child: Center(
child: DeviceFrame(
orientation: setting.orientation,
device: setting.device,
isFrameVisible: setting.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, _, __) => setting.hasFrame
? child
: SafeArea(
child: child,
),
),
),
),
),
);
}