Skip to content

Refactor flutter_view example to not use material - #190377

Merged
auto-submit[bot] merged 9 commits into
flutter:masterfrom
Renzo-Olivares:flutter_view_revamp
Aug 10, 2026
Merged

auto-submit[bot] merged 9 commits into
flutter:masterfrom
Renzo-Olivares:flutter_view_revamp

Conversation

@Renzo-Olivares

@Renzo-Olivares Renzo-Olivares commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

This PR refactors the flutter_view example to not use material.

It also migrates the iOS app to utilize the UIScene lifecycle. Without the migration the app refused to run, and showed the error below.

failure in void _UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption(void)_block_invoke (UIApplication_RuntimeIssues.m:106) : Application
  failed to launch: UIScene life cycle is required for apps built with this SDK. See "Transitioning to the UIKit scene-based life cycle" in the UIKit
  documentation for more information on migration.

Android:

Screen.Recording.2026-07-31.at.6.13.12.PM.mov

iOS:

Screen.Recording.iPhone.17.Pro.07-31-2026.at.5.40.35.PM.mp4

Part of #190305

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • 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 d: examples Sample code and demos label Jul 31, 2026
@Renzo-Olivares
Renzo-Olivares marked this pull request as ready for review August 1, 2026 01:14

@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 migrates the flutter_view example from using Material Design (MaterialApp, Scaffold, FloatingActionButton) to a lightweight implementation using WidgetsApp and custom widgets. It also adds iOS SceneDelegate support for the UISceneSession lifecycle. Feedback suggests defining a default textStyle in WidgetsApp to eliminate redundant styling on individual Text widgets, and updating the custom _FloatingActionButton constructor to support super.key.

Comment thread examples/flutter_view/lib/main.dart
Comment thread examples/flutter_view/lib/main.dart
Comment thread examples/flutter_view/lib/main.dart Outdated
Comment thread examples/flutter_view/lib/main.dart
Comment thread examples/flutter_view/lib/main.dart Outdated
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@Renzo-Olivares Renzo-Olivares added the CICD Run CI/CD label Aug 3, 2026
@Renzo-Olivares
Renzo-Olivares requested a review from justinmc August 3, 2026 18:12
@Piinks Piinks added the framework flutter/packages/flutter repository. See also f: labels. label Aug 3, 2026
navaronbracke
navaronbracke previously approved these changes Aug 4, 2026
@navaronbracke

Copy link
Copy Markdown
Contributor

This will also need to be removed from the examples checker, though

justinmc
justinmc previously approved these changes Aug 4, 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, but as @navaronbracke said I thought you would have to remove this file from the cross import checker. I don't know how CI is passing. Maybe this PR was created before that checker was added?

'examples/flutter_view/lib/main.dart',

Comment thread examples/flutter_view/lib/main.dart Outdated
}
}

class Button extends StatelessWidget {

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: Maybe make it private so it's clear to readers that it's not part of Flutter.

@navaronbracke

Copy link
Copy Markdown
Contributor

LGTM, but as @navaronbracke said I thought you would have to remove this file from the cross import checker. I don't know how CI is passing. Maybe this PR was created before that checker was added?

'examples/flutter_view/lib/main.dart',

I've wondered that before. Is it running in CI?

@Renzo-Olivares
Renzo-Olivares dismissed stale reviews from justinmc and navaronbracke via b667481 August 5, 2026 17:43
@github-actions github-actions Bot removed the framework flutter/packages/flutter repository. See also f: labels. label Aug 5, 2026
@Renzo-Olivares

Copy link
Copy Markdown
Contributor Author

@justinmc pointed out this PR was on a flutter base that did not contain check_examples_cross_imports.dart so maybe that's why the test was not failing. I've rebased and removed flutter_view from the list.

relativePath.startsWith('examples/api/test/widgets') =>
_ApiExampleLibrary(relativePath),
_
when relativePath.startsWith('examples/flutter_view') ||

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.

Is it necessary to delete flutter_view from here as well?

@navaronbracke navaronbracke Aug 5, 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.

No, this is part of the checker itself. I'd just remove it from the exclusion list and leave the rest as is.

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.

+1, leaving this means the checker will continue to check this directory, which it should do in case we ever accidentally add a cross import back in there.

justinmc
justinmc previously approved these changes Aug 5, 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.

Re LGTM 👍

Comment thread examples/flutter_view/lib/main.dart Outdated
}

class _Button extends StatelessWidget {
const _Button({super.key, required this.onPressed, required this.icon});

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.

Looks like this is failing CI because key is never used.

justinmc
justinmc previously approved these changes Aug 6, 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 👍

@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 but heads up there appear to be unrelated failures.

@Renzo-Olivares Renzo-Olivares added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 10, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 10, 2026
Merged via the queue into flutter:master with commit 55e4f9c Aug 10, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD d: examples Sample code and demos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants