Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
39cd943
add semantic container, selectability, and enabled state to chip
May 25, 2018
cf8a1c3
add tests for chip semantics
May 25, 2018
07d5e9b
Merge branch 'master' of github.com:flutter/flutter into a11y_16964
May 29, 2018
42402a1
add more test coverage, make sure hasEnabledState is present
May 29, 2018
be5801f
update tests and use canTap
May 29, 2018
ef41d7f
increase tap target using outer padding
May 30, 2018
2a9a87e
changed outer padding to outer constraints, update some tests
May 31, 2018
5a90a0e
increase time picker height by 12dp to account for bigger flat button
May 31, 2018
cdabb2e
Update button.dart
May 31, 2018
d8a89ca
adjust minimum heights of other buttons and fix some tests
Jun 1, 2018
423a093
Merge branch 'a11y_615' of github.com:jonahwilliams/flutter into a11y…
Jun 1, 2018
985fdb6
temporarily turn off two failing tests
Jun 1, 2018
5944354
Merge branch 'master' of github.com:flutter/flutter into a11y_16964
Jun 1, 2018
6e79412
increase minimum touch target to 48x48
Jun 1, 2018
c3fbe84
make outer constraints configurable
Jun 2, 2018
21c2941
increase size of checkbox, switch, and radio button to 48 by 48 to co…
jonahwilliams Jun 10, 2018
d412128
add flag for expanding tap targets
Jun 11, 2018
4bf34be
add smoke test for tap target size
Jun 11, 2018
61c6e30
switch flag for enum
Jun 11, 2018
8a3f125
merge a11y_615 into flag change
Jun 11, 2018
7bb9ff9
merge material button tap target changes adjusted to use new flag
Jun 11, 2018
3bf7bcf
Merge branch 'a11y_16964' into tap_target_flag
Jun 11, 2018
e0b1f28
fix imports and remove public outerConstraints property of chip
Jun 11, 2018
440c962
address comments
Jun 11, 2018
a90b986
fix spelling and add switch statement in time picker
Jun 11, 2018
dbf3dae
fix new wrapping in chip
Jun 11, 2018
1174a2d
Merge remote-tracking branch 'origin/tap_size' into tap_target_flag
Jun 11, 2018
53d3be6
update checkbox, radio, and switch to use additonalConstraints instea…
Jun 11, 2018
0e08fe8
Wrap CheckboxListTile, RadioListTile, and SwitchListTile in a collaps…
Jun 11, 2018
5fb4873
renamed MaterialTapTargetSize enums and add size tests for Checkbox, …
Jun 11, 2018
090b3d2
add size tests to buttons, mini fab, and raw chip
Jun 12, 2018
bb6c3ac
make Checkbox, Radio, and Switch take a MaterialTapTargetSize enum in…
Jun 12, 2018
b26dafb
effects vs affects
Jun 12, 2018
c8d8cf6
Merge branch 'master' of github.com:flutter/flutter into tap_target_flag
jonahwilliams Jun 13, 2018
2e205be
refactor all updated material widgets to take materialTapTargetSize a…
jonahwilliams Jun 13, 2018
a47e806
add redirecting render object
Jun 18, 2018
5f475d8
merge with remote
Jun 18, 2018
7e61552
Address comments
Jun 19, 2018
190be7b
increase chip hit detection and address button comments
Jun 19, 2018
df92deb
Add ink tests for raw material button
jonahwilliams Jun 22, 2018
0145ffb
add tests for material chip behavior
jonahwilliams Jun 22, 2018
fea5961
Merge branch 'master' of https://github.com/flutter/flutter into tap_…
jonahwilliams Jul 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address comments
  • Loading branch information
Jonah Williams committed Jun 11, 2018
commit 440c96290b491af7ac4532d680b66f267c9f46b5
12 changes: 9 additions & 3 deletions packages/flutter/lib/src/material/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ class MaterialButton extends StatelessWidget {
final ThemeData theme = Theme.of(context);
final ButtonThemeData buttonTheme = ButtonTheme.of(context);
final Color textColor = _getTextColor(theme, buttonTheme, color);
BoxConstraints outerConstraints;
switch (theme.materialTapTargetSize) {
case MaterialTapTargetSize.expanded:
outerConstraints = const BoxConstraints(minHeight: 48.0, minWidth: 48.0);
break;
case MaterialTapTargetSize.collapsed:
break;
}

return new RawMaterialButton(
onPressed: onPressed,
Expand All @@ -417,9 +425,7 @@ class MaterialButton extends StatelessWidget {
),
shape: buttonTheme.shape,
child: child,
outerConstraints: theme.materialTapTargetSize == MaterialTapTargetSize.expanded
? const BoxConstraints(minHeight: 48.0)
: null,
outerConstraints: outerConstraints,
);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/flutter/lib/src/material/chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Icon _kDefaultDeleteIcon = const Icon(Icons.cancel, size: _kDeleteIconSize
///
/// The defaults mentioned in the documentation for each attribute are what
/// the implementing classes typically use for defaults (but this class doesn't
/// provide or enforce them).f
/// provide or enforce them).
///
/// See also:
///
Expand Down Expand Up @@ -1432,7 +1432,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
),
),
);
switch(theme.materialTapTargetSize) {
switch (theme.materialTapTargetSize) {
case MaterialTapTargetSize.expanded:
result = new ConstrainedBox(
constraints: const BoxConstraints(minWidth: 48.0, minHeight: 48.0),
Expand All @@ -1442,7 +1442,6 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
heightFactor: 1.0,
),
);

if (canTap) {
result = new GestureDetector(
behavior: HitTestBehavior.translucent,
Expand All @@ -1455,6 +1454,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
}
break;
case MaterialTapTargetSize.collapsed:
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

add a break here for symmetry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, here and elsewhere


return new Semantics(
Expand Down
12 changes: 9 additions & 3 deletions packages/flutter/lib/src/material/flat_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ class FlatButton extends StatelessWidget {
final ButtonThemeData buttonTheme = ButtonTheme.of(context);
final Color fillColor = enabled ? color : disabledColor;
final Color textColor = _getTextColor(theme, buttonTheme, fillColor);
BoxConstraints outerConstraints;
switch (theme.materialTapTargetSize) {
case MaterialTapTargetSize.expanded:
outerConstraints = const BoxConstraints(minHeight: 48.0, minWidth: 48.0);
break;
case MaterialTapTargetSize.collapsed:
break;
}

return new RawMaterialButton(
onPressed: onPressed,
Expand All @@ -291,9 +299,7 @@ class FlatButton extends StatelessWidget {
splashColor: _getSplashColor(theme, buttonTheme),
elevation: 0.0,
highlightElevation: 0.0,
outerConstraints: theme.materialTapTargetSize == MaterialTapTargetSize.expanded
? const BoxConstraints(minHeight: 48.0)
: null,
outerConstraints: outerConstraints,
padding: padding ?? buttonTheme.padding,
constraints: buttonTheme.constraints,
shape: shape ?? buttonTheme.shape,
Expand Down
13 changes: 9 additions & 4 deletions packages/flutter/lib/src/material/floating_action_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,21 @@ class _FloatingActionButtonState extends State<FloatingActionButton> {
result = widget.child != null ? tooltip : new SizedBox.expand(child: tooltip);
}

final BoxConstraints outerConstraints = (widget.mini && theme.materialTapTargetSize == MaterialTapTargetSize.expanded)
? const BoxConstraints(minHeight: 48.0, minWidth: 48.0)
: null;
BoxConstraints outerConstraints;
switch (theme.materialTapTargetSize) {
case MaterialTapTargetSize.expanded:
outerConstraints = const BoxConstraints(minHeight: 48.0, minWidth: 48.0);
break;
case MaterialTapTargetSize.collapsed:
break;
}

result = new RawMaterialButton(
onPressed: widget.onPressed,
onHighlightChanged: _handleHighlightChanged,
elevation: _highlight ? widget.highlightElevation : widget.elevation,
constraints: widget._sizeConstraints,
outerConstraints: outerConstraints,
outerConstraints: widget.mini ? outerConstraints : null,
fillColor: widget.backgroundColor ?? theme.accentColor,
textStyle: theme.accentTextTheme.button.copyWith(
color: foregroundColor,
Expand Down
9 changes: 9 additions & 0 deletions packages/flutter/lib/src/material/raised_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,14 @@ class RaisedButton extends StatelessWidget {
final ButtonThemeData buttonTheme = ButtonTheme.of(context);
final Color fillColor = _getFillColor(theme, buttonTheme);
final Color textColor = _getTextColor(theme, buttonTheme, fillColor);
BoxConstraints outerConstraints;
switch (theme.materialTapTargetSize) {
case MaterialTapTargetSize.expanded:
outerConstraints = const BoxConstraints(minHeight: 48.0, minWidth: 48.0);
break;
case MaterialTapTargetSize.collapsed:
break;
}

return new RawMaterialButton(
onPressed: onPressed,
Expand All @@ -381,6 +389,7 @@ class RaisedButton extends StatelessWidget {
shape: shape ?? buttonTheme.shape,
animationDuration: animationDuration,
child: child,
outerConstraints: outerConstraints
);
}

Expand Down
11 changes: 9 additions & 2 deletions packages/flutter/lib/src/material/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,23 @@ const Color _kDarkThemeSplashColor = const Color(0x40CCCCCC);

/// Configures the tap target and layout size of certain Material widgets.
///
/// The following widgets are impacted:
/// Some of the impacted widgets include:
///
/// * [FloatingActionButton], only the mini tap target size is increased.
/// * [MaterialButton]
/// * [OutlineButton]
/// * [FlatButton]
/// * [RaisedButton]
/// * [TimePicker]
/// * [SnackBar]
Copy link
Contributor

Choose a reason for hiding this comment

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

at least RawMaterialButton and RawChip are missing from this list. Maybe it should just say something like "Some of the affected widgets include" or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, though technically RawMaterialButton isn't effected since it specifically doesn't use ThemeData directly.

/// * [Chip]
/// * [RawChip]
/// * [InputChip]
/// * [ChoiceChip]
/// * [FilterChip]
/// * [ActionChip]
enum MaterialTapTargetSize {
/// Expands the minimum tap target size to 48dp by 48dp.
/// Expands the minimum tap target size to 48px by 48px.
///
/// This is the default value of [ThemeData.materialHitTestSize] and the
/// recommended behavior to conform to Android accessibility recommendations.
Expand Down
8 changes: 6 additions & 2 deletions packages/flutter/test/material/buttons_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ void main() {
new Directionality(
textDirection: TextDirection.ltr,
child: new Theme(
data: new ThemeData(),
data: new ThemeData(
materialTapTargetSize: MaterialTapTargetSize.collapsed,
),
child: buttonWidget,
),
),
Expand Down Expand Up @@ -233,6 +235,7 @@ void main() {
data: new ThemeData(
highlightColor: themeHighlightColor1,
splashColor: themeSplashColor1,
materialTapTargetSize: MaterialTapTargetSize.collapsed,
),
child: buttonWidget,
),
Expand Down Expand Up @@ -260,6 +263,7 @@ void main() {
data: new ThemeData(
highlightColor: themeHighlightColor2,
splashColor: themeSplashColor2,
materialTapTargetSize: MaterialTapTargetSize.collapsed,
),
child: buttonWidget, // same widget, so does not get updated because of us
),
Expand All @@ -274,7 +278,7 @@ void main() {
);

await gesture.up();
}, skip: true);
});

testWidgets('Disabled MaterialButton has same semantic size as enabled and exposes disabled semantics', (WidgetTester tester) async {
final SemanticsTester semantics = new SemanticsTester(tester);
Expand Down