flutter-tizen
flutter-tizen copied to clipboard
Refactoring of Embedding API
Since FlutterView was added, the class relationship of the Embedding API seems to have become very complicated.
Currently, FlutterApplication
, FlutterService
, ElmFlutterView
, and NUIFlutterView
all create and own the FlutterTizenEngine
of the Embedder
. This seems to violate SRP and OCP. This design is centered on C#, but the same is true of C++.
For this reason, Refactoring is proposed as shown in the following diagram.
IMO, First of all, In the FlutterDesktopViewCreateFromNewWindow
, FlutterDesktopViewCreateFromElmParent
, ..., the code that creates the view and runs the engine must be separated.
AS-IS
TO-BE
Please note that
- We can't change this part: https://github.com/flutter-tizen/flutter-tizen/blob/8ac3e60b5d652c0319a968dd22a981cc18eb475b/templates/ui-app/csharp/App.cs#L11
- We already have had a plan to implement the
FlutterView
class (as a wrapper ofFlutterTizenView
but not a common base class forElmFlutterView
orNUIFlutterView
) since we started working on theFlutterEngine
class. -
FlutterTizenView
andFlutterTizenEngine
(and their embedding counterpartsFlutterView
andFlutterEngine
) have a special relationship. An engine is "owned" by a view and the lifecycle of the engine is managed by the view (i.e. the engine is started when the view is created and terminated when the view is destroyed). I don't think this should necessarily be the case but we just followed the Windows embedder implementation. - The
NUIFlutterView
class extendsImageView
and thus cannot extendFlutterView
.
I agree with a lot of things, but I'm even considering "Breaking Changes."
As a way not to damage the existing user interface as much as possible, we are trying to change it little by little.
If you're to make changes to the NUIFlutterView
class, the sooner the better it will be, because right now it has not been documented yet and not being used anywhere.
@swift-kim Yes I think so.