Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion dashboard/lib/build_dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {

Widget _settingsDialog(BuildContext context, BuildState buildState) {
final ThemeData theme = Theme.of(context);
final Color backgroundColor = theme.brightness == Brightness.dark ? Colors.grey[800]! : Colors.white;
return Center(
child: Container(
decoration: BoxDecoration(
color: theme.dialogBackgroundColor.withAlpha(0xe0),
color: backgroundColor.withAlpha(0xe0),
borderRadius: BorderRadius.circular(20.0),
),
child: Material(
Expand Down
50 changes: 50 additions & 0 deletions dashboard/test/build_dashboard_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -618,4 +618,54 @@ void main() {

expect(find.byType(dropdownButtonType), findsNWidgets(2));
});

testWidgets('Settings dialog default background color', (WidgetTester tester) async {
configureView(tester.view);
final BuildState fakeBuildState = FakeBuildState()
..isTreeBuilding = true
..authService = fakeAuthService;
const String dialogText = 'Refresh GitHub Commits';
ThemeData theme;
Widget buildDashboard({required Brightness brightness}) {
theme = ThemeData(useMaterial3: false, brightness: brightness);
return MaterialApp(
theme: theme,
home: ValueProvider<BuildState>(
value: fakeBuildState,
child: ValueProvider<GoogleSignInService>(
value: fakeBuildState.authService,
child: const BuildDashboardPage(),
),
),
);
}

// Test dashboard in light mode.
await tester.pumpWidget(buildDashboard(brightness: Brightness.light));
await tester.tap(find.byIcon(Icons.settings));
await tester.pump();

Finder dialogContainer = find.ancestor(
of: find.text(dialogText),
matching: find.byType(Container),
);
expect(
dialogContainer,
paints..rrect(color: Colors.white.withAlpha(0xe0)),
);

// Test dashboard in dark mode.
await tester.pumpWidget(buildDashboard(brightness: Brightness.dark));
await tester.tap(find.byIcon(Icons.settings));
await tester.pump(const Duration(seconds: 1)); // Finish changing theme.

dialogContainer = find.ancestor(
of: find.text(dialogText),
matching: find.byType(Container),
);
expect(
dialogContainer,
paints..rrect(color: Colors.grey[800]!.withAlpha(0xe0)),
);
});
}