Skip to content

Remove material imports from Inherited Model, Magnifier, SafeArea, UndoHistory, Navigator and Layers test#181709

Merged
auto-submit[bot] merged 2 commits intoflutter:masterfrom
rkishan516:inherited-model-cross-imports
Feb 19, 2026
Merged

Remove material imports from Inherited Model, Magnifier, SafeArea, UndoHistory, Navigator and Layers test#181709
auto-submit[bot] merged 2 commits intoflutter:masterfrom
rkishan516:inherited-model-cross-imports

Conversation

@rkishan516
Copy link
Contributor

@rkishan516 rkishan516 commented Jan 30, 2026

This PR removes Material imports from below given files

  • inherited_model_test.dart
  • magnifier_test.dart
  • safe_area_test.dart
  • undo_history_test.dart
  • navigator_and_layers_test.dart

part of: #177415
depends on: #181695

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Jan 30, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully removes Material Design dependencies from inherited_model_test.dart by replacing widgets like MaterialApp, Scaffold, and ElevatedButton with non-material alternatives. To support this, TestWidgetsApp has been enhanced with routing capabilities, and new tests have been added to verify this functionality. The changes are well-implemented and align with the goal of decoupling tests from the Material library. I've included a few suggestions to further improve the TestWidgetsApp implementation by aligning it with the Flutter style guide and increasing its robustness.

