Skip to content

Conversation

@gspencergoog
Copy link
Contributor

@gspencergoog gspencergoog commented Mar 4, 2020

Description

Adds a VisualDensity.adaptivePlatformDensity static function that returns different values for visual density based on the defaultTargetPlatform. Returns compact for desktop platforms, and a default visual density for other platforms.

Issues

Tests

  • Added a test for the new function.

Breaking Change

  • No, this is not a breaking change.

@fluttergithubbot fluttergithubbot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. tool Affects the "flutter" command-line tool. See also t: labels. labels Mar 4, 2020
@gspencergoog gspencergoog requested a review from HansMuller March 4, 2020 09:26
@gspencergoog
Copy link
Contributor Author

/cc @csells

@skia-gold
Copy link

Gold has detected one or more untriaged digests on patchset 2.
Please triage them at https://flutter-gold.skia.org/search?issue=51921.

@zanderso zanderso removed the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 19, 2020
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gspencergoog gspencergoog merged commit 2a649b1 into flutter:master Mar 31, 2020
@gspencergoog gspencergoog deleted the adaptive_density branch March 31, 2020 23:16
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this? isn't being adaptive the default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, being adaptive isn't the default, because the Material Design team wanted the "mobile" density to be the default. Their reasoning was that some desktop systems have touch screens, and so those screens should have 48x48 touch targets, so as not to compromise accessibility.

We had anecdotal evidence, however, that developers would like the option to have it be adaptive, so this was the compromise that we came up with.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants