1 /* 2 * Copyright (c) 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_SHEET_STYLE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_SHEET_STYLE_H 18 19 #include <optional> 20 21 #include "base/geometry/dimension.h" 22 #include "core/components/common/properties/color.h" 23 #include "core/components/common/properties/decoration.h" 24 #include "core/components_ng/pattern/overlay/sheet_theme.h" 25 namespace OHOS::Ace::NG { 26 constexpr float SHEET_VELOCITY_THRESHOLD = 1000.0f; 27 constexpr float CURVE_MASS = 1.0f; 28 constexpr float CURVE_STIFFNESS = 328.0f; 29 constexpr float CURVE_DAMPING = 36.0f; 30 constexpr float MEDIUM_SIZE = 0.6f; 31 constexpr float MEDIUM_SIZE_PRE = 0.5f; 32 constexpr float POPUP_LARGE_SIZE = 0.9f; 33 enum SheetMode { 34 MEDIUM, 35 LARGE, 36 AUTO, 37 }; 38 39 enum SheetType { 40 SHEET_BOTTOM, 41 SHEET_CENTER, 42 SHEET_POPUP, 43 SHEET_BOTTOMLANDSPACE, 44 SHEET_BOTTOM_FREE_WINDOW, 45 }; 46 47 struct SheetHeight { 48 std::optional<Dimension> height; 49 std::optional<SheetMode> sheetMode; 50 51 bool operator==(const SheetHeight& sheetHeight) const 52 { 53 return (height == sheetHeight.height && sheetMode == sheetHeight.sheetMode); 54 } 55 }; 56 57 struct SheetStyle { 58 std::optional<Dimension> height; 59 std::optional<SheetMode> sheetMode; 60 std::optional<bool> showDragBar; 61 std::optional<bool> showCloseIcon; 62 std::optional<bool> isTitleBuilder; 63 std::optional<SheetType> sheetType; 64 std::optional<Color> backgroundColor; 65 std::optional<Color> maskColor; 66 std::optional<BlurStyleOption> backgroundBlurStyle; 67 std::optional<std::string> sheetTitle; 68 std::optional<std::string> sheetSubtitle; 69 std::vector<SheetHeight> detents; 70 std::optional<bool> interactive; 71 72 bool operator==(const SheetStyle& sheetStyle) const 73 { 74 return (height == sheetStyle.height && sheetMode == sheetStyle.sheetMode && 75 showDragBar == sheetStyle.showDragBar && showCloseIcon == sheetStyle.showCloseIcon && 76 isTitleBuilder == sheetStyle.isTitleBuilder && sheetType == sheetStyle.sheetType && 77 backgroundColor == sheetStyle.backgroundColor && maskColor == sheetStyle.maskColor && 78 detents == sheetStyle.detents && backgroundBlurStyle == sheetStyle.backgroundBlurStyle && 79 sheetTitle == sheetStyle.sheetTitle && sheetSubtitle == sheetStyle.sheetSubtitle && 80 interactive == sheetStyle.interactive); 81 } 82 }; 83 } // namespace OHOS::Ace::NG 84 85 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_SHEET_STYLE_H 86