text
stringlengths
1
474
_submit();
},
child: Logo(showBorder: hasFocus),
),
);<code_end>
MouseRegion is also useful for creating custom
rollover and hover effects:
<code_start>return MouseRegion(
onEnter: (_) => setState(() => _isMouseOver = true),
onExit: (_) => setState(() => _isMouseOver = false),
onHover: (e) => print(e.localPosition),
child: Container(
height: 500,
color: _isMouseOver ? Colors.blue : Colors.black,
),
);<code_end>
<topic_end>
<topic_start>
Idioms and norms
The final area to consider for adaptive apps is platform standards.
Each platform has its own idioms and norms;
these nominal or de facto standards inform user expectations
of how an application should behave. Thanks, in part to the web,
users are accustomed to more customized experiences,
but reflecting these platform standards can still provide
significant benefits:Reduce cognitive load—By matching the user’s
existing mental model, accomplishing tasks becomes intuitive,
which requires less thinking,
boosts productivity, and reduces frustrations.Build trust—Users can become wary or suspicious
when applications don’t adhere to their expectations.
Conversely, a UI that feels familiar can build user trust
and can help improve the perception of quality.
This often has the added benefit of better app store
ratings—something we can all appreciate!<topic_end>
<topic_start>
Consider expected behavior on each platform
The first step is to spend some time considering what
the expected appearance, presentation, or behavior is on this platform.
Try to forget any limitations of your current implementation,
and just envision the ideal user experience.
Work backwards from there.Another way to think about this is to ask,
“How would a user of this platform expect to achieve this goal?”
Then, try to envision how that would work in your app
without any compromises.This can be difficult if you aren’t a regular user of the platform.
You might be unaware of the specific idioms and can easily miss
them completely. For example, a lifetime Android user is
likely unaware of platform conventions on iOS,
and the same holds true for macOS, Linux, and Windows.
These differences might be subtle to you,
but be painfully obvious to an experienced user.<topic_end>
<topic_start>Find a platform advocate
If possible, assign someone as an advocate for each platform.
Ideally, your advocate uses the platform as their primary device,
and can offer the perspective of a highly opinionated user.
To reduce the number of people, combine roles.
Have one advocate for Windows and Android,
one for Linux and the web, and one for Mac and iOS.The goal is to have constant, informed feedback so the app
feels great on each platform. Advocates should be encouraged
to be quite picky, calling out anything they feel differs from
typical applications on their device. A simple example is how
the default button in a dialog is typically on the left on Mac
and Linux, but is on the right on Windows.
Details like that are easy to miss if you aren’t using a platform
on a regular basis.Important: Advocates don’t need to be developers or
even full-time team members. They can be designers,
stakeholders, or external testers that are provided
with regular builds.<topic_end>
<topic_start>Stay unique
Conforming to expected behaviors doesn’t mean that your app
needs to use default components or styling.
Many of the most popular multiplatform apps have very distinct
and opinionated UIs including custom buttons, context menus,
and title bars.The more you can consolidate styling and behavior across platforms,
the easier development and testing will be.
The trick is to balance creating a unique experience with a
strong identity, while respecting the norms of each platform.<topic_end>
<topic_start>
Common idioms and norms to consider
Take a quick look at a few specific norms and idioms
you might want to consider, and how you could approach
them in Flutter.<topic_end>
<topic_start>Scrollbar appearance and behavior
Desktop and mobile users expect scrollbars,
but they expect them to behave differently on different platforms.
Mobile users expect smaller scrollbars that only appear
while scrolling, whereas desktop users generally expect
omnipresent, larger scrollbars that they can click or drag.Flutter comes with a built-in Scrollbar widget that already
has support for adaptive colors and sizes according to the
current platform. The one tweak you might want to make is to
toggle alwaysShown when on a desktop platform:
<code_start>return Scrollbar(
thumbVisibility: DeviceType.isDesktop,
controller: _scrollController,
child: GridView.count(
controller: _scrollController,
padding: const EdgeInsets.all(Insets.extraLarge),
childAspectRatio: 1,
crossAxisCount: colCount,
children: listChildren,
),