Skip to content

Move examples of flutter/widgets widgets out from flutter/material - #189532

Merged
auto-submit[bot] merged 12 commits into
flutter:masterfrom
dkwingsmt:move-test-to-widgets
Aug 5, 2026
Merged

auto-submit[bot] merged 12 commits into
flutter:masterfrom
dkwingsmt:move-test-to-widgets

Conversation

@dkwingsmt

@dkwingsmt dkwingsmt commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

There are several example files that are testing widgets defined in flutter/widgets, but the example files are located in flutter/material. This PR moves these example files to flutter/widgets, so that they'll continue working after we remove flutter/material.

In order to simplify reviewing, this PR does not change any of these example files. Resolving the cross-import is for another PR (likely by somebody else).

A corresponding PR, flutter/packages#12179, has been landed to remove these files from flutter/packages/material_ui.

After this PR, flutter/widgets still refer to two examples in flutter/material:

  • examples/api/lib/material/selection_area/selection_area.1.dart
  • examples/api/lib/material/selection_area/selection_area.2.dart

However, SelectionArea is a Material widget. Referring them in flutter/widgets is likely wrong, and I assume resolving them might needs more non-trivial changes.

Note to reviewers: This PR is of very low priority. It only blocks removing material from this repo. So take your time to review.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. 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.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jul 15, 2026
@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jul 15, 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 moves several API examples and their corresponding tests from the material directory to the widgets directory, updating the documentation references in the core Flutter framework widgets accordingly. The review feedback highlights multiple syntax errors across the newly added example and test files, specifically pointing out invalid implicit member expressions (leading dots) used for enums, constructors, and platform checks, as well as an incorrect import path in a test file.

Comment thread examples/api/test/widgets/expansible/expansible.0_test.dart Outdated
Comment thread examples/api/lib/widgets/expansible/expansible.0.dart
Comment thread examples/api/lib/widgets/expansible/expansible.0.dart
Comment thread examples/api/lib/widgets/selectable_region/selectable_region.0.dart
Comment thread examples/api/lib/widgets/selectable_region/selectable_region.0.dart
@dkwingsmt
dkwingsmt requested a review from Piinks July 15, 2026 21:41
@navaronbracke
navaronbracke self-requested a review July 16, 2026 08:30
// subtree in response to user gestures.

import 'package:flutter/foundation.dart';
import 'package:flutter/material.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.

FYI: I'm in the process of trying to land a check in dev/bots that checks these cross imports for the examples (still need to figure out something for the code freeze, related to Cupertino)

See #187662 for context

Since this example lives under api/lib/widgets but imports Material, it will get flagged by the new check, once it lands.

Short term we can just rebaseline the examples checker to include these examples (since they were moved), but in the long term these should not rely on Material or Cupertino. That on its own is in some case a point of discussion, because things like the context menu are a bit of a cross boundary case.

@dkwingsmt dkwingsmt Jul 16, 2026 •

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.

Oh that check sound great!

Yeah, eventually these tests should not rely on M or C. As I said in the PR description, these tests are moved verbatim to simplify reviewing this PR. Fully solving cross import is for another PR. I believe there are still lots of widget examples that have rely on material, since solving cross import in the framework is of lower priority.

I think we have to land this PR eventually before we remove material, but that's a long time ahead. We can land your check first if it makes your life easier. :)

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.

We definitely need the check, because there's a lot of such examples :)

I'm fine with either. All I need to do is run the checker script and update the exclusion list.

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.

Would you like to review this PR and, if we can get it landed, remove some uncertainty off of your PR?

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
navaronbracke
navaronbracke previously approved these changes Jul 17, 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 some nits I noticed while reviewing the samples.


