Flutter Engine
The Flutter Engine
|
Public Member Functions | |
NewEngineInGroupIntentBuilder ( @NonNull Class<? extends FlutterActivity > activityClass, @NonNull String engineGroupId) | |
NewEngineInGroupIntentBuilder | dartEntrypoint (@NonNull String dartEntrypoint) |
NewEngineInGroupIntentBuilder | initialRoute (@NonNull String initialRoute) |
NewEngineInGroupIntentBuilder | backgroundMode (@NonNull BackgroundMode backgroundMode) |
Intent | build (@NonNull Context context) |
Builder to create an Intent
that launches a FlutterActivity
with a new FlutterEngine
created by FlutterEngineGroup::createAndRunEngine.
Definition at line 482 of file FlutterActivity.java.
|
inline |
Constructor that allows this NewEngineInGroupIntentBuilder
to be used by subclasses of FlutterActivity
.
Subclasses of FlutterActivity
should provide their own static version of withNewEngineInGroup
, which returns an instance of NewEngineInGroupIntentBuilder
constructed with a Class
reference to the FlutterActivity
subclass, e.g.:
return new NewEngineInGroupIntentBuilder(MyFlutterActivity.class,
cacheedEngineGroupId);
// Create a FlutterEngineGroup, such as in the onCreate method of the Application.
FlutterEngineGroup engineGroup = new FlutterEngineGroup(this);
FlutterEngineGroupCache.getInstance().put("my_cached_engine_group_id", engineGroup);
// Create a NewEngineInGroupIntentBuilder that would build an intent to start my custom FlutterActivity subclass.
FlutterActivity.NewEngineInGroupIntentBuilder intentBuilder =
new FlutterActivity.NewEngineInGroupIntentBuilder(
MyFlutterActivity.class,
app.engineGroupId);
intentBuilder.dartEntrypoint("main")
.initialRoute("/custom/route")
.backgroundMode(BackgroundMode.transparent);
startActivity(intentBuilder.build(context));
activityClass | A subclass of FlutterActivity . |
engineGroupId | The engine group id. |
Definition at line 519 of file FlutterActivity.java.
|
inline |
The mode of FlutterActivity
's background, either BackgroundMode#opaque
or BackgroundMode#transparent
.
The default background mode is BackgroundMode#opaque
.
Choosing a background mode of BackgroundMode#transparent
will configure the inner FlutterView
of this FlutterActivity
to be configured with a FlutterTextureView
to support transparency. This choice has a non-trivial performance impact. A transparent background should only be used if it is necessary for the app design being implemented.
A FlutterActivity
that is configured with a background mode of BackgroundMode#transparent
must have a theme applied to it that includes the following property: <item name="android:windowIsTranslucent">true</item>
.
backgroundMode | The background mode. |
Definition at line 571 of file FlutterActivity.java.
|
inline |
Creates and returns an Intent
that will launch a FlutterActivity
with the desired configuration.
context | The context. e.g. An Activity. |
Definition at line 584 of file FlutterActivity.java.
|
inline |
The Dart entrypoint that will be executed in the newly created FlutterEngine as soon as the Dart snapshot is loaded. Default to "main".
dartEntrypoint | The dart entrypoint's name |
Definition at line 533 of file FlutterActivity.java.
|
inline |
The initial route that a Flutter app will render in this FlutterActivity
, defaults to "/".
initialRoute | The route. |
Definition at line 546 of file FlutterActivity.java.