Skip to content

Migrate remaining flutter_tools templates & widget_preview_scaffold to [material|cupertino]_ui - #193099

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
Piinks:depDesign-4
Sep 21, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
Piinks:depDesign-4

Conversation

@Piinks

@Piinks Piinks commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #192947 in preparation for deprecating package:flutter/material.dart and package:flutter/cupertino.dart
Part of un-blocking #192957

This PR migrates the remaining flutter_tools templates and test fixtures that run flutter analyze so they do not trigger deprecated_member_use diagnostics when the design libraries in package:flutter are deprecated:

  1. module template:
    • Migrates lib/main.dart.tmpl and test/widget_test.dart.tmpl to material_ui.
  2. widget_preview_scaffold:
    • Migrates the widget_preview_scaffold template files, hydrated scaffold sources, and tests to material_ui and cupertino_ui.
  3. **analyze_once_test.dart **:
    • Migrates the synthetic mainDartSrc fixture from package:flutter/material.dart to package:flutter/widgets.dart (WidgetsApp), since createDotPackages() constructs a minimal .dart_tool/package_config.json containing only flutter and sky_engine.

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.

@Piinks
Piinks requested review from bkonyi and justinmc September 21, 2026 14:48
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 21, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Sep 21, 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 replaces imports of package:flutter/material.dart and package:flutter/cupertino.dart with package:material_ui/material_ui.dart and package:cupertino_ui/cupertino_ui.dart across various integration tests, templates, and configuration files, adding them as dependencies. In analyze_once_test.dart, MaterialApp is replaced with WidgetsApp, and a new CustomButton widget is introduced. Feedback recommends wrapping the CustomButton's child in a GestureDetector to properly trigger its defined onPressed callback.

Comment on lines +407 to +415
class CustomButton extends StatelessWidget {
const CustomButton({Key? key, required this.onPressed, required this.child}) : super(key: key);

final VoidCallback onPressed;
final Widget child;

@override
Widget build(BuildContext context) => child;
}

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

The CustomButton widget defines an onPressed callback but does not use it in its build method. To make the button functional and avoid dead code, wrap the child in a GestureDetector that triggers onPressed when tapped.

Suggested change
class CustomButton extends StatelessWidget {
const CustomButton({Key? key, required this.onPressed, required this.child}) : super(key: key);
final VoidCallback onPressed;
final Widget child;
@override
Widget build(BuildContext context) => child;
}
class CustomButton extends StatelessWidget {
const CustomButton({Key? key, required this.onPressed, required this.child}) : super(key: key);
final VoidCallback onPressed;
final Widget child;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPressed,
child: child,
);
}
}

@bkonyi bkonyi 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! 🥳

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 21, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 21, 2026

@justinmc justinmc 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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants