From beb842566a09fe23d58d8aa873abd2025d70720c Mon Sep 17 00:00:00 2001 From: gxzmf <279822581@qq.com> Date: Fri, 20 Sep 2024 20:16:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=8B=B1=E6=96=87=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gxzmf <279822581@qq.com> --- OAT.xml | 2 +- README.en.md | 80 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 51 insertions(+), 31 deletions(-) diff --git a/OAT.xml b/OAT.xml index c931dd5d..c14e3e77 100644 --- a/OAT.xml +++ b/OAT.xml @@ -136,7 +136,7 @@ - + diff --git a/README.en.md b/README.en.md index f169e36d..b12fb249 100644 --- a/README.en.md +++ b/README.en.md @@ -1,33 +1,53 @@ -## Warehouse introduction - -This warehouse is based on the upstream Flutter community [samples warehouse] (https://github.com/flutter/samples/), based on commitId: d010d3fae62e2bec36614c9b17e9a86e78a65575. - -This repository mainly adds sample code for the OpenHarmony platform. - -## New examples have been added to the OpenHarmony platform - -| Warehouse name | Dependency path | Description | -| ----- | ----------------------------------------------- -- | ----- | -| flutter_music_player | flutter_music_player | music player | -| flutter_smart_agriculture | flutter_smart_agriculture | smart farm | -| async_test | ohos/async_test | Asynchronous call demo | -| dio_test | ohos/dio_test | dio demo | -| event_bus_test | ohos/event_bus_test | event-driven demo | -| flutter_svg_test | ohos/flutter_svg_test | svg picture demo | -| http_parser_test | ohos/http_parser_test | http parsing demo | -| http_test | ohos/http_test | http demo | -| path_drawing_test | ohos/path_drawing_test | Path drawing demo | -| platform_test | ohos/platform_test | Platform call demo | -| rxdart_test | ohos/rxdart_test | rxdart demo | -| string_scanner_test | ohos/string_scanner_test | Character scanning demo | -| testchat | ohos/testchat | Chat scene demo | -| tuple_test | ohos/tuple_test | tuple demo | -| uuid_test | ohos/uuid_test | uuid demo | -| vector_match_test | ohos/vector_match_test | Vector matching demo | +## Repository Description + +This repository is extended from the [samples](https://github.com/flutter/samples/) repository of the commit ID d010d3fae62e2bec36614c9b17e9a86e78a65575 in the upstream Flutter community. + +The sample codes of OpenHarmony are added to this repository. + +## Added Sample Codes + +| Repository Name| Dependency Path| Description| +| ----- | ------ | ------------------------------------------- | +| [flutter_music_player](https://gitee.com/openharmony-sig/flutter_samples/tree/master/flutter_music_player) | flutter_music_player | Music player with features such as automatic playback and progress bar dragging.| +| [flutter_smart_agriculture](https://gitee.com/openharmony-sig/flutter_samples/tree/master/flutter_smart_agriculture) | flutter_smart_agriculture | Smart agriculture.| +| [async_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/async_test) | ohos/async_test | Asynchronous callback demo.| +| [channel_demo](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/channel_demo) | ohos/channel_demo | Channel test demo, used to view the return values of the **EventChannel**, **MethodChannel**, and **BasicMessageChannel** methods.| +| [clock_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/clock_test) | ohos/clock_test | Timer demo, used to time and view timing records and detailed data.| +| [dio_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/dio_test) | ohos/dio_test | Test demo set.| +| [event_bus_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/event_bus_test) | ohos/event_bus_test | Event-driven demo.| +| [flutter_page_sample1](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/flutter_page_sample1) | ohos/flutter_page_sample1 | Page redirection demo.| +| [flutter_page_sample2](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/flutter_page_sample2) | ohos/flutter_page_sample2 | **FlutterEntry** usage sample.| +| [multiple_flutters_ohos](https://gitee.com/openharmony-sig/flutter_samples/tree/master/add_to_app/multiple_flutters) | add_to_app/multiple_flutters/multiple_flutters_ohos | **FlutterEngineGroup** usage sample.| +| [flutter_svg_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/flutter_svg_test)| ohos/flutter_svg_test | SVG image demo.| +| [http_parser_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/http_parser_test) | ohos/http_parser_test | HTTP parsing demo.| +| [http_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/http_test) | ohos/http_test | HTTP web page request demo.| +| [logging_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/logging_test) | ohos/logging_test | Logging demo.| +| [path_drawing_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/path_drawing_test) | ohos/path_drawing_test | Path drawing demo.| +| [pictures_provider_demo](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/pictures_provider_demo) | ohos/pictures_provider_demo | Image obtaining demo.| +| [platform_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/platform_test) | ohos/platform_test | Platform call demo.| +| [platformchannel_demo](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/platformchannel_demo) | ohos/platformchannel_demo | API test demo for multiple platform features.| +| [rxdart_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/rxdart_test) | ohos/rxdart_test | RxDart demo, used to process asynchronous events and data streams.| +| [string_scanner_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/string_scanner_test) | ohos/string_scanner_test | String scanning demo.| +| [testcamera](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/testcamera) | ohos/testcamera | Camera call demo.| +| [testchat](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/testchat) | ohos/testchat | Chat scenario demo.| +| [testpicture](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/testpicture) | ohos/testpicture | Image display demo.| +| [tuple_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/tuple_test) | ohos/tuple_test | Tuple demo, used to test parameters generated by the tuple.| +| [uuid_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/uuid_test) | ohos/uuid_test | UUID demo.| +| [vector_math_test](https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/vector_math_test) | ohos/vector_math_test | Vector matching demo.| -## How to run the sample code +## How to Run a Sample Code + +1. Build the Flutter engine that is compatible with OpenHarmony. For details, see https://gitee.com/openharmony-sig/flutter_engine/blob/master/README_EN.md. +2. Download the Flutter SDK that is compatible with OpenHarmony and configure the environment. For details, see https://gitee.com/openharmony-sig/flutter_flutter/blob/master/README_EN.md. +3. Go to the sample directory, for example, **flutter_music_player**, and run `flutter run --local-engine=`. + +## FAQs +### How do I use Dart code to determine whether the current platform is ohos? +```dart +import 'package:flutter/foundation.dart'; -1. Compile Flutter’s Engine that is compatible with OpenHarmony, reference: https://gitee.com/openharmony-sig/flutter_engine/blob/master/README.md -2. Download Flutter’s OpenHarmony-compatible SDK and configure the relevant environment. Reference: https://gitee.com/openharmony-sig/flutter_flutter/blob/master/README.md -3. Enter the sample directory, such as flutter_music_player, and run flutter run --local-engine=. \ No newline at end of file +bool isOhos() { + return defaultTargetPlatform == TargetPlatform.ohos; +} +``` -- Gitee