build method
Builds the layout for the content item. This transforms the content into a Flutter Widget.
Implementation
@override
Widget build(BuildContext context, OnboardingContent content) {
final pages = content.steps.map((step) {
return PageViewModel(
title: step.title,
body: step.description == null ? '' : null,
bodyWidget: step.description != null
? vyuh.content.buildContent(context, step.description!)
: null,
image: step.image != null
? ContentImage(
ref: step.image!,
fit: BoxFit.cover,
)
: null,
decoration: const PageDecoration(
pageMargin: EdgeInsets.all(0),
titlePadding: EdgeInsets.symmetric(vertical: 8),
imagePadding: EdgeInsets.only(bottom: 8),
contentMargin: EdgeInsets.all(8),
));
}).toList();
return LimitedBox(
maxHeight: 400,
child: IntroductionScreen(
pages: pages,
onDone: () => content.doneAction?.execute(context),
onSkip: () => content.doneAction?.execute(context),
next: const Icon(Icons.navigate_next),
done: const Text('Done'),
skip: const Text('Skip'),
showNextButton: true,
showSkipButton: true,
),
);
}