1/* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16const LOADINGPROGRESS_SIZE = 24 17const DEFAULT_MARGIN = 16 18const ITEM_SPACE = 4 19 20@Component 21export struct SwipeRefresher { 22 @Prop 23 content: string = null 24 @Prop 25 isLoading: boolean = false; 26 27 build() { 28 Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { 29 if (this.isLoading) { 30 LoadingProgress() 31 .height(LOADINGPROGRESS_SIZE) 32 .width(LOADINGPROGRESS_SIZE) 33 .margin({ 34 right: ITEM_SPACE 35 }) 36 } 37 Text(this.content) 38 .fontColor($r('sys.color.ohos_id_color_text_secondary')) 39 .fontSize($r('sys.float.ohos_id_text_size_body2')) 40 .padding({ 41 top: DEFAULT_MARGIN, 42 bottom: DEFAULT_MARGIN 43 }) 44 } 45 } 46}