$UikAppBarPropsFromJson function
Implementation
UikAppBarProps $UikAppBarPropsFromJson(Map<String, dynamic> json) {
final UikAppBarProps uikAppBarProps = UikAppBarProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikAppBarProps.id = id;
}
final UikAction? action = jsonConvert.convert<UikAction>(json['action']);
if (action != null) {
uikAppBarProps.action = action;
}
final String? centerText = jsonConvert.convert<String>(json['centerText']);
if (centerText != null) {
uikAppBarProps.centerText =
UikText(WidgetType.UikText, UikTextProps.fromJson(json['centerText']));
}
final bool? centerTitle = jsonConvert.convert<bool>(json['centerTitle']);
if (centerTitle != null) {
uikAppBarProps.centerTitle = centerTitle;
}
final String? rightElement =
jsonConvert.convert<String>(json['rightElement']);
if (rightElement != null) {
if (json["rightElement"]["id"] == "text") {
uikAppBarProps.rightElement = UikText(
WidgetType.UikText, UikTextProps.fromJson(json['rightElement']));
} else if (json["rightElement"]["id"] == "icon") {
uikAppBarProps.rightElement = UikIcon(
WidgetType.UikText, UikIconProps.fromJson(json['rightElement']));
} else if (json["rightElement"]["id"] == "image") {
uikAppBarProps.rightElement = UikImage(
WidgetType.UikImage, UikImageProps.fromJson(json["rightElement"]));
} else {
uikAppBarProps.rightElement = null;
}
}
final String? leadingIcon = jsonConvert.convert<String>(json['leadingIcon']);
if (leadingIcon != null) {
uikAppBarProps.leadingIcon =
UikIcon(WidgetType.UikText, UikIconProps.fromJson(json['leadingIcon']));
}
final double? sideMargin = jsonConvert.convert<double>(json['sideMargin']);
if (sideMargin != null) {
uikAppBarProps.sideMargin = sideMargin;
}
final double? topMargin = jsonConvert.convert<double>(json['topMargin']);
if (topMargin != null) {
uikAppBarProps.topMargin = topMargin;
}
final double? bottomMargin =
jsonConvert.convert<double>(json['bottomMargin']);
if (bottomMargin != null) {
uikAppBarProps.bottomMargin = bottomMargin;
}
return uikAppBarProps;
}