flutter_samples_zhawei_samples:基于 Flutter 生态的 OpenHarmony 平台适配示例项目

开发者可通过本项目快速了解 OpenHarmony Flutter 开发流程,参考示例实现细节进行实践与验证。项目提供 OpenHarmony 平台适配示例及配套文档,覆盖应用开发、平台能力接入与工程实践,包含音乐播放器、智慧农场等场景化案例。【此简介由AI生成】

Branch5Tags8

Flutter Samples

Introduction

This repository extends Flutter's samples to provide OpenHarmony platform adaptation examples and supporting documentation, covering app development, platform capability integration, and engineering practices. Developers can quickly get started with Flutter on OpenHarmony and use these examples as references for implementation and validation.

Documentation

Framework Overview

Architecture

Environment Setup

Feature Development

Debugging & Testing

Performance Optimization

Third-Party Library Integration

Scenario-Based Examples

Sample Code

FAQ

Appendix

Added Sample Codes

Repository Name Dependency Path Description
flutter_music_player flutter_music_player Music player with features such as automatic playback and progress bar dragging.
flutter_smart_agriculture flutter_smart_agriculture Smart agriculture.
async_test ohos/async_test Asynchronous callback demo.
channel_demo ohos/channel_demo Channel test demo, used to view the return values of the EventChannel, MethodChannel, and BasicMessageChannel methods.
clock_test ohos/clock_test Timer demo, used to time and view timing records and detailed data.
dio_test ohos/dio_test Test demo set.
event_bus_test ohos/event_bus_test Event-driven demo.
flutter_page_sample1 ohos/flutter_page_sample1 Page redirection demo.
flutter_page_sample2 ohos/flutter_page_sample2 FlutterEntry usage sample.
multiple_flutters_ohos add_to_app/multiple_flutters/multiple_flutters_ohos FlutterEngineGroup usage sample.
flutter_svg_test ohos/flutter_svg_test SVG image demo.
http_parser_test ohos/http_parser_test HTTP parsing demo.
http_test ohos/http_test HTTP web page request demo.
logging_test ohos/logging_test Logging demo.
path_drawing_test ohos/path_drawing_test Path drawing demo.
pictures_provider_demo ohos/pictures_provider_demo Image obtaining demo.
platform_test ohos/platform_test Platform call demo.
platformchannel_demo ohos/platformchannel_demo API test demo for multiple platform features.
rxdart_test ohos/rxdart_test RxDart demo, used to process asynchronous events and data streams.
string_scanner_test ohos/string_scanner_test String scanning demo.
testcamera ohos/testcamera Camera call demo.
testchat ohos/testchat Chat scenario demo.
testpicture ohos/testpicture Image display demo.
tuple_test ohos/tuple_test Tuple demo, used to test parameters generated by the tuple.
uuid_test ohos/uuid_test UUID demo.
vector_math_test ohos/vector_math_test Vector matching demo.

How to Run a Sample Code

  1. Build the Flutter engine that is compatible with OpenHarmony. For details, see https://gitcode.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://gitcode.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=<path of the OpenHarmony-compatible Flutter engine's build product>.

FAQs

How do I use Dart code to determine whether the current platform is ohos?

import 'package:flutter/foundation.dart';

bool isOhos() {
  return defaultTargetPlatform == TargetPlatform.ohos;
}

Communication

Introduction

开发者可通过本项目快速了解 OpenHarmony Flutter 开发流程,参考示例实现细节进行实践与验证。项目提供 OpenHarmony 平台适配示例及配套文档,覆盖应用开发、平台能力接入与工程实践,包含音乐播放器、智慧农场等场景化案例。【此简介由AI生成】

Customize your domain