ViQueryProductLayout

open class ViQueryProductLayout: StackLayout<UIView>

This is almost the same as product card used for displaying the search query product i.e. the product that is being searched during Find Similar the product info are displayed on the right of the image (for product card in search results, the info is displayed below image)

  • Undocumented

    Declaration

    Swift

    open class ViQueryProductLayout: StackLayout<UIView>
  • constructor helper

    Declaration

    Swift

    public convenience init(
            imgUrl: URL?, imageConfig: ViImageConfig,
            heading: String? , headingConfig: ViLabelConfig = ViLabelConfig(),
            label: String? = nil, labelConfig: ViLabelConfig = ViLabelConfig.default_label_config,
            price: Float?, priceConfig: ViLabelConfig = ViLabelConfig.default_price_config,
            discountPrice : Float?,
            discountPriceConfig: ViLabelConfig = ViLabelConfig.default_discount_price_config,
            pricesHorizontalSpacing: CGFloat = ViProductCardLayout.default_spacing,
            labelLeftPadding: CGFloat = ViProductCardLayout.default_spacing
            )
  • Constructor for query product card

    • Parameters:
      • img_url: product image url
      • img_size: product image size
      • img_contentMode: contentMode for ImageView
      • loading_img: loading/placeholder image
      • err_img: error image (when fail to download)
      • label: label text e.g. to display product brand
      • label_font: label font, default to Roboto Bold
      • label_text_color: label text color, default to black
      • label_num_of_lines: number of lines for label, default 1 line
      • heading: heading text e.g. to display product name or title
      • heading_font: heading font , default to Roboto Regular
      • heading_text_color: heading text color, default to black
      • heading_num_of_lines: number of lines for heading label, default 1 line
      • price: product price
      • price_font: product price font, default to Roboto Regular
      • price_text_color: product price label text color, default to red color
      • price_string_format: string format to display price, must include .f specifier e.g. %.2f
      • price_strike_through: whether to strike through the price e.g. during discount, default to no
      • discounted_price: discounted product price
      • discounted_price_font: discounted price label font , default to Roboto Regular
      • discounted_price_text_color: discounted price label text color , default to gray color and strike through
      • discounted_price_string_format: string format to display discounted price, must include .f specifier e.g. %.2f
      • discounted_price_strike_through: whether to strike through discounted price label, default to no
      • prices_horizontal_spacing: spacing between price and discounted price label
      • label_left_padding: padding of labels from parent left

    Declaration

    Swift

    public init(
            // image settings
            img_url: URL?,
            img_size: CGSize,
            img_contentMode: UIViewContentMode = ViImageConfig.default_content_mode,
            loading_img: UIImage? = nil,
            err_img: UIImage? = nil,
            
            // label
            label: String? = nil,
            label_font: UIFont = ViTheme.sharedInstance.default_bold_font,
            label_text_color: UIColor = ViTheme.sharedInstance.default_txt_color,
            label_num_of_lines: Int = 1,
            
            // heading
            heading: String? = nil,
            heading_font: UIFont = ViTheme.sharedInstance.default_font,
            heading_text_color: UIColor = ViTheme.sharedInstance.default_txt_color,
            heading_num_of_lines: Int = 1,
            
            
            // price
            price: Float?,
            price_font : UIFont = ViTheme.sharedInstance.default_font,
            price_text_color: UIColor = ViTheme.sharedInstance.default_txt_color,
            price_string_format: String = ViTheme.sharedInstance.default_price_format,
            price_strike_through: Bool = false,
            
            // discount price
            discounted_price : Float?,
            discounted_price_font : UIFont = ViTheme.sharedInstance.default_font,
            discounted_price_text_color: UIColor = ViTheme.sharedInstance.default_discounted_price_text_color,
            discounted_price_string_format: String = ViTheme.sharedInstance.default_discount_price_format,
            discounted_price_strike_through: Bool = false,
            
            // spacing
            prices_horizontal_spacing: CGFloat = default_spacing,
            label_left_padding: CGFloat = default_spacing
            
            )

    Parameters

    img

    _url: product image url

    img

    _size: product image size

    img

    _contentMode: contentMode for ImageView

    loading

    _img: loading/placeholder image

    err

    _img: error image (when fail to download)

    label

    label text e.g. to display product brand

    label

    _font: label font, default to Roboto Bold

    label

    _text_color: label text color, default to black

    label

    _num_of_lines: number of lines for label, default 1 line

    heading

    heading text e.g. to display product name or title

    heading

    _font: heading font , default to Roboto Regular

    heading

    _text_color: heading text color, default to black

    heading

    _num_of_lines: number of lines for heading label, default 1 line

    price

    product price

    price

    _font: product price font, default to Roboto Regular

    price

    _text_color: product price label text color, default to red color

    price

    _string_format: string format to display price, must include .f specifier e.g. %.2f

    price

    _strike_through: whether to strike through the price e.g. during discount, default to no

    discounted

    _price: discounted product price

    discounted

    _price_font: discounted price label font , default to Roboto Regular

    discounted

    _price_text_color: discounted price label text color , default to gray color and strike through

    discounted

    _price_string_format: string format to display discounted price, must include .f specifier e.g. %.2f

    discounted

    _price_strike_through: whether to strike through discounted price label, default to no

    prices

    _horizontal_spacing: spacing between price and discounted price label

    label

    _left_padding: padding of labels from parent left