Comment on lines +54 to +60
const TestWidgetsApp({
super.key,
this.home,
this.routes = const <String, WidgetBuilder>{},
this.color = const Color(0xFFFFFFFF),
this.transitionsBuilder = _defaultTransitionsBuilder,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To align with the Flutter style guide and improve robustness, please reorder the constructor parameters alphabetically and add an assertion to ensure either home is provided or routes contains a default route.

  const TestWidgetsApp({
    super.key,
    this.color = const Color(0xFFFFFFFF),
    this.home,
    this.routes = const <String, WidgetBuilder>{},
    this.transitionsBuilder = _defaultTransitionsBuilder,
  }) : assert(home != null || routes.containsKey('/'), 'Either home must be specified, or routes must contain an entry for "/".');
References
  1. The Flutter style guide recommends that after the key parameter, other constructor parameters should be sorted alphabetically. (link)

Comment on lines +62 to +83
/// The widget to display within the app.
final Widget home;
final Widget? home;

/// The application's top-level routing table.
///
/// When a named route is pushed with [Navigator.pushNamed], the route name is
/// looked up in this map. If the name is present, the associated
/// [WidgetBuilder] is used to construct a [PageRouteBuilder] that performs
/// a fade transition to the new route.
///
/// Defaults to an empty map.
final Map<String, WidgetBuilder> routes;

/// The primary color for the application.
///
/// Defaults to white.
final Color color;

/// The transition builder used for page route animations.
///
/// Defaults to a simple [FadeTransition].
final RouteTransitionsBuilder transitionsBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the reordered constructor parameters and to follow logical grouping, please also reorder these fields alphabetically.

  /// The primary color for the application.
  ///
  /// Defaults to white.
  final Color color;

  /// The widget to display within the app.
  final Widget? home;

  /// The application's top-level routing table.
  ///
  /// When a named route is pushed with [Navigator.pushNamed], the route name is
  /// looked up in this map. If the name is present, the associated
  /// [WidgetBuilder] is used to construct a [PageRouteBuilder] that performs
  /// a fade transition to the new route.
  ///
  /// Defaults to an empty map.
  final Map<String, WidgetBuilder> routes;

  /// The transition builder used for page route animations.
  ///
  /// Defaults to a simple [FadeTransition].
  final RouteTransitionsBuilder transitionsBuilder;
References
  1. Other class members should be ordered logically (e.g., by lifecycle, or grouping related fields and methods). (link)

Comment on lines +85 to +90
static Widget _defaultTransitionsBuilder(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) => FadeTransition(opacity: animation, child: child);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The repository style guide requires documentation for all members, including private ones. Please add a doc comment for _defaultTransitionsBuilder.

  /// The default transition builder for [TestWidgetsApp].
  ///
  /// This builds a simple [FadeTransition].
  static Widget _defaultTransitionsBuilder(
    BuildContext context,
    Animation<double> animation,
    Animation<double> secondaryAnimation,
    Widget child,
  ) => FadeTransition(opacity: animation, child: child);
References
  1. Use /// for public-quality documentation, even on private members. (link)

@rkishan516 rkishan516 force-pushed the inherited-model-cross-imports branch 3 times, most recently from 1ea9701 to b0a8503 Compare January 31, 2026 02:32
@github-actions github-actions bot added the f: routes Navigator, Router, and related APIs. label Jan 31, 2026
@rkishan516 rkishan516 changed the title Remove material imports from Inherited Model Remove material imports from Inherited Model, Magnifier, SafeArea, UndoHistory, Navigator and Layers test Jan 31, 2026
@rkishan516 rkishan516 force-pushed the inherited-model-cross-imports branch 2 times, most recently from 1b22665 to d4b4ae0 Compare January 31, 2026 03:19
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #181709 at sha d4b4ae0

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Jan 31, 2026
@rkishan516 rkishan516 marked this pull request as draft February 5, 2026 01:55
@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@rkishan516 rkishan516 force-pushed the inherited-model-cross-imports branch from d4b4ae0 to 6e4ecba Compare February 17, 2026 02:10
@rkishan516 rkishan516 marked this pull request as ready for review February 17, 2026 02:11
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes Material library imports from several widget tests (inherited_model_test.dart, magnifier_test.dart, safe_area_test.dart, undo_history_test.dart, and navigator_and_layers_test.dart). This is achieved by replacing Material-specific widgets like MaterialApp, Scaffold, and ElevatedButton with their non-Material equivalents from the test framework, such as TestWidgetsApp and TestButton. The corresponding entries for these test files have also been removed from the check_tests_cross_imports.dart tool's allowlist, reflecting the successful decoupling of these tests from the Material library.

spreadRadius: 10.0,
blurRadius: 10.0,
color: Colors.yellow,
color: Color(0xFFFFFF00), // yellow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and performance, it's better to use const for color definitions when possible. This aligns with the 'Effective Dart: Style' guide, which is referenced in the repository's style guide.

                          color: const Color(0xFFFFFF00), // yellow
References
  1. The 'Effective Dart: Style' guide, referenced in the repository style guide, recommends using const for constant expressions to improve performance and ensure immutability. (link)

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #181709 at sha 6e4ecba

@victorsanni victorsanni requested a review from justinmc February 18, 2026 22:20
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thanks @rkishan516 !

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 18, 2026
@victorsanni
Copy link
Contributor

Goldens are expected because we are no longer using Material Colors.

@victorsanni victorsanni added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Feb 19, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Feb 19, 2026
Merged via the queue into flutter:master with commit de1b130 Feb 19, 2026
152 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2026
rickhohler pushed a commit to rickhohler/flutter that referenced this pull request Feb 19, 2026
…doHistory, Navigator and Layers test (flutter#181709)

This PR removes Material imports from below given files

* inherited_model_test.dart
* magnifier_test.dart
* safe_area_test.dart
* undo_history_test.dart
* navigator_and_layers_test.dart

part of: flutter#177415
depends on: flutter#181695

## 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.
@rkishan516 rkishan516 deleted the inherited-model-cross-imports branch February 20, 2026 03:06
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 20, 2026
…11088)

Manual roll Flutter from c023e5b2474f to 91b2d41a66d1 (31 revisions)

Manual roll requested by [email protected]

flutter/flutter@c023e5b...91b2d41

2026-02-19 [email protected] Reland #179643, only scroll hit-testable primary scroll views on status bar tap (flutter/flutter#182391)
2026-02-19 [email protected] Replace References to `flutter/engine` with `flutter/flutter` (flutter/flutter#182600)
2026-02-19 [email protected] Remove specific iOS extended attributes to fix code signing (flutter/flutter#180710)
2026-02-19 [email protected] Manual roll Skia from 7bbdc51ab0aa to ce5854495a3a (flutter/flutter#182637)
2026-02-19 [email protected] [pv]add integration test for original untappable web view link behind context menu bug (flutter/flutter#182111)
2026-02-19 [email protected] Roll pub packages (flutter/flutter#182579)
2026-02-19 [email protected] Remove Material import from scroll_view_test.dart (flutter/flutter#181281)
2026-02-19 [email protected] Add RawTooltip.ignorePointer (flutter/flutter#182527)
2026-02-19 [email protected] [web] Stop double loading fonts for WebParagraph (flutter/flutter#182026)
2026-02-19 [email protected] Migrate abi build paths to use new abi filtering api #AGP9 (flutter/flutter#181828)
2026-02-19 [email protected] [web] Flutter errors should be reported with console.error() (flutter/flutter#178886)
2026-02-19 [email protected] Manual roll Skia from dfe78d132e24 to 7bbdc51ab0aa (8 revisions) (flutter/flutter#182612)
2026-02-19 [email protected] Refactor autofill_group_test.dart to remove Material dependencies (flutter/flutter#181903)
2026-02-19 [email protected] Roll Packages from 59f905c to 9da22bf (8 revisions) (flutter/flutter#182611)
2026-02-19 [email protected] Roll Fuchsia Linux SDK from Ihau0pUz3u5ajw42u... to KfPgw04T0OEADLJA5... (flutter/flutter#182607)
2026-02-19 [email protected] Marks Mac_arm64_mokey entrypoint_dart_registrant unflaky (flutter/flutter#181648)
2026-02-19 [email protected] Remove material from Modal barrier tests (flutter/flutter#181708)
2026-02-19 [email protected] Remove material from ticker mode test (flutter/flutter#181696)
2026-02-19 [email protected] Remove material imports from Inherited Model, Magnifier, SafeArea, UndoHistory, Navigator and Layers test (flutter/flutter#181709)
2026-02-19 [email protected] docs: fix grammar in animation library documentation (flutter/flutter#182461)
2026-02-19 [email protected] Handle#6537 first grouped tests (flutter/flutter#182077)
2026-02-19 [email protected] Move SelectionArea web test from widgets to material folder (flutter/flutter#181951)
2026-02-19 [email protected] Roll Dart SDK from 44895e617182 to 2642761fca94 (6 revisions) (flutter/flutter#182572)
2026-02-19 [email protected] Update create template to always generate both SwiftPM and CocoaPods support for iOS/macOS plugins (flutter/flutter#181251)
2026-02-18 [email protected] Fix(Material): DateRangePicker ignores DatePickerTheme.dayShape (flutter/flutter#181658)
2026-02-18 [email protected] Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry … (flutter/flutter#180814)
2026-02-18 [email protected] Give guided error message when CocoaPod and SwiftPM dependency conflicts (flutter/flutter#182392)
2026-02-18 [email protected] Remove material from interactive_viewer_test.dart (flutter/flutter#181465)
2026-02-18 [email protected] Bring Windows misc coverage out of bringup (flutter/flutter#182332)
2026-02-18 [email protected] Update android symbolication instructions (flutter/flutter#181267)
2026-02-18 [email protected] Unmark stable vulkan platform view tests as bringup (flutter/flutter#182554)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
…doHistory, Navigator and Layers test (flutter#181709)

This PR removes Material imports from below given files

* inherited_model_test.dart
* magnifier_test.dart
* safe_area_test.dart
* undo_history_test.dart
* navigator_and_layers_test.dart

part of: flutter#177415
depends on: flutter#181695

## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

Development

Successfully merging this pull request may close these issues.

4 participants