CustomRefreshLoadLayout.ets 902 Bytes
import { RefreshConstants } from '../../utils/RefreshConstants';
import { RefreshLayoutBean } from './RefreshLayoutBean';

/**
 * Custom layout to show refresh or load.
 */
@Component
export default struct CustomLayout {
  @ObjectLink refreshBean: RefreshLayoutBean;

  build() {
    Row() {
      Image(this.refreshBean.imageSrc)
        .width(RefreshConstants.RefreshLayout_IMAGE_WIDTH)
        .height(RefreshConstants.RefreshLayout_IMAGE_HEIGHT)

      Text(this.refreshBean.textValue)
        .margin({
          left: RefreshConstants.RefreshLayout_TEXT_MARGIN_LEFT,
          bottom: RefreshConstants.RefreshLayout_TEXT_MARGIN_BOTTOM
        })
        .fontSize(RefreshConstants.RefreshLayout_TEXT_FONT_SIZE)
        .textAlign(TextAlign.Center)
    }
    .clip(true)
    .width(RefreshConstants.FULL_WIDTH)
    .justifyContent(FlexAlign.Center)
    .height(this.refreshBean.heightValue)
  }
}