text stringlengths 1 372 |
|---|
runApp() dart function. |
changing the initial route property of the navigation channel |
after the initial execution of runApp() has no effect. |
developers who would like to use the same FlutterEngine |
between different activitys and fragments and switch |
the route between those displays need to set up a method channel and |
explicitly instruct their dart code to change navigator routes. |
<topic_end> |
<topic_start> |
display a splash screen |
the initial display of flutter content requires some wait time, |
even if a pre-warmed FlutterEngine is used. |
to help improve the user experience around |
this brief waiting period, flutter supports the |
display of a splash screen (also known as “launch screen”) until flutter |
renders its first frame. for instructions about how to show a launch |
screen, see the splash screen guide. |
<topic_end> |
<topic_start> |
run flutter with a specified initial route |
an android app might contain many independent flutter experiences, |
running in different FlutterFragments, with different |
FlutterEngines. in these scenarios, |
it’s common for each flutter experience to begin with different |
initial routes (routes other than /). |
to facilitate this, FlutterFragment’s builder |
allows you to specify a desired initial route, as shown: |
<code_start> |
// with a new FlutterEngine. |
FlutterFragment flutterFragment = FlutterFragment.withNewEngine() |
.initialroute("myinitialroute/") |
.build(); |
<code_end> |
<code_start> |
// with a new FlutterEngine. |
val flutterFragment = FlutterFragment.withNewEngine() |
.initialroute("myinitialroute/") |
.build() |
<code_end> |
info note |
FlutterFragment’s initial route property has no effect when a pre-warmed |
FlutterEngine is used because the pre-warmed FlutterEngine already |
chose an initial route. the initial route can be chosen explicitly when |
pre-warming a FlutterEngine. |
<topic_end> |
<topic_start> |
run flutter from a specified entrypoint |
similar to varying initial routes, different |
FlutterFragments might want to execute different |
dart entrypoints. in a typical flutter app, there is only one |
dart entrypoint: main(), but you can define other entrypoints. |
FlutterFragment supports specification of the desired |
dart entrypoint to execute for the given flutter experience. |
to specify an entrypoint, build FlutterFragment, as shown: |
<code_start> |
FlutterFragment flutterFragment = FlutterFragment.withNewEngine() |
.dartentrypoint("myspecialentrypoint") |
.build(); |
<code_end> |
<code_start> |
val flutterFragment = FlutterFragment.withNewEngine() |
.dartentrypoint("myspecialentrypoint") |
.build() |
<code_end> |
the FlutterFragment configuration results in the execution |
of a dart entrypoint called mySpecialEntrypoint(). |
notice that the parentheses () are |
not included in the dartEntrypoint string name. |
info note |
FlutterFragment’s dart entrypoint property has no effect |
when a pre-warmed FlutterEngine is used because the |
pre-warmed FlutterEngine already executed a dart entrypoint. |
the dart entrypoint can be chosen explicitly when pre-warming |
a FlutterEngine. |
<topic_end> |
<topic_start> |
control FlutterFragment’s render mode |
FlutterFragment can either use a SurfaceView to render its |
flutter content, or it can use a TextureView. |
the default is SurfaceView, which is significantly |
better for performance than TextureView. however, SurfaceView |
can’t be interleaved in the middle of an android view hierarchy. |
a SurfaceView must either be the bottommost view in the hierarchy, |
or the topmost view in the hierarchy. |
additionally, on android versions before android n, |
SurfaceViews can’t be animated because their layout and rendering |
aren’t synchronized with the rest of the view hierarchy. |
if either of these use cases are requirements for your app, |
then you need to use TextureView instead of SurfaceView. |
select a TextureView by building a FlutterFragment with a |
texture RenderMode: |
<code_start> |
// with a new FlutterEngine. |
FlutterFragment flutterFragment = FlutterFragment.withNewEngine() |
.rendermode(flutterview.rendermode.texture) |
.build(); |
// with a cached FlutterEngine. |
FlutterFragment flutterFragment = FlutterFragment.withCachedEngine("my_engine_id") |
.rendermode(flutterview.rendermode.texture) |
.build(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.