getValueWidget method
dynamic
getValueWidget(
- MapEntry entry
)
Implementation
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.grey),
);
} else {
return InkWell(
child: Text(
'Array<${getTypeName(entry.value[0])}>[${entry.value.length}]',
style: TextStyle(color: Colors.grey),
),
onTap: () {
setState(() {
openFlag[entry.key] = !(openFlag[entry.key] ?? false);
});
});
}
}
return InkWell(
child: Text(
'Object',
style: TextStyle(color: Colors.grey),
),
onTap: () {
setState(() {
openFlag[entry.key] = !(openFlag[entry.key] ?? false);
});
});
}