From 0ee567242689dd556db3dc7b543c17404a1c6884 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Sun, 9 Aug 2026 17:50:58 +0200 Subject: [PATCH] fix(ci): replace unused main.dart test wrappers with the public root shell The unused-code gate flags debugSetCrashReporterReady (referenced nowhere) and the formFactorScaleForTesting/rootShellForTesting wrappers (referenced only from tests, which the lib-scoped check cannot see). Delete the dead setter and let the car-scale test build the real rootShell and FormFactorScale directly. --- lib/main.dart | 20 +++++--------------- test/screens/car_ui_scale_test.dart | 4 ++-- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 72a5cd78..455adccb 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -350,9 +350,6 @@ StartupFailureRecord describeStartupFailure(Object error, StackTrace stackTrace) /// that anything was sent. var _crashReporterReady = false; -@visibleForTesting -void debugSetCrashReporterReady(bool ready) => _crashReporterReady = ready; - /// Sends a persisted startup failure to the crash reporter, once. /// /// Reporting cannot happen where the failure is caught. The gate opens @@ -1749,7 +1746,7 @@ class _AppShell extends StatelessWidget { const SingleActivator(LogicalKeyboardKey.browserBack): const DismissIntent(), const SingleActivator(LogicalKeyboardKey.gameButtonB): const DismissIntent(), }, - builder: (context, child) => _rootShell(child), + builder: (context, child) => rootShell(child), ), ), ); @@ -1767,8 +1764,8 @@ class _AppShell extends StatelessWidget { /// Flutter presents a messenger's snackbars on the rootmost registered scaffold, so anything /// below would leave global snackbars at the car's native density while the rest of the /// interface grew. -Widget _rootShell(Widget? child) { - return _FormFactorScale( +Widget rootShell(Widget? child) { + return FormFactorScale( child: ScaffoldMessenger( key: rootScaffoldMessengerKey, child: Scaffold(backgroundColor: Colors.transparent, body: child), @@ -1780,9 +1777,9 @@ Widget _rootShell(Widget? child) { /// report a very low display density. Both make otherwise comfortable controls /// physically too small, so render through a smaller, self-consistent logical /// viewport and scale the result back to the physical surface. -class _FormFactorScale extends StatelessWidget { +class FormFactorScale extends StatelessWidget { final Widget? child; - const _FormFactorScale({required this.child}); + const FormFactorScale({super.key, required this.child}); static const double _appleTvScale = 2.0; @@ -1848,13 +1845,6 @@ class _FormFactorScale extends StatelessWidget { } } -@visibleForTesting -Widget formFactorScaleForTesting({required Widget? child}) => _FormFactorScale(child: child); - -/// The real root shell, so a test can assert what the scale actually encloses. -@visibleForTesting -Widget rootShellForTesting({required Widget? child}) => _rootShell(child); - @visibleForTesting bool shouldBypassSetupForDatabaseRecovery(TvosDatabaseRecoveryOutcome outcome) { return outcome == TvosDatabaseRecoveryOutcome.recoveryRequired; diff --git a/test/screens/car_ui_scale_test.dart b/test/screens/car_ui_scale_test.dart index da2bff31..a0be8057 100644 --- a/test/screens/car_ui_scale_test.dart +++ b/test/screens/car_ui_scale_test.dart @@ -43,7 +43,7 @@ void main() { child: MaterialApp( theme: ThemeData(extensions: const [testMonoTokens]), home: const SizedBox.expand(), - builder: (context, child) => app.rootShellForTesting(child: child), + builder: (context, child) => app.rootShell(child), ), ), ); @@ -142,7 +142,7 @@ Future _pumpScaleHarness(WidgetTester tester, {required ValueChanged