text stringlengths 1 372 |
|---|
} |
} |
<code_end> |
by setting the initial route of the navigation channel, the associated |
FlutterEngine displays the desired route upon initial execution of the |
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> |
add a translucent flutter screen |
most full-screen flutter experiences are opaque. |
however, some apps would like to deploy a flutter |
screen that looks like a modal, for example, |
a dialog or bottom sheet. flutter supports translucent |
FlutterActivitys out of the box. |
to make your FlutterActivity translucent, |
make the following changes to the regular process of |
creating and launching a FlutterActivity. |
<topic_end> |
<topic_start> |
step 1: use a theme with translucency |
android requires a special theme property for activitys that render |
with a translucent background. create or update an android theme with the |
following property: |
then, apply the translucent theme to your FlutterActivity. |
your FlutterActivity now supports translucency. |
next, you need to launch your FlutterActivity |
with explicit transparency support. |
<topic_end> |
<topic_start> |
step 2: start FlutterActivity with transparency |
to launch your FlutterActivity with a transparent background, |
pass the appropriate BackgroundMode to the IntentBuilder: |
<code_start> |
// using a new FlutterEngine. |
startActivity( |
FlutterActivity |
.withnewengine() |
.backgroundmode(flutteractivitylaunchconfigs.backgroundmode.transparent) |
.build(context) |
); |
// using a cached FlutterEngine. |
startActivity( |
FlutterActivity |
.withcachedengine("my_engine_id") |
.backgroundmode(flutteractivitylaunchconfigs.backgroundmode.transparent) |
.build(context) |
); |
<code_end> |
<code_start> |
// using a new FlutterEngine. |
startActivity( |
FlutterActivity |
.withnewengine() |
.backgroundmode(flutteractivitylaunchconfigs.backgroundmode.transparent) |
.build(this) |
); |
// using a cached FlutterEngine. |
startActivity( |
FlutterActivity |
.withcachedengine("my_engine_id") |
.backgroundmode(flutteractivitylaunchconfigs.backgroundmode.transparent) |
.build(this) |
); |
<code_end> |
you now have a FlutterActivity with a transparent background. |
info note |
make sure that your flutter content also includes a |
translucent background. if your flutter UI paints a |
solid background color, then it still appears as |
though your FlutterActivity has an opaque background. |
<topic_end> |
<topic_start> |
add a flutter fragment to an android app |
this guide describes how to add a flutter fragment to an existing |
android app. in android, a fragment represents a modular |
piece of a larger UI. a fragment might be used to present |
a sliding drawer, tabbed content, a page in a ViewPager, |
or it might simply represent a normal screen in a |
single-Activity app. flutter provides a FlutterFragment |
so that developers can present a flutter experience any place |
that they can use a regular fragment. |
if an activity is equally applicable for your application needs, |
consider using a FlutterActivity instead of a |
FlutterFragment, which is quicker and easier to use. |
FlutterFragment allows developers to control the following |
details of the flutter experience within the fragment: |
FlutterFragment also comes with a number of calls that |
must be forwarded from its surrounding activity. |
these calls allow flutter to react appropriately to OS events. |
all varieties of FlutterFragment, and its requirements, |
are described in this guide. |
<topic_end> |
<topic_start> |
add a FlutterFragment to an activity with a new FlutterEngine |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.