builder method
Implementation
@override
Widget builder({BuildContext? context, TemplateData? data, Widget? app}) {
final shouldDisplayTemplate = MediaQuery.of(context!).size.width > 600;
Widget content =
isScreenshot ? _ScreenshotContent(data: data) : _Content(data: data);
if (!shouldDisplayTemplate) {
return AppWithDrawer(
child: app,
drawer: content,
theme: data!.theme,
);
} else {
final sizedChild = Center(child: SizedBox(height: 896, child: content));
final children = reverse == true
? [
Flexible(
flex: 2,
key: Key('Preview'),
child: Align(alignment: Alignment.centerRight, child: app)),
SizedBox(width: 80),
Flexible(flex: 1, child: sizedChild),
]
: [
Expanded(flex: 2, child: sizedChild),
SizedBox(width: 80),
Flexible(flex: 1, key: Key('Preview'), child: app!),
];
return Scaffold(
backgroundColor: data!.theme!.backgroundColor,
body: Layout(
child: Builder(
builder: (context) => Padding(
padding: EdgeInsets.symmetric(vertical: 40),
child: Material(
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children),
),
),
),
),
);
}
}