yourWidget method

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

Implementation

@override
Widget yourWidget(BuildContext context, TutorialModel? value) {
  DocumentParameterProcessor documentParameterProcessor =
      ExtendedDocumentParameterProcessor(
    context,
    app,
  );
  var widgets = <Widget>[];
  widgets.add(Text(
    documentParameterProcessor.process(value!.title!),
    style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
  ));
  widgets.add(_aBitSpace());
  for (var element in value.tutorialEntries!) {
    widgets.add(Text(
      documentParameterProcessor.process(element.description!),
    ));
    widgets.add(_aBitSpace());
    if (element.image != null) {
      widgets.add(GestureDetector(
        child: FadeInImage.memoryNetwork(
          placeholder: kTransparentImage,
          image: element.image!.url!,
        ),
        onTap: () {
          Navigator.push(context,
              pageRouteBuilder(app, page: FulLScreen(element.image)));
        },
      ));

      widgets.add(Center(
          child: button(app, context, label: 'Fullscreen', onPressed: () {
        Navigator.push(
            context, pageRouteBuilder(app, page: FulLScreen(element.image)));
      })));

      widgets.add(_aBitSpace());
    }
    if (element.code != null) {
      widgets.add(
          MarkdownBody(selectable: true, data: '```\n${element.code!}```'));
      widgets.add(Center(
          child: button(
        app,
        context,
        label: 'Copy to clipboard',
        onPressed: () {
          Clipboard.setData(ClipboardData(text: element.code ?? ''));
        },
      )));
      widgets.add(_aBitSpace());
    }
  }

  return ListView(padding: EdgeInsets.all(10), children: [
    Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      mainAxisAlignment: MainAxisAlignment.start,
      mainAxisSize: MainAxisSize.max,
      textBaseline: TextBaseline.alphabetic,
      textDirection: TextDirection.ltr,
      verticalDirection: VerticalDirection.down,
      children: widgets,
    )
  ]);
}