From 4e00cfc25a88ba1d2d45aaa4e2650f3b0fdca60d Mon Sep 17 00:00:00 2001 From: Kazbek Sultanov Date: Fri, 23 Jan 2026 10:59:15 +0400 Subject: [PATCH] Remove unnecessary Material import from sliver_visibility_test (#181248) Remove the Material import from sliver_visibility_test.dart since it's only testing SliverVisibility, a widgets-level component. The test doesn't need Material-specific functionality - it only uses DefaultWidgetsLocalizations.delegate which provides sufficient localization support. Changes: - Replaced `import 'package:flutter/material.dart'` with `import 'package:flutter/widgets.dart'` - Removed `DefaultMaterialLocalizations.delegate` from the localizations delegates list This helps with the decoupling of Material and Cupertino from the core framework. Part of #177412 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --- dev/bots/check_tests_cross_imports.dart | 1 - .../flutter/test/widgets/sliver_visibility_test.dart | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dev/bots/check_tests_cross_imports.dart b/dev/bots/check_tests_cross_imports.dart index 2366fdc59d0..16e6748f4bf 100644 --- a/dev/bots/check_tests_cross_imports.dart +++ b/dev/bots/check_tests_cross_imports.dart @@ -247,7 +247,6 @@ class TestsCrossImportChecker { 'packages/flutter/test/widgets/baseline_test.dart', 'packages/flutter/test/widgets/selection_container_test.dart', 'packages/flutter/test/widgets/scrollable_semantics_test.dart', - 'packages/flutter/test/widgets/sliver_visibility_test.dart', 'packages/flutter/test/widgets/rotated_box_test.dart', 'packages/flutter/test/widgets/single_child_scroll_view_test.dart', 'packages/flutter/test/widgets/pinned_header_sliver_test.dart', diff --git a/packages/flutter/test/widgets/sliver_visibility_test.dart b/packages/flutter/test/widgets/sliver_visibility_test.dart index adb7e35433a..8db1d368023 100644 --- a/packages/flutter/test/widgets/sliver_visibility_test.dart +++ b/packages/flutter/test/widgets/sliver_visibility_test.dart @@ -2,16 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'semantics_tester.dart'; class TestState extends StatefulWidget { const TestState({super.key, required this.child, required this.log}); + final Widget child; final List log; + @override State createState() => _TestStateState(); } @@ -38,10 +40,7 @@ void main() { Widget boilerPlate(Widget sliver) { return Localizations( locale: const Locale('en', 'us'), - delegates: const >[ - DefaultWidgetsLocalizations.delegate, - DefaultMaterialLocalizations.delegate, - ], + delegates: const >[DefaultWidgetsLocalizations.delegate], child: Directionality( textDirection: TextDirection.ltr, child: MediaQuery(