Flutter-OpenHarmony Native Interaction and Navigation
Harmony OS Next
Flutter-OpenHarmony Native Interaction and Navigation
1. EntryAbility Extending UIAbility
```ts
export default class EntryAbility extends UIAbility implements ExclusiveAppComponent<UIAbility> {
// Detach from Flutter engine
detachFromFlutterEngine(): void {
// Method implementation goes here
}
// Get current UIAbility component
getAppComponent(): UIAbility {
return this;
}
// Called when ability is created
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// Register this UIAbility with Flutter manager
FlutterManager.getInstance().pushUIAbility(this);
}
// Called when ability is destroyed
onDestroy(): void | Promise<void> {
// Unregister this UIAbility from Flutter manager
FlutterManager.getInstance().popUIAbility(this);
}
// Called when window stage is created
onWindowStageCreate(windowStage: window.WindowStage): void {
// Set full screen layout
windowStage.getMainWindowSync().setWindowLayoutFullScreen(true);
// Register window stage with Flutter manager
FlutterManager.getInstance().pushWindowStage(this, windowStage);
// Load content
windowStage.loadContent('pages/Index');
}
// Called when window stage is destroyed
onWindowStageDestroy() {
// Unregister window stage from Flutter manager
FlutterManager.getInstance().popWindowStage(this);
}
}
```
Top comments (0)