text
stringlengths
1
474
animation.When using fling(), a Force is used to create a specific
simulation which is then used to drive the controller.When using animateWith(), the given simulation is used to drive the
controller.These methods all return the future that the Ticker provides and
which will resolve when the controller next stops or changes
simulation.<topic_end>
<topic_start>Attaching animatables to animations
Passing an Animation<double> (the new parent) to an Animatable’s
animate() method creates a new Animation subclass that acts like
the Animatable but is driven from the given parent.
<topic_end>
<topic_start>Accessibility
Ensuring apps are accessible to a broad range of users is an essential
part of building a high-quality app. Applications that are poorly
designed create barriers to people of all ages. The UN Convention on
the Rights of Persons with Disabilities states the moral and legal
imperative to ensure universal access to information systems; countries
around the world enforce accessibility as a requirement; and companies
recognize the business advantages of maximizing access to their services.We strongly encourage you to include an accessibility checklist
as a key criteria before shipping your app. Flutter is committed to
supporting developers in making their apps more accessible, and includes
first-class framework support for accessibility in addition to that
provided by the underlying operating system, including:Details of these features are discussed below.<topic_end>
<topic_start>
Inspecting accessibility support
In addition to testing for these specific topics,
we recommend using automated accessibility scanners:<topic_end>
<topic_start>
Large fonts
Both Android and iOS contain system settings to configure the desired font
sizes used by apps. Flutter text widgets respect this OS setting when
determining font sizes.Font sizes are calculated automatically by Flutter based on the OS setting.
However, as a developer you should make sure your layout has enough room to
render all its contents when the font sizes are increased.
For example, you can test all parts of your app on a small-screen
device configured to use the largest font setting.<topic_end>
<topic_start>
Example
The following two screenshots show the standard Flutter app
template rendered with the default iOS font setting,
and with the largest font setting selected in iOS accessibility settings.<topic_end>
<topic_start>
Screen readers
For mobile, screen readers (TalkBack, VoiceOver)
enable visually impaired users to get spoken feedback about
the contents of the screen and interact with the UI by using
gestures on mobile and keyboard shortcuts on desktop.
Turn on VoiceOver or TalkBack on your mobile device and
navigate around your app.To turn on the screen reader on your device, complete the following steps:To learn how to find and customize Android’s
accessibility features, view the following video.To learn how to find and customize iOS
accessibility features, view the following video.For web, the following screen readers are currently supported:Mobile browsers:Desktop browsers:Screen readers users on web must toggle the
“Enable accessibility” button to build the semantics tree.
Users can skip this step if you programmatically auto-enable
accessibility for your app using this API:Windows comes with a screen reader called Narrator
but some developers recommend using the more popular
NVDA screen reader. To learn about using NVDA to test
Windows apps, check out
Screen Readers 101 For Front-End Developers (Windows).On a Mac, you can use the desktop version of VoiceOver,
which is included in macOS.On Linux, a popular screen reader is called Orca.
It comes pre-installed with some distributions
and is available on package repositories such as apt.
To learn about using Orca, check out
Getting started with Orca screen reader on Gnome desktop.Check out the following video demo to see Victor Tsaran,
using VoiceOver with the now-archived Flutter Gallery web app.Flutter’s standard widgets generate an accessibility tree automatically.
However, if your app needs something different,
it can be customized using the Semantics widget.When there is text in your app that should be voiced
with a specific voice, inform the screen reader
which voice to use by calling TextSpan.locale.
Note that MaterialApp.locale and Localizations.override
don’t affect which voice the screen reader uses.
Usually, the screen reader uses the system voice
except where you explicitly set it with TextSpan.locale.<topic_end>
<topic_start>
Sufficient contrast
Sufficient color contrast makes text and images easier to read.
Along with benefitting users with various visual impairments,
sufficient color contrast helps all users when viewing an interface
on devices in extreme lighting conditions,
such as when exposed to direct sunlight or on a display with low
brightness.The W3C recommends:<topic_end>
<topic_start>
Building with accessibility in mind
Ensuring your app can be used by everyone means building accessibility
into it from the start. For some apps, that’s easier said than done.
In the video below, two of our engineers take a mobile app from a dire
accessibility state to one that takes advantage of Flutter’s built-in
widgets to offer a dramatically more accessible experience.<topic_end>
<topic_start>
Testing accessibility on mobile
Test your app using Flutter’s Accessibility Guideline API.
This API checks if your app’s UI meets Flutter’s accessibility recommendations.
These cover recommendations for text contrast, target size, and target labels.The following example shows how to use the Guideline API on Name Generator.
You created this app as part of the
Write your first Flutter app codelab.
Each button on the app’s main screen serves as a tappable target
with text represented in 18 point.
<code_start>final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MyApp());
// Checks that tappable nodes have a minimum size of 48 by 48 pixels
// for Android.
await expectLater(tester, meetsGuideline(androidTapTargetGuideline));