createComponent method
Widget?
createComponent(
- SingleColumnDocumentComponentContext componentContext,
- SingleColumnLayoutComponentViewModel componentViewModel
override
Creates a visual component that renders the given viewModel,
or returns null if this builder doesn't apply to the given viewModel.
Returned widgets should be StatefulWidgets that mix in DocumentComponent.
This method might be invoked with a type of viewModel that it
doesn't know how to work with. When this happens, the method should
return null, indicating that it doesn't know how to build a component
for the given viewModel.
See ComponentContext for expectations about how to use the context
to build a component widget.
Implementation
@override
Widget? createComponent(
SingleColumnDocumentComponentContext componentContext, SingleColumnLayoutComponentViewModel componentViewModel) {
if (componentViewModel is! TaskComponentViewModel) {
return null;
}
return ExpandingTaskComponent(
key: componentContext.componentKey,
viewModel: componentViewModel,
);
}