-
Notifications
You must be signed in to change notification settings - Fork 69
Introduce ElmFlutterView class #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| void *GetEvasImageHandle() { return evas_image_; }; | ||
|
|
||
| // The width of the view, or the maximum width if the value is zero. | ||
| int32_t window_width_ = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
window_width_ and window_height_ can be set again after starting the View engine for now.
How about providing getter methods instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review.
I added Getter and Resize methods.
This is resize test image (https://github.com/JSUYA/jsuya.github.io/blob/master/ElmFlutterView_test.gif)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a getter for size, but now there are some issues. ( + #373 (comment))
I'll apply your comments on Getter through another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WonyoungChoi Anything more to discuss?
|
contribute to #351 |
embedding/cpp/elm_flutter_view.cc
Outdated
| } | ||
|
|
||
| bool ElmFlutterView::RunFlutterEngine(void *elm_parent, int32_t width, | ||
| int32_t height) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public API and cannot be changed in the future without breaking existing apps. Is it okay to finalize this API? The name of the API (RunFlutterEngine) should be able to tolerate possible implementation changes such as
- The engine instance becomes reusable. That is, if a cached engine instance is available, you can use the instance and don't have to "run" a new engine.
- Starting an engine and creating a view become separate steps. (e.g. Allow the user to pre-initialize an engine instance, to reduce the time to draw the first frame in an add-to-app scenario.) The engine instance might be even passed from outside of
ElmFlutterView.
I don't mean that these changes will necessarily take place in the future, but we just have to consider various scenarios before finalizing the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reuse of engine instances has not been considered yet. The engine's lifecycle follows ElmFlutterView.
As far as I know, FlutterView does not consider multi-instance of engine.
I will discuss this a little more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you like this design?
ElmFlutterView flutter_view(parent, width, height);
// flutter_view.SetEngine(cached_engine); // this may be implemented later
flutter_view.RunEngine(); // implicitly creates an engine if not setAlso we need to think carefully about properties such as dart_entrypoint_ and dart_entrypoint_args_. If an engine can be started before creating an ElmFlutterView, having the dart_entrypoint_ value inside ElmFlutterView might be a design flaw because ElmFlutterView doesn't necessarily create an engine on RunEngine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the API to RunEngine and added a new constructor.
About dart_entrypoint I agree too. Currently not working. I think we need an Interface for these.
I think we can keep this code until considering the new interface(for entrypoint or other argument(sw renderer)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @swift-kim's opinion is reasonable.
Maybe we've reached the point where we need to abstract about the engine?
In fact, since the view and the engine APIs are provided respectively by Embedder, it is a very natural idea to set the engine that has already been executed(or cached) in the view.
preparing this for a variety of uses, such as caching or spawning engine, seems may to help us in many ways.
But I'm not saying it's necessary right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. but don't we also need a way to warm up or cache the engine? even if flutter-tizen be provided as an app or service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The page you linked is about adding a Flutter screen to a normal app. The same thing applies to Tizen as well (although we don't have a concept of Android's Activity in Tizen). If a developer wants to utilize "engine warm-up" in a single screen Flutter app, they can implement the native "app" part by themself and use a cached engine with an explicit ElmFlutterView attached to the app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, ElmFlutterView can take a that role. If so, it is expected that there will be no breaking change even if abstraction of the engine is carried out in the current state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can take over the part that was further discussed because @JSUYA left the office for a while.
(or it would be better to open another PR when he returns to the office.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, the name of the method (RunEngine) seems flexible enough to tolerate any possible future API changes. Let's discuss later again when we are to make further changes.
| engine_prop.dart_entrypoint_argc = entrypoint_args.size(); | ||
| engine_prop.dart_entrypoint_argv = entrypoint_args.data(); | ||
|
|
||
| engine_ = FlutterDesktopEngineCreate(engine_prop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FlutterApp, FlutterServiceApp, and ElmFlutterView have duplicated portions of code (lines 29-55, and the data members in the header) and we might be able to improve reusability by introducing a common base class for all (e.g. FlutterView). How do you think? It's just an idea and we don't have to restructure the classes in this PR right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to these, I think we should consider the interface of Lifecycle Callback and App Event Callback. I think the view should provide those kinds of things. These interfaces seem to be common.
I would recommend that this be treated as an another topic.
|
Can you share an example like the app you showed here? |
@bbrto21 |
19b4925 to
d3dc7ce
Compare
There are two ways to draw FlutterTizenView in Tizen. (TizenWindowElementary and TizenWindowEcore)
Both ways are drawing on Window component(surface).
We try to draw FlutterTizenView on the appropriate component
provided by Tizen UIFW and support it to be place with other components.
To do that, we created a TizenView class on the same level as TizenWindow
and abstracted common methods to TizenViewBase.
we can add FlutterTizenView to other UIFW of Tizen while adding TizenView{?}(maybe Tizen NUI).
```
TizenViewBase -> TizenView -> TizenViewElementary
-> TizenView{?}
-> TizenWindow -> TizenWindowElementary
-> TizenWindowEcore
```
related PR : flutter-tizen/flutter-tizen#373
bbrto21
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
swift-kim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further work is required, but seems enough for now.
|
This PR must include latest engine release hash, without this you cannot build a c++ host flutter-tizen app. |
This class is the FlutterView class available in EFL UIFW.
According to the Elementary widget api rule(?),
Evas_Object type parent widget is always required at the time of creation.
When FlutterView starts the Flutter engine normally through OnCreate(),
it can acquire the Evas Image handle.
Example)
```cpp
ElmFlutterView flutter_view(parent_box);
// Optional.
flutter_view.window_width_ = 720;
flutter_view.window_height_ = 600;
if (flutter_view.OnCreate()) {
RegisterPlugins(&flutter_view);
Evas_Object* evas_image = (Evas_Object*)flutter_view.GetEvasImageHandle();
elm_box_pack_end(parent_box, evas_image);
}
```
Co-authored-by: Boram Bae <[email protected]>
Co-authored-by: Boram Bae <[email protected]>
fa3b601 to
0b15541
Compare
I added a patch to update the engine hash. thank you for check |
122a9ec to
27d3489
Compare
9e9fa3a to
b75ec18
Compare
Thanks! It is now expected that there will be no problems. |


This class is the FlutterView class available in EFL UIFW.
According to the Elementary widget api rule(?),
Evas_Object type parent widget is always required before engine run.
When FlutterView starts the Flutter engine normally through RunFlutterEngine(),
it can acquire the Evas Object handle.
Example)
related PR : flutter-tizen/engine#292