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