Add visual density to the gallery options (#46090)
This PR adds an option to the gallery options that sets the visual density to one of "standard" (the default), "comfortable", or "compact".
This commit is contained in:
@@ -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;
|
||||
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;
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user