From 2a5f7e0c66f7649c18b37e6ff576c653165a5a8b Mon Sep 17 00:00:00 2001 From: abdessalem Date: Tue, 22 Sep 2026 12:13:13 +0100 Subject: [PATCH] Remove `useInheritedMediaQuery` flag in `CupertinoApp` --- packages/cupertino_ui/lib/src/app.dart | 20 ---------------- .../change_2026_09_22_1790075518108.yaml | 3 +++ packages/cupertino_ui/test/app_test.dart | 23 ------------------- 3 files changed, 3 insertions(+), 43 deletions(-) create mode 100644 packages/cupertino_ui/pending_changelogs/change_2026_09_22_1790075518108.yaml diff --git a/packages/cupertino_ui/lib/src/app.dart b/packages/cupertino_ui/lib/src/app.dart index cc968ea0fef1..8650150c57bd 100644 --- a/packages/cupertino_ui/lib/src/app.dart +++ b/packages/cupertino_ui/lib/src/app.dart @@ -200,12 +200,6 @@ class CupertinoApp extends StatefulWidget { this.actions, this.restorationScopeId, this.scrollBehavior, - @Deprecated( - 'Remove this parameter as it is now ignored. ' - 'CupertinoApp never introduces its own MediaQuery; the View widget takes care of that. ' - 'This feature was deprecated after v3.7.0-29.0.pre.', - ) - this.useInheritedMediaQuery = false, }) : routeInformationProvider = null, routeInformationParser = null, routerDelegate = null, @@ -242,12 +236,6 @@ class CupertinoApp extends StatefulWidget { this.actions, this.restorationScopeId, this.scrollBehavior, - @Deprecated( - 'Remove this parameter as it is now ignored. ' - 'CupertinoApp never introduces its own MediaQuery; the View widget takes care of that. ' - 'This feature was deprecated after v3.7.0-29.0.pre.', - ) - this.useInheritedMediaQuery = false, }) : assert(routerDelegate != null || routerConfig != null), navigatorObservers = null, navigatorKey = null, @@ -462,14 +450,6 @@ class CupertinoApp extends StatefulWidget { /// in a subtree. final ScrollBehavior? scrollBehavior; - /// {@macro flutter.widgets.widgetsApp.useInheritedMediaQuery} - @Deprecated( - 'This setting is now ignored. ' - 'CupertinoApp never introduces its own MediaQuery; the View widget takes care of that. ' - 'This feature was deprecated after v3.7.0-29.0.pre.', - ) - final bool useInheritedMediaQuery; - @override State createState() => _CupertinoAppState(); diff --git a/packages/cupertino_ui/pending_changelogs/change_2026_09_22_1790075518108.yaml b/packages/cupertino_ui/pending_changelogs/change_2026_09_22_1790075518108.yaml new file mode 100644 index 000000000000..a9a4febab1b4 --- /dev/null +++ b/packages/cupertino_ui/pending_changelogs/change_2026_09_22_1790075518108.yaml @@ -0,0 +1,3 @@ +changelog: | + - Remove deprecated `useInheritedMediaQuery` flag in CupertinoApp +version: minor \ No newline at end of file diff --git a/packages/cupertino_ui/test/app_test.dart b/packages/cupertino_ui/test/app_test.dart index 8480ef73e8f7..feeb60446720 100644 --- a/packages/cupertino_ui/test/app_test.dart +++ b/packages/cupertino_ui/test/app_test.dart @@ -456,29 +456,6 @@ void main() { ); }); - testWidgets( - 'When `useInheritedMediaQuery` is true an existing MediaQuery is used if one is available', - (WidgetTester tester) async { - late BuildContext capturedContext; - final uniqueKey = UniqueKey(); - await tester.pumpWidget( - MediaQuery( - key: uniqueKey, - data: const MediaQueryData(), - child: CupertinoApp( - useInheritedMediaQuery: true, - builder: (BuildContext context, Widget? child) { - capturedContext = context; - return const Placeholder(); - }, - color: const Color(0xFF123456), - ), - ), - ); - expect(capturedContext.dependOnInheritedWidgetOfExactType()?.key, uniqueKey); - }, - ); - testWidgets('CupertinoApp uses the dark SystemUIOverlayStyle when the background is light', ( WidgetTester tester, ) async {