1/* 2 * Copyright (c) 2022 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@Component 16export struct InputComponent { 17 @Link result: string 18 @Link expression: string 19 private isLand: boolean = false 20 21 build() { 22 Stack({ alignContent: this.isLand ? Alignment.BottomStart : Alignment.TopEnd }) { 23 Column() { 24 Row() { 25 Text(this.expression) 26 .margin({ top: '3%' }) 27 .height('100%') 28 .width('100%') 29 .id('expression') 30 .opacity(0.9) 31 .fontWeight(400) 32 .textAlign(TextAlign.Start) 33 .fontSize(this.isLand ? '50px' : '35px') 34 } 35 .height('48%') 36 .width('90%') 37 .align(this.isLand ? Alignment.End : Alignment.Start) 38 Row() { 39 Text(this.result) 40 .margin({ top: '1%' }) 41 .height('100%') 42 .width('100%') 43 .id('result') 44 .opacity(0.38) 45 .textAlign(TextAlign.Start) 46 .fontSize(this.isLand ? '50px' : '31px') 47 .margin(this.isLand ? { bottom: 64 } : {}) 48 } 49 .height('46%') 50 .width('90%') 51 .align(this.isLand ? Alignment.End : Alignment.Start) 52 } 53 .width('100%') 54 .align(Alignment.Center) 55 } 56 .width(this.isLand ? '34%' : '100%') 57 .height(this.isLand ? '100%' : '34%') 58 } 59}