getValueWidget method

Widget getValueWidget(
  1. dynamic content,
  2. int index
)

Implementation

Widget getValueWidget(dynamic content, int index) {
  if (content == null) {
    return const Expanded(
        child: Text(
      'undefined',
      style: TextStyle(color: Colors.grey, fontSize: fontSize),
    ));
  } else if (content is int) {
    return Expanded(
        child: Text(
      content.toString(),
      style: const TextStyle(color: Colors.teal, fontSize: fontSize),
    ));
  } else if (content is String) {
    return Expanded(
        child: Text(
      '"$content"',
      style: const TextStyle(color: Colors.redAccent, fontSize: fontSize),
    ));
  } else if (content is bool) {
    return Expanded(
        child: Text(
      content.toString(),
      style: const TextStyle(color: Colors.purple, fontSize: fontSize),
    ));
  } else if (content is double) {
    return Expanded(
        child: Text(
      content.toString(),
      style: const TextStyle(color: Colors.teal, fontSize: fontSize),
    ));
  } else if (content is List) {
    return const Text(
      '[',
      style: TextStyle(color: Colors.grey, fontSize: fontSize),
    );
  }
  return const Text(
    '{',
    style: TextStyle(color: Colors.grey, fontSize: fontSize),
  );
}