Reland "Revert "Add visual density to the gallery options (#46090)"... (#47702)" (#48094)

This reverts commit e46671f323.
This commit is contained in:
Francisco Magdaleno
2020-01-02 15:50:59 -08:00
committed by GitHub
parent dc99d61e5d
commit a46d1791fc
4 changed files with 119 additions and 6 deletions

View File

@@ -54,16 +54,40 @@ void main() {
// Switch back to system theme setting: first menu button, choose 'System Default'
await tester.tap(find.byIcon(Icons.arrow_drop_down).first);
await tester.pumpAndSettle();
await tester.tap(find.text('System Default').at(1));
await tester.tap(find.descendant(
of: find.byWidgetPredicate((Widget widget) => widget.runtimeType.toString() == 'PopupMenuItem<ThemeMode>'),
matching: find.text('System Default')
));
await tester.pumpAndSettle();
app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
expect(app.themeMode, ThemeMode.system);
// Verify density settings
expect(app.theme.visualDensity, equals(const VisualDensity()));
// Popup the density menu: third menu button, choose 'Compact'
await tester.tap(find.byIcon(Icons.arrow_drop_down).at(2));
await tester.pumpAndSettle();
await tester.tap(find.text('Compact'));
await tester.pumpAndSettle();
app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
expect(app.theme.visualDensity, equals(VisualDensity.compact));
await tester.tap(find.byIcon(Icons.arrow_drop_down).at(2));
await tester.pumpAndSettle();
await tester.tap(find.descendant(
of: find.byWidgetPredicate((Widget widget) => widget.runtimeType.toString() == 'PopupMenuItem<GalleryVisualDensityValue>'),
matching: find.text('System Default')
));
await tester.pumpAndSettle();
app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
expect(app.theme.visualDensity, equals(const VisualDensity()));
// Verify platform settings
expect(app.theme.platform, equals(TargetPlatform.android));
// Popup the platform menu: third menu button, choose 'Cupertino'
await tester.tap(find.byIcon(Icons.arrow_drop_down).at(2));
// Popup the platform menu: fourth menu button, choose 'Cupertino'
await tester.tap(find.byIcon(Icons.arrow_drop_down).at(3));
await tester.pumpAndSettle();
await tester.tap(find.text('Cupertino').at(1));
await tester.pumpAndSettle();
@@ -85,7 +109,10 @@ void main() {
// Set font scale back to the default.
await tester.tap(find.byIcon(Icons.arrow_drop_down).at(1));
await tester.pumpAndSettle();
await tester.tap(find.text('System Default').at(1));
await tester.tap(find.descendant(
of: find.byWidgetPredicate((Widget widget) => widget.runtimeType.toString() == 'PopupMenuItem<GalleryTextScaleValue>'),
matching: find.text('System Default')
));
await tester.pumpAndSettle();
textSize = tester.getSize(find.text('Text size'));
expect(textSize, origTextSize);