Skip to content

Migrate layers example to material_ui - #190237

Merged
auto-submit[bot] merged 8 commits into
flutter:masterfrom
justinmc:layers-example-material_ui
Jul 30, 2026
Merged

auto-submit[bot] merged 8 commits into
flutter:masterfrom
justinmc:layers-example-material_ui

Conversation

@justinmc

@justinmc justinmc commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Migrates the layers example to material_ui. Maybe in the future we want to move this example to material_ui, or refactor it to not use material_ui, but this PR is not considering that for now.

I did a flutter run for each of the affected examples here, and they all ran fine.

Part of #190093.

@justinmc justinmc self-assigned this Jul 29, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jul 29, 2026
@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems d: examples Sample code and demos f: gestures flutter/packages/flutter/gestures repository. labels Jul 29, 2026

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

Copy link
Copy Markdown
Contributor

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 adds the material_ui package dependency to pubspec.yaml and replaces imports of package:flutter/material.dart with package:material_ui/material_ui.dart across multiple example files. The review feedback highlights several instances where the new imports violate the Effective Dart style guide, which requires import paths to be sorted alphabetically.

Comment on lines 8 to 9
import 'package:material_ui/material_ui.dart'; // Imported just for its color palette.
import 'package:flutter/rendering.dart';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the Effective Dart style guide, imports should be sorted alphabetically. package:flutter/rendering.dart should precede package:material_ui/material_ui.dart.

Suggested change
import 'package:material_ui/material_ui.dart'; // Imported just for its color palette.
import 'package:flutter/rendering.dart';
import 'package:flutter/rendering.dart';
import 'package:material_ui/material_ui.dart'; // Imported just for its color palette.
References
  1. Effective Dart: Style guidelines require sorting import paths alphabetically. (link)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it is enabled here, I just missed it.

- directives_ordering

Comment thread examples/layers/services/isolate.dart Outdated
Comment thread examples/layers/test/gestures_test.dart Outdated
Comment on lines 5 to 6
import 'package:material_ui/material_ui.dart';
import 'package:flutter/rendering.dart';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the Effective Dart style guide, imports should be sorted alphabetically. package:flutter/rendering.dart should precede package:material_ui/material_ui.dart.

Suggested change
import 'package:material_ui/material_ui.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/rendering.dart';
import 'package:material_ui/material_ui.dart';
References
  1. Effective Dart: Style guidelines require sorting import paths alphabetically. (link)

navaronbracke
navaronbracke previously approved these changes Jul 29, 2026

@navaronbracke navaronbracke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with nit

I'm fine with updating the examples checker after this lands (I just need to remove the samples from the list there), but up to you which to land first I suppose

Comment on lines 8 to 9
import 'package:material_ui/material_ui.dart'; // Imported just for its color palette.
import 'package:flutter/rendering.dart';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread examples/layers/pubspec.yaml
@justinmc

Copy link
Copy Markdown
Contributor Author

Let's try to get #187662 landed first I think!

navaronbracke
navaronbracke previously approved these changes Jul 30, 2026
'examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart',
'examples/flutter_view/lib/main.dart',
'examples/image_list/lib/main.dart',
'examples/layers/rendering/touch_input.dart',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah I didn't know about this list! I will update #190248 to remove splash here as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was just created a few hours ago in #187662 :)

@justinmc
justinmc requested a review from stuartmorgan-g July 30, 2026 17:09
Comment thread pubspec.lock
Comment on lines 221 to +676
@@ -658,6 +666,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.13.0"
material_ui:
dependency: transitive
description:
name: material_ui
sha256: e1fa67393d807bd1841e5ece1ec260ed84f440ae7351e40b6406f733e4fe31cf
url: "https://pub.dev"
source: hosted
version: "0.0.2"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I want to double check that this is not a problem, mainly with respect to circular dependencies as pointed out by @Piinks. The PR flutter/packages#12314 adds an import of the legacy Material/Cupertino code inside of material_ui and cupertino_ui.

@stuartmorgan do you have any insight here?

@Piinks Piinks Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The circular dependency would not be as a result of flutter/packages#12314. Material_ui and cupertino_ui are built on top of package:flutter. flutter/material and flutter/cupertino are part of package:flutter, so those imports for the sake of the migration bridge should be fine.

The circle here is that flutter/flutter would be importing cupertino_ui and material_ui. I think this might be unavoidable, but manageable in select cases - for example, updating the flutter create command to build the counter app with material_ui.

The concern here is, what happens if we make a change in the framework that breaks material_ui and/or cupertino_ui, and then renders this sample broken as a result? material_ui and cupertino_ui would not be able to update until the framework change rolls to stable. That's the kind of scenarios I was referring to that we need to be mindful of before introducing material_ui or cupertino_ui to flutter/flutter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Circular dependencies are never ideal, but I think the risk is pretty low when the circle is within an example; in the absolute worst case where we hit a hard circular update problem, we could temporarily change the example while it was resolved, for instance.

Also, I believe we've already accepted that we will have this conceptual circle in flutter create templates for some amount of time as well, so this doesn't increase our risk beyond that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oops, our comments passed in the aether :)

The concern here is, what happens if we make a change in the framework that breaks material_ui and/or cupertino_ui, and then renders this sample broken as a result? material_ui and cupertino_ui would not be able to update until the framework change rolls to stable.

Yes, this is the risk, which is why I've generally advised against circular dependencies. I would definitely encourage the team to think about a medium-term plan to avoid the need to import things from flutter/packages into this repo.

In the short term, if we hit breakages, there are various mitigations we could do. For instance, we could make a branch in flutter/packages with the fix, and temporarily have examples pull those via git dependencies.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thank you guys for the input. I've created #190305 to track moving these imports out of flutter/flutter, where it makes sense. For now let's move forward with these PRs as a part of #190093.

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jul 30, 2026
Merged via the queue into flutter:master with commit 4a6a70a Jul 30, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2026
@justinmc
justinmc deleted the layers-example-material_ui branch July 30, 2026 20:37
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Aug 9, 2026
…12401)

Manual roll Flutter from 2757a77a73df to e52f01c920ad (47 revisions)

Manual roll requested by [email protected]

flutter/flutter@2757a77...e52f01c

