1/* 2 * Copyright (c) 2022-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 16@Component 17export default struct SendMessage { 18 @Link message: string 19 private sendMessage: () => void 20 21 build() { 22 Row() { 23 TextArea({ placeholder: this.message, text: this.message }) 24 .height(50) 25 .fontSize(25) 26 .id('text_input') 27 .layoutWeight(3) 28 .backgroundColor(Color.White) 29 .margin({ left: 2, right: 2 }) 30 .onChange((value: string) => { 31 this.message = value; 32 }) 33 34 Button() { 35 Text($r('app.string.send_message')) 36 .fontSize(23) 37 .fontColor(Color.White) 38 } 39 .id('btn_send') 40 .height(50) 41 .layoutWeight(1) 42 .borderRadius(10) 43 .type(ButtonType.Normal) 44 .backgroundColor('#ffadf58e') 45 .margin({ left: 2, right: 2 }) 46 .onClick(() => { 47 this.sendMessage(); 48 }) 49 } 50 .height(70) 51 .width('100%') 52 .backgroundColor('#f5f5f5') 53 } 54}