class _EditableTextToolbarBuilderExampleAppState
extends State<EditableTextToolbarBuilderExampleApp> {
final TextEditingController _controller = TextEditingController(

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.

This controller is not disposed. Do we have leak testing enabled for the examples? If not then maybe we should file an issue for this.

Should we add the dispose call in this PR?

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.

Done.

ContextMenuButtonItem buttonItem,
) {
return CupertinoButton(
color: const Color(0xffaaaa00),

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.

Nit: Uppercase color hex numbers?

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.

Done.


class _EditableTextToolbarBuilderExampleAppState
extends State<EditableTextToolbarBuilderExampleApp> {
final TextEditingController _controller = TextEditingController(text: text);

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.

This controller is also not disposed

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.

Done.

// Here we add an "Email" button to the default TextField
// context menu for the current platform, but only if an email
// address is currently selected.
final TextEditingValue value = _controller.value;

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.

Take the value from editableTextState.textEditingValue instead of the controller?

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.

Done.

Comment thread examples/api/lib/widgets/platform_menu_bar/platform_menu_bar.0.dart

@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.

One minor remark about the two text editing controllers

Comment thread examples/api/lib/widgets/context_menu/editable_text_toolbar_builder.0.dart Outdated
Comment thread examples/api/lib/widgets/context_menu/editable_text_toolbar_builder.0.dart Outdated
Comment thread examples/api/lib/widgets/context_menu/editable_text_toolbar_builder.1.dart Outdated
navaronbracke
navaronbracke previously approved these changes Jul 17, 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 modulo fixing Tree Analyze

The code freeze check is failing because examples/api/material is part of the freeze.

Piinks
Piinks previously approved these changes Jul 30, 2026

@Piinks Piinks 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.

This LGTM, and I think is safe to land over the code freeze.

@Piinks

Piinks commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

There is a merge conflict, and an analyzer warning.

@dkwingsmt
dkwingsmt dismissed stale reviews from Piinks and navaronbracke via 680b9ca July 30, 2026 20:36
@dkwingsmt
dkwingsmt requested a review from Piinks July 30, 2026 20:52
@dkwingsmt dkwingsmt added the override code freeze Override an active code freeze. label Jul 30, 2026
@Piinks

Piinks commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The analyzer is still unhappy :(

@Piinks Piinks 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.

Re-LGTM!

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2026
@auto-submit

auto-submit Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/189532, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 4, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 5, 2026
Merged via the queue into flutter:master with commit 3fdac69 Aug 5, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Aug 10, 2026
…12420)

Manual roll requested by [email protected]

flutter/flutter@b766512...27b0988

2026-08-05 [email protected] reland(tool): remove redundant --enable-experiment=record-use flag (flutter/flutter#190591)
2026-08-05 [email protected] Windows: Propagate enabled accessibility state (flutter/flutter#190507)
2026-08-05 [email protected] Roll Fuchsia Test Scripts from ltbuIH9Z3T_yOuigu... to vcANVO8VIDQHasH1X... (flutter/flutter#190589)
2026-08-05 [email protected] Document frozen embedder API structs (flutter/flutter#186842)
2026-08-05 [email protected] Document super call order for State.didChangeDependencies (flutter/flutter#185945)
2026-08-05 [email protected] Move examples of `flutter/widgets` widgets out from `flutter/material` (flutter/flutter#189532)
2026-08-05 [email protected] [web] Use thread local strike caches in skwasm (flutter/flutter#190048)
2026-08-05 [email protected] doc: fix typo in see also section for PrimaryScrollController.maybeOf (flutter/flutter#190386)
2026-08-05 [email protected] Migrate the shell unit tests from legacy Dart native functions to FFI (flutter/flutter#190473)
2026-08-05 [email protected] render proxy box now defaults baseline calculation to null (flutter/flutter#190269)
2026-08-05 [email protected] Update Widgets Localizations from Translation Console (flutter/flutter#190503)
2026-08-04 [email protected] Revert: fix(tool): remove redundant --enable-experiment=record-use flag (flutter/flutter#190583)
2026-08-04 [email protected] Roll Fuchsia Test Scripts from 1frGe_KltAJKkeyPg... to ltbuIH9Z3T_yOuigu... (flutter/flutter#190561)
2026-08-04 [email protected] iOS,macOS: add tsan and ubsan support for Swift (flutter/flutter#190497)
2026-08-04 [email protected] fix: update on_message_ to nullptr after window destroy so that dart gets destroy message  (flutter/flutter#185807)
2026-08-04 [email protected] [flutter_tools] Gracefully handle locked Windows files during clean (flutter/flutter#190095)
2026-08-04 [email protected] iOS,macOS: make Logger thread-safe, conform to Sendable (flutter/flutter#190488)
2026-08-04 [email protected] iOS: Eliminate use of IOSContextNoop in platform view tests (reland) (flutter/flutter#190509)
2026-08-04 [email protected] fix(tool): remove redundant --enable-experiment=record-use flag (flutter/flutter#190475)
2026-08-04 [email protected] android_hardware_smoke_test: Detect blank image failures or EGL initialization warnings and retry (flutter/flutter#190110)
2026-08-04 [email protected] Bumps text gamma on windows to match skia. (flutter/flutter#190477)
2026-08-04 [email protected] Roll Skia from 48b58ee222f1 to a8583a0a2c11 (2 revisions) (flutter/flutter#190537)
2026-08-04 [email protected] [tool][web] Intercept dart2wasm errors & append JS migration footers (flutter/flutter#190476)
2026-08-04 [email protected] [record_use] Migrate IconTreeShaker to `package:record_use` (flutter/flutter#190225)
2026-08-04 [email protected] Handle unexpected exceptions during Azure metadata detection (flutter/flutter#189457)
2026-08-04 [email protected] Fix merge conflict from flutter/flutter#190369 (flutter/flutter#190544)
2026-08-04 [email protected] Prepare device support symbols (flutter/flutter#190369)
2026-08-04 [email protected] Roll Packages from ac87e65 to 3498b9d (1 revision) (flutter/flutter#190532)
2026-08-04 [email protected] Roll Skia from a08d918ebd6a to 48b58ee222f1 (11 revisions) (flutter/flutter#190527)

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:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. override code freeze Override an active code freeze.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants