Unverified Commit 4a7b4a4d authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

increase size of user account drawer headers to 48 by 48 (#20266)

parent d041b319
...@@ -31,13 +31,16 @@ class _AccountPictures extends StatelessWidget { ...@@ -31,13 +31,16 @@ class _AccountPictures extends StatelessWidget {
end: 0.0, end: 0.0,
child: new Row( child: new Row(
children: (otherAccountsPictures ?? <Widget>[]).take(3).map((Widget picture) { children: (otherAccountsPictures ?? <Widget>[]).take(3).map((Widget picture) {
return new Semantics( return new Container(
explicitChildNodes: true, margin: const EdgeInsetsDirectional.only(start: 8.0),
child: new Container( width: 48.0,
margin: const EdgeInsetsDirectional.only(start: 16.0), height: 48.0,
width: 40.0, child: new Semantics(
height: 40.0, container: true,
child: picture child: new Padding(
child: picture,
padding: const EdgeInsets.all(4.0),
),
), ),
); );
}).toList(), }).toList(),
......
...@@ -98,8 +98,8 @@ void main() { ...@@ -98,8 +98,8 @@ void main() {
expect(avatarATopLeft.dx - topLeft.dx, equals(16.0 + 10.0)); // left padding expect(avatarATopLeft.dx - topLeft.dx, equals(16.0 + 10.0)); // left padding
expect(avatarATopLeft.dy - topLeft.dy, equals(16.0 + 20.0)); // add top padding expect(avatarATopLeft.dy - topLeft.dy, equals(16.0 + 20.0)); // add top padding
expect(topRight.dx - avatarDTopRight.dx, equals(16.0 + 30.0)); // right padding expect(topRight.dx - avatarDTopRight.dx, equals(16.0 + 34.0)); // right padding
expect(avatarDTopRight.dy - topRight.dy, equals(16.0 + 20.0)); // add top padding expect(avatarDTopRight.dy - topRight.dy, equals(16.0 + 24.0)); // add top padding
expect(avatarDTopRight.dx - avatarCTopRight.dx, equals(40.0 + 16.0)); // size + space between expect(avatarDTopRight.dx - avatarCTopRight.dx, equals(40.0 + 16.0)); // size + space between
}); });
...@@ -374,6 +374,27 @@ void main() { ...@@ -374,6 +374,27 @@ void main() {
semantics.dispose(); semantics.dispose();
}); });
testWidgets('alternative account selectors have sufficient tap targets', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await pumpTestWidget(tester);
expect(tester.getSemanticsData(find.text('B')), matchesSemanticsData(
label: 'B',
size: const Size(48.0, 48.0),
));
expect(tester.getSemanticsData(find.text('C')), matchesSemanticsData(
label: 'C',
size: const Size(48.0, 48.0),
));
expect(tester.getSemanticsData(find.text('D')), matchesSemanticsData(
label: 'D',
size: const Size(48.0, 48.0),
));
handle.dispose();
});
testWidgets('UserAccountsDrawerHeader provides semantics with missing properties', (WidgetTester tester) async { testWidgets('UserAccountsDrawerHeader provides semantics with missing properties', (WidgetTester tester) async {
final SemanticsTester semantics = new SemanticsTester(tester); final SemanticsTester semantics = new SemanticsTester(tester);
await pumpTestWidget( await pumpTestWidget(
......
...@@ -306,6 +306,7 @@ Matcher matchesSemanticsData({ ...@@ -306,6 +306,7 @@ Matcher matchesSemanticsData({
String value, String value,
TextDirection textDirection, TextDirection textDirection,
Rect rect, Rect rect,
Size size,
// Flags // // Flags //
bool hasCheckedState = false, bool hasCheckedState = false,
bool isChecked = false, bool isChecked = false,
...@@ -447,6 +448,7 @@ Matcher matchesSemanticsData({ ...@@ -447,6 +448,7 @@ Matcher matchesSemanticsData({
flags: flags, flags: flags,
textDirection: textDirection, textDirection: textDirection,
rect: rect, rect: rect,
size: size,
customActions: customActions, customActions: customActions,
hintOverrides: hintOverrides, hintOverrides: hintOverrides,
); );
...@@ -1478,6 +1480,7 @@ class _MatchesSemanticsData extends Matcher { ...@@ -1478,6 +1480,7 @@ class _MatchesSemanticsData extends Matcher {
this.actions, this.actions,
this.textDirection, this.textDirection,
this.rect, this.rect,
this.size,
this.customActions, this.customActions,
this.hintOverrides, this.hintOverrides,
}); });
...@@ -1491,6 +1494,7 @@ class _MatchesSemanticsData extends Matcher { ...@@ -1491,6 +1494,7 @@ class _MatchesSemanticsData extends Matcher {
final List<SemanticsFlag> flags; final List<SemanticsFlag> flags;
final TextDirection textDirection; final TextDirection textDirection;
final Rect rect; final Rect rect;
final Size size;
@override @override
Description describe(Description description) { Description describe(Description description) {
...@@ -1509,6 +1513,8 @@ class _MatchesSemanticsData extends Matcher { ...@@ -1509,6 +1513,8 @@ class _MatchesSemanticsData extends Matcher {
description.add('with textDirection: $textDirection '); description.add('with textDirection: $textDirection ');
if (rect != null) if (rect != null)
description.add('with rect: $rect'); description.add('with rect: $rect');
if (size != null)
description.add('with size: $size');
if (customActions != null) if (customActions != null)
description.add('with custom actions: $customActions'); description.add('with custom actions: $customActions');
if (hintOverrides != null) if (hintOverrides != null)
...@@ -1530,9 +1536,10 @@ class _MatchesSemanticsData extends Matcher { ...@@ -1530,9 +1536,10 @@ class _MatchesSemanticsData extends Matcher {
return failWithDescription(matchState, 'value was: ${data.value}'); return failWithDescription(matchState, 'value was: ${data.value}');
if (textDirection != null && textDirection != data.textDirection) if (textDirection != null && textDirection != data.textDirection)
return failWithDescription(matchState, 'textDirection was: $textDirection'); return failWithDescription(matchState, 'textDirection was: $textDirection');
if (rect != null && rect != data.rect) { if (rect != null && rect != data.rect)
return failWithDescription(matchState, 'rect was: $rect'); return failWithDescription(matchState, 'rect was: ${data.rect}');
} if (size != null && size != data.rect.size)
return failWithDescription(matchState, 'size was: ${data.rect.size}');
if (actions != null) { if (actions != null) {
int actionBits = 0; int actionBits = 0;
for (SemanticsAction action in actions) for (SemanticsAction action in actions)
......
...@@ -483,11 +483,11 @@ void main() { ...@@ -483,11 +483,11 @@ void main() {
final SemanticsData data = new SemanticsData( final SemanticsData data = new SemanticsData(
flags: flags, flags: flags,
actions: actions, actions: actions,
label: '', label: 'a',
increasedValue: '', increasedValue: 'b',
value: '', value: 'c',
decreasedValue: '', decreasedValue: 'd',
hint: '', hint: 'e',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0), rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
textSelection: null, textSelection: null,
...@@ -498,6 +498,8 @@ void main() { ...@@ -498,6 +498,8 @@ void main() {
); );
expect(data, matchesSemanticsData( expect(data, matchesSemanticsData(
rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
size: const Size(10.0, 10.0),
/* Flags */ /* Flags */
hasCheckedState: true, hasCheckedState: true,
isChecked: true, isChecked: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment