yourWidget method

  1. @override
Widget yourWidget(
  1. BuildContext context,
  2. BookletModel? value
)
override

Implementation

@override
Widget yourWidget(BuildContext context, BookletModel? value) {
  //var accessState = AccessBloc.getState(context);
  var documentParameterProcessor = ExtendedDocumentParameterProcessor(
    context,
    app,
  );

  var groupedWidgets = <Widget>[];

  for (var element in value!.sections!) {
    var widgets = <Widget>[];
    widgets.add(h3(app, context,
        documentParameterProcessor.process(element.title ?? '')));
    widgets.add(_aBitSpace());
    widgets.add(text(app, context,
        documentParameterProcessor.process(element.description ?? '')));
    widgets.add(_aBitSpace());
    if (element.links != null && element.links!.isNotEmpty) {
      var children = <Widget>[];
      for (var link in element.links!) {
        children.add(button(
          app,
          context,
          label: link.linkText!,
          onPressed: () {
            er.Router.navigateTo(context, link.action!);
          },
        ));
      }
      widgets.add(Wrap(
        spacing: 8.0,
        runSpacing: 8.0,
        alignment: WrapAlignment.center,
        runAlignment: WrapAlignment.start,
        crossAxisAlignment: WrapCrossAlignment.center,
        children: children,
      ));
      widgets.add(_aBitSpace());
    }

    groupedWidgets.add(_addImage(
        context,
        widgets,
        element.image,
        element.imagePositionRelative,
        element.imageAlignment,
        element.imageWidth));
  }

  return ListView(
      padding: EdgeInsets.all(10),
      shrinkWrap: true,
      physics: ScrollPhysics(),
      children: groupedWidgets);
}