getValueWidget method
dynamic
getValueWidget(
- MapEntry entry
)
Implementation
getValueWidget(MapEntry entry) {
if (entry.value == null) {
return Expanded(
child: Text(
'undefined',
style: widget.theme.nullValueTextStyle,
),
);
} else if (entry.value is int) {
return Expanded(
child: Text(
entry.value.toString(),
style: widget.theme.intValueTextStyle,
),
);
} else if (entry.value is String) {
return Expanded(
child: Text(
'"${entry.value}"',
style: widget.theme.stringValueTextStyle,
),
);
} else if (entry.value is bool) {
return Expanded(
child: Text(
entry.value.toString(),
style: widget.theme.boolValueTextStyle,
),
);
} else if (entry.value is double) {
return Expanded(
child: Text(
entry.value.toString(),
style: widget.theme.doubleValueTextStyle,
),
);
} else if (entry.value is List) {
if (entry.value.isEmpty) {
return Text(
'Array[0]',
style: widget.theme.arrayValueTextStyle,
);
} else {
return InkWell(
child: Text(
'Array<${getTypeName(entry.value[0])}>[${entry.value.length}]',
style: widget.theme.arrayValueTextStyle,
),
onTap: () {
setState(() {
openFlag[entry.key] = !(openFlag[entry.key] ?? false);
});
},
);
}
}
return InkWell(
child: Text(
'Object',
style: widget.theme.objectValueTextStyle,
),
onTap: () {
setState(() {
openFlag[entry.key] = !(openFlag[entry.key] ?? false);
});
},
);
}