getValueWidget method

Widget getValueWidget(
  1. MapEntry entry
)

Implementation

Widget getValueWidget(MapEntry entry) {
  if (entry.value == null) {
    return Expanded(
      child: Text('undefined', style: TextStyle(color: Colors.grey)),
    );
  } else if (entry.value is int) {
    return Expanded(
      child: Text(
        entry.value.toString(),
        style: TextStyle(color: Colors.teal),
      ),
    );
  } else if (entry.value is String) {
    return Expanded(
      child: Text(
        '\"' + entry.value + '\"',
        style: TextStyle(color: Colors.redAccent),
      ),
    );
  } else if (entry.value is bool) {
    return Expanded(
      child: Text(
        entry.value.toString(),
        style: TextStyle(color: Colors.purple),
      ),
    );
  } else if (entry.value is double) {
    return Expanded(
      child: Text(
        entry.value.toString(),
        style: TextStyle(color: Colors.teal),
      ),
    );
  } else if (entry.value is List) {
    if (entry.value.isEmpty) {
      return Text(
        'Array[0]',
        style: TextStyle(color: Colors.black54),
      );
    } else {
      return InkWell(
        child: Text(
          'Array<${getTypeName(entry.value[0])}>[${entry.value.length}]',
          style: TextStyle(color: Colors.black54),
        ),
        onTap: () => _toggleOpenFlag(entry.key),
      );
    }
  }
  return InkWell(
    child: Text('Object', style: TextStyle(color: Colors.black54)),
    onTap: () => _toggleOpenFlag(entry.key),
  );
}