Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.embedding.android.FlutterFragmentActivity.NewEngineIntentBuilder Class Reference

Public Member Functions

 NewEngineIntentBuilder (@NonNull Class<? extends FlutterFragmentActivity > activityClass)
 
NewEngineIntentBuilder initialRoute (@NonNull String initialRoute)
 
NewEngineIntentBuilder backgroundMode (@NonNull BackgroundMode backgroundMode)
 
NewEngineIntentBuilder dartEntrypointArgs (@Nullable List< String > dartEntrypointArgs)
 
Intent build (@NonNull Context context)
 

Detailed Description

Builder to create an Intent that launches a FlutterFragmentActivity with a new io.flutter.embedding.engine.FlutterEngine and the desired configuration.

Definition at line 94 of file FlutterFragmentActivity.java.

Constructor & Destructor Documentation

◆ NewEngineIntentBuilder()

io.flutter.embedding.android.FlutterFragmentActivity.NewEngineIntentBuilder.NewEngineIntentBuilder ( @NonNull Class<? extends FlutterFragmentActivity activityClass)
inline

Constructor that allows this NewEngineIntentBuilder to be used by subclasses of FlutterFragmentActivity.

Subclasses of FlutterFragmentActivity should provide their own static version of withNewEngine(), which returns an instance of NewEngineIntentBuilder constructed with a Class reference to the FlutterFragmentActivity subclass, e.g.:

return new NewEngineIntentBuilder(MyFlutterActivity.class);

Definition at line 111 of file FlutterFragmentActivity.java.

111 {
112 this.activityClass = activityClass;
113 }

Member Function Documentation

◆ backgroundMode()

NewEngineIntentBuilder io.flutter.embedding.android.FlutterFragmentActivity.NewEngineIntentBuilder.backgroundMode ( @NonNull BackgroundMode  backgroundMode)
inline

The mode of FlutterFragmentActivity'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 FlutterFragmentActivity 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 FlutterFragmentActivity 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>.

Definition at line 142 of file FlutterFragmentActivity.java.

142 {
143 this.backgroundMode = backgroundMode.name();
144 return this;
145 }

◆ build()

Intent io.flutter.embedding.android.FlutterFragmentActivity.NewEngineIntentBuilder.build ( @NonNull Context  context)
inline

Creates and returns an Intent that will launch a FlutterFragmentActivity with the desired configuration.

Definition at line 167 of file FlutterFragmentActivity.java.

167 {
168 Intent intent =
169 new Intent(context, activityClass)
170 .putExtra(EXTRA_INITIAL_ROUTE, initialRoute)
171 .putExtra(EXTRA_BACKGROUND_MODE, backgroundMode)
172 .putExtra(EXTRA_DESTROY_ENGINE_WITH_ACTIVITY, true);
173 if (dartEntrypointArgs != null) {
174 intent.putExtra(EXTRA_DART_ENTRYPOINT_ARGS, new ArrayList(dartEntrypointArgs));
175 }
176 return intent;
177 }

◆ dartEntrypointArgs()

NewEngineIntentBuilder io.flutter.embedding.android.FlutterFragmentActivity.NewEngineIntentBuilder.dartEntrypointArgs ( @Nullable List< String >  dartEntrypointArgs)
inline

The Dart entrypoint arguments will be passed as a list of string to Dart's entrypoint function.

A value of null means do not pass any arguments to Dart's entrypoint function.

Parameters
dartEntrypointArgsThe Dart entrypoint arguments.
Returns
The engine intent builder.

Definition at line 157 of file FlutterFragmentActivity.java.

157 {
158 this.dartEntrypointArgs = dartEntrypointArgs;
159 return this;
160 }

◆ initialRoute()

NewEngineIntentBuilder io.flutter.embedding.android.FlutterFragmentActivity.NewEngineIntentBuilder.initialRoute ( @NonNull String  initialRoute)
inline

The initial route that a Flutter app will render in this FlutterFragmentActivity, defaults to "/".

Definition at line 120 of file FlutterFragmentActivity.java.

120 {
121 this.initialRoute = initialRoute;
122 return this;
123 }

The documentation for this class was generated from the following file: