text stringlengths 1 474 |
|---|
Executing channel handlers on background threads |
In order for a channel’s platform side handler to |
execute on a background thread, you must use the |
Task Queue API. Currently this feature is only |
supported on iOS and Android.In Java:In Kotlin:In Swift:info Note |
In release 2.10, the Task Queue API is only available on the master channel |
for iOS.In Objective-C:info Note |
In release 2.10, the Task Queue API is only available on the master channel |
for iOS.<topic_end> |
<topic_start> |
Jumping to the UI thread in Android |
To comply with channels’ UI thread requirement, |
you might need to jump from a background thread |
to Android’s UI thread to execute a channel method. |
In Android, you can accomplish this by post()ing a |
Runnable to Android’s UI thread Looper, |
which causes the Runnable to execute on the |
main thread at the next opportunity.In Java:In Kotlin:<topic_end> |
<topic_start> |
Jumping to the main thread in iOS |
To comply with channel’s main thread requirement, |
you might need to jump from a background thread to |
iOS’s main thread to execute a channel method. |
You can accomplish this in iOS by executing a |
block on the main dispatch queue:In Objective-C:In Swift: |
<topic_end> |
<topic_start>Automatic platform adaptations |
info Note |
As of the Flutter 3.16 release, Material 3 |
replaces Material 2 as the default theme |
on all Flutter apps that use Material.<topic_end> |
<topic_start> |
Adaptation philosophy |
In general, two cases of platform adaptiveness exist:This article mainly covers the automatic adaptations |
provided by Flutter in case 1 on Android and iOS.For case 2, Flutter bundles the means to produce the |
appropriate effects of the platform conventions but doesn’t |
adapt automatically when app design choices are needed. |
For a discussion, see issue #8410 and the |
Material/Cupertino adaptive widget problem definition.For an example of an app using different information |
architecture structures on Android and iOS but sharing |
the same content code, see the platform_design code samples.info |
Preliminary guides addressing case 2 |
are being added to the UI components section. |
You can request additional guides by commenting on issue #8427.<topic_end> |
<topic_start> |
Page navigation |
Flutter provides the navigation patterns seen on Android |
and iOS and also automatically adapts the navigation animation |
to the current platform.<topic_end> |
<topic_start> |
Navigation transitions |
On Android, the default Navigator.push() transition |
is modeled after startActivity(), |
which generally has one bottom-up animation variant.On iOS:<topic_end> |
<topic_start> |
Platform-specific transition details |
On Android, Flutter uses the ZoomPageTransitionsBuilder animation. |
When the user taps on an item, the UI zooms in to a screen that features that item. |
When the user taps to go back, the UI zooms out to the previous screen.On iOS when the push style transition is used, |
Flutter’s bundled CupertinoNavigationBar |
and CupertinoSliverNavigationBar nav bars |
automatically animate each subcomponent to its corresponding |
subcomponent on the next or previous page’s |
CupertinoNavigationBar or CupertinoSliverNavigationBar.<topic_end> |
<topic_start> |
Back navigation |
On Android, |
the OS back button, by default, is sent to Flutter |
and pops the top route of the WidgetsApp’s Navigator.On iOS, |
an edge swipe gesture can be used to pop the top route.<topic_end> |
<topic_start> |
Scrolling |
Scrolling is an important part of the platform’s |
look and feel, and Flutter automatically adjusts |
the scrolling behavior to match the current platform.<topic_end> |
<topic_start> |
Physics simulation |
Android and iOS both have complex scrolling physics |
simulations that are difficult to describe verbally. |
Generally, iOS’s scrollable has more weight and |
dynamic friction but Android has more static friction. |
Therefore iOS gains high speed more gradually but stops |
less abruptly and is more slippery at slow speeds.<topic_end> |
<topic_start> |
Overscroll behavior |
On Android, |
scrolling past the edge of a scrollable shows an |
overscroll glow indicator (based on the color |
of the current Material theme).On iOS, scrolling past the edge of a scrollable |
overscrolls with increasing resistance and snaps back.<topic_end> |
<topic_start> |
Momentum |
On iOS, |
repeated flings in the same direction stacks momentum |
and builds more speed with each successive fling. |
There is no equivalent behavior on Android.<topic_end> |
<topic_start> |
Return to top |
On iOS, |
tapping the OS status bar scrolls the primary |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.