2026-07-31 [email protected] [Impeller] Execute PipelineCompileQueue jobs in the order that they were added (flutter/flutter#190262)
2026-07-31 [email protected] Roll Packages from 7d17fc8 to 5351d8c (5 revisions) (flutter/flutter#190351)
2026-07-31 [email protected] Roll Skia from dcbd015c9646 to 7ef86a5b0eb9 (4 revisions) (flutter/flutter#190347)
2026-07-31 [email protected] [Impeller] Do not acquire an unneeded image in KHRSwapchainVK if the swapchain must be recreated due to a size change (flutter/flutter#190116)
2026-07-31 [email protected] Remove the --enable-serial-gc engine flag (flutter/flutter#190310)
2026-07-31 [email protected] Migrate platform_channel_swift example to material_ui (flutter/flutter#190308)
2026-07-31 [email protected] macOS: Set static text accessibility role for read-only text fields (flutter/flutter#190330)
2026-07-31 [email protected] Roll Dart SDK from 96f49fc43f59 to c3acfc2479f6 (1 revision) (flutter/flutter#190336)
2026-07-31 [email protected] Roll Skia from 07f08414dd66 to dcbd015c9646 (1 revision) (flutter/flutter#190333)
2026-07-31 [email protected] [web] Autofill all AutofillGroup fields in semantics mode (flutter/flutter#187108)
2026-07-31 [email protected] iOS: Configure test task runner thread at display QoS (flutter/flutter#190283)
2026-07-31 [email protected] Roll Skia from a1109355de78 to 07f08414dd66 (5 revisions) (flutter/flutter#190328)
2026-07-31 [email protected] Support reduceMotion accessibility feature in MediaQuery (flutter/flutter#190287)
2026-07-30 [email protected] Roll Dart SDK from 43f7de5f4977 to 96f49fc43f59 (4 revisions) (flutter/flutter#190312)
2026-07-30 [email protected] fix: text selection two handles directionality. (flutter/flutter#179928)
2026-07-30 [email protected] Add java/gradle check when gradle crashes (flutter/flutter#189997)
2026-07-30 [email protected] [Impeller] Add filterQuality support to ImageFilter.shader (flutter/flutter#188544)
2026-07-30 [email protected] [flutter/flutter] Migrate multiple_windows example to material_ui (flutter/flutter#190313)
2026-07-30 [email protected] Roll Skia from 50cf67910462 to a1109355de78 (6 revisions) (flutter/flutter#190306)
2026-07-30 [email protected] Migrate swift xctests to Swift testing tests (flutter/flutter#187801)
2026-07-30 [email protected] Migrates the platform_channel example to material_ui (flutter/flutter#190253)
2026-07-30 [email protected] iOS: Drop unnecessary @mainactor from VSyncClientTests (flutter/flutter#190285)
2026-07-30 [email protected] Add nullptr check to isOpaque (flutter/flutter#189796)
2026-07-30 [email protected] [Flutter GPU] Bind uniforms and textures by cached reflection index (flutter/flutter#189820)
2026-07-30 [email protected] Migrate layers example to material_ui (flutter/flutter#190237)
2026-07-30 [email protected] Add `ShapeBorder` hit test fast paths (flutter/flutter#187962)
2026-07-30 [email protected] ci: mac-must-wait part duex (flutter/flutter#190295)
2026-07-30 [email protected] Roll Skia from 491301f393d1 to 50cf67910462 (3 revisions) (flutter/flutter#190294)
2026-07-30 [email protected] Roll Packages from dd11626 to 7d17fc8 (1 revision) (flutter/flutter#190293)
2026-07-30 [email protected] Roll Skia from 177de1940bf2 to 491301f393d1 (1 revision) (flutter/flutter#190279)
2026-07-30 [email protected] Roll Skia from b8bda91f02db to 177de1940bf2 (5 revisions) (flutter/flutter#190272)
2026-07-30 [email protected] Roll Fuchsia Linux SDK from J8rVTlBnjnUpuHYk3... to _J8wM3kyQpLN9wvRD... (flutter/flutter#190273)
2026-07-30 [email protected] Roll Skia from 78afc18c9ba0 to b8bda91f02db (3 revisions) (flutter/flutter#190268)
2026-07-30 [email protected] Revert: Split the platform and cpuArch part of TargetPlatform (flutter/flutter#190258)
2026-07-30 [email protected] Return null from RenderProxyBoxMixin.computeDryBaseline when the child has no baseline (flutter/flutter#189723)
2026-07-30 [email protected] Roll Skia from 6fea713d32ec to 78afc18c9ba0 (4 revisions) (flutter/flutter#190257)
2026-07-30 [email protected] Roll pub packages (flutter/flutter#190259)
2026-07-29 [email protected] [cross imports] Check examples cross imports (flutter/flutter#187662)
2026-07-29 [email protected] ci: mac verify binaries still has to wait on linux_host_engine (flutter/flutter#190239)
2026-07-29 [email protected] Adds analytics to macos impeller opt in/out (flutter/flutter#190220)
2026-07-29 [email protected] Roll Skia from 0f35bba4945c to 6fea713d32ec (6 revisions) (flutter/flutter#190230)
2026-07-29 [email protected] iOS: Fix Swift warning in TracingTests (flutter/flutter#190203)
2026-07-29 [email protected] Convert all gradle-wrapper.properties in /dev to use distribution 'bin' (flutter/flutter#190226)
2026-07-29 [email protected] Roll Packages from 3e63635 to dd11626 (11 revisions) (flutter/flutter#190216)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD d: examples Sample code and demos f: gestures flutter/packages/flutter/gestures repository.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants