buildRadio method

Widget buildRadio(
  1. BuildContext context
)

Implementation

Widget buildRadio(BuildContext context) {
  String? title = widget.schema["title"];
  dynamic description = widget.schema["description"];

  return Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      title != null ? Text(title) : Container(),
      title != null ? const SizedBox(height: 8) : Container(),
      Wrap(
        crossAxisAlignment: WrapCrossAlignment.start,
        direction: Axis.horizontal,
        spacing: 8,
        children: widget.enumeration!.map(
          (String element) {
            return IntrinsicWidth(
              child: RadioListTile<String>(
                value: element,
                groupValue: value,
                dense: true,
                title: Text(
                  element,
                  style: const TextStyle(fontSize: 16),
                ),
                onChanged: widget.options?["readonly"] == true
                    ? null
                    : (val) {
                        onValueChanged(val ?? "");
                      },
              ),
            );
          },
        ).toList(),
      ),
      description != null ? const SizedBox(height: 8) : Container(),
      description != null
          ? MarkdownBody(
              data: description["text"],
              onTapLink: (text, href, title) {
                launchUrl(Uri.parse(href!));
              },
              styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context))
                  .copyWith(
                      p: Theme.of(context)
                          .textTheme
                          .headline1
                          ?.copyWith(fontSize: description["size"] ?? 14.0)),
            )
          : Container(),
    ],
  );
}