diff --git a/dashboard/lib/build_dashboard_page.dart b/dashboard/lib/build_dashboard_page.dart index a09d957ad5..96a6f694d7 100644 --- a/dashboard/lib/build_dashboard_page.dart +++ b/dashboard/lib/build_dashboard_page.dart @@ -119,10 +119,11 @@ class BuildDashboardPageState extends State { 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( diff --git a/dashboard/test/build_dashboard_page_test.dart b/dashboard/test/build_dashboard_page_test.dart index edefc4920a..96afd79891 100644 --- a/dashboard/test/build_dashboard_page_test.dart +++ b/dashboard/test/build_dashboard_page_test.dart @@ -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( + value: fakeBuildState, + child: ValueProvider( + 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)), + ); + }); }