getValueWidget method
dynamic
getValueWidget(
- MapEntry entry
)
Implementation
getValueWidget(MapEntry entry) {
if (entry.value == null) {
return const Expanded(
child: JSONText(
'undefined',
style: TextStyle(color: Colors.grey),
value: 'undefined',
));
} else if (entry.value is int) {
return Expanded(
child: JSONText(
entry.value.toString(),
style: const TextStyle(color: Colors.teal),
value: entry.value,
));
} else if (entry.value is String) {
return Expanded(
child: JSONText(
// ignore: unnecessary_string_escapes
'\"' + entry.value + '\"',
style: const TextStyle(color: Colors.redAccent),
value: entry.value,
));
} else if (entry.value is bool) {
return Expanded(
child: JSONText(
entry.value.toString(),
style: const TextStyle(color: Colors.purple),
value: entry.value,
));
} else if (entry.value is double) {
return Expanded(
child: JSONText(
entry.value.toString(),
style: const TextStyle(color: Colors.teal),
value: entry.value,
));
} else if (entry.value is List) {
if (entry.value.isEmpty) {
return const JSONText(
'Array[0]',
style: TextStyle(color: Colors.grey),
value: 'Array[0]',
);
} else {
return InkWell(
child: JSONText(
'Array<${getTypeName(entry.value[0])}>[${entry.value.length}]',
style: const TextStyle(color: Colors.grey),
value: entry.value,
),
onTap: () {
setState(() {
openFlag[entry.key] = !(openFlag[entry.key] ?? false);
});
});
}
}
return InkWell(
child: JSONText(
'Object',
style: const TextStyle(color: Colors.grey),
value: entry.value,
),
onTap: () {
setState(() {
openFlag[entry.key] = !(openFlag[entry.key] ?? false);
});
});
}