• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-3633

common/12-May-2024-3,5943,420

product/12-May-2024-2,6202,218

screenshots/devices/zh/12-May-2024-

.gitignoreD12-May-2024124 99

README.mdD12-May-20242.8 KiB5025

README_zh.mdD12-May-20242.5 KiB5125

build-profile.json5D12-May-20241.1 KiB4645

hvigorfile.jsD12-May-2024168 21

package.jsonD12-May-2024376 1918

README.md

1# Weather
2
3### Introduction
4
5This sample demonstrates one-time development for multi-device deployment by showing how to develop a weather app and deploy it across different devices. The demo app includes the following: home page, **Manage City** page, **Add City** page, and **Update Time** page.
6
7**How to Implement**
8
91. Use the grid breakpoint system of responsive layout to implement different display effects on windows of different sizes.
10
112. Use [SideBarContainer](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md) to implement the sidebar.
12
133. Use [GridRow](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/arkui-ts/ts-container-gridrow.md) to implement content split and display.
14
154. Use **Canvas** and **CanvasRenderingContext2D** to draw curves that show the air quality and sunrise and sunset.
16
17**How to Use**
18
191. After the demo app is started, weather information of the added cities is displayed on the home page. By default, two cities are present. You can swipe left or right to switch between them. The sidebar is displayed by default on a large-screen (LG) device. When the sidebar is displayed, the content area occupies 2/3 of the screen; when the sidebar is hidden, the content area automatically extends to full screen.
20
212. On a device that supports free window dragging, you can drag the window to the maximum width to show the sidebar. In this case, you can tap the sidebar control button to hide or display the sidebar. If you resize the window to MD through dragging, the sidebar and sidebar control buttons will be hidden.
22
233. On a device that supports window dragging, the weather content area is automatically adapted to the window size while you're dragging the window.
24
254. Touch the menu button in the upper right corner and tap **Update Time**. The **Update Time** page is displayed. This page has two columns on a tablet and one column on a small-screen device.
26
275. Touch the menu button in the upper right corner and tap **Manage Cities**. The **Manage Cities** page is displayed, showing the cities you've added. This page has two columns on a tablet and one column on a small-screen device like phone.
28
296. Touch **Add City** on the **Manage Cities** page. On the **Add City** page displayed, tap any city that has not been added before. The city will be added to the city list and the **Manage Cities** page will be displayed.
30
31Display Effect
32
33![home](./screenshots/devices/zh/home.png)
34
35### Required Permissions
36
37N/A
38
39### Dependency
40
41N/A
42
43###  Constraints
44
451. This sample can only be run on standard-system devices.
46
472. This sample demonstrates the stage model, which supports only the SDK of API version 9 (SDK version: 3.2.5.5 Beta2).
48
493. DevEco Studio 3.0 Beta4 (Build version: 3.0.0.992, built on July 14, 2022) must be used.
50

README_zh.md

1# 一多天气
2
3### 介绍
4
5本示例展示一个天气应用界面,包括首页、城市管理、添加城市、更新时间弹窗,体现一次开发,多端部署的能力。
6
7实现:
8
91.本示例参考[一次开发,多端部署](https://gitee.com/openharmony/docs/tree/master/zh-cn/application-dev/key-features/multi-device-app-dev)的指导,主要使用响应式布局的栅格断点系统实现在不同尺寸窗口界面上不同的显示效果。
10
112.使用[SideBarContainer](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md)实现侧边栏功能。
12
133.使用[栅格容器组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md)实现界面内容的分割和展示。
14
154.使用Canvas和CanvasRenderingContext2D完成空气质量和日出月落图的曲线绘制。
16
17使用说明:
18
191.启动应用后,首页展示已添加城市的天气信息,默认展示2个城市,左右滑动可以切换城市,在LG设备上,默认显示侧边栏,侧边栏显示时,右侧内容区占2/3,侧边栏隐藏时,内容区自动铺满界面。
20
212.在支持窗口自由拖拽的设备上,拖拽窗口大小,可以分别实现拖动到最大窗口侧边栏显示(点击侧边栏控制按钮可以隐藏和显示侧边栏),拖动窗口缩小到MD大小时侧边栏和侧边栏控制按钮隐藏。
22
233.在支持窗口自由拖拽的设备上,拖拽窗口大小,天气内容区跟随窗口大小会自动换行显示。
24
254.点击右上角菜单按钮,在菜单中点击**更新时间**,弹出更新时间弹窗,没有功能,此处只做展示,在平板设备上显示2列,在小屏设备上显示一列。
26
275.点击右上角菜单按钮,在菜单中点击**管理城市**,进入管理城市界面,展示已添加的城市,在平板设备上显示2列,在小屏设备上显示一列。
28
296.点击管理城市界面的**添加城市**,进入添加城市界面,已添加的城市不可点击,未添加的城市点击可以添加并返回管理城市界面显示。
30
31效果预览:
32
33![home](./screenshots/devices/zh/home.png)
34
35### 相关权限
36
37不涉及。
38
39### 依赖
40
41不涉及。
42
43###  约束与限制
44
451.本示例仅支持标准系统上运行。
46
472.本示例仅支持API9版本SDK,版本号:3.2.5.5 Beta2。
48
493.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
50
51