Skip to content

[cupertino_ui] Main example - #12380

Merged
auto-submit[bot] merged 11 commits into
flutter:mainfrom
justinmc:meta-example-cupertino
Aug 10, 2026
Merged

[cupertino_ui] Main example#12380
auto-submit[bot] merged 11 commits into
flutter:mainfrom
justinmc:meta-example-cupertino

Conversation

@justinmc

Copy link
Copy Markdown
Contributor

This PR creates a main example to appear on pub at https://pub.dev/packages/cupertino_ui/example. It is simply a list of buttons that open some of our existing examples that might be useful for someone that's new to the package.

How to review

Most files were generated by running flutter create . inside the example/ directory (to make it a runnable example). The only files you really need to review are:

  • example/lib/main.dart
  • example/test/main_test.dart

Resources

See also the material_ui version of this: #12336

 test/widget_test.dart (created)
Resolving dependencies...
Downloading packages...
Got dependencies.
Wrote 4 files.
All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev
In order to run your application, type:
$ flutter run
Your application code is in ./lib/main.dart.
@justinmcjustinmc added the CICD Run CI/CD label Aug 5, 2026
@justinmc
justinmc marked this pull request as ready for review August 5, 2026 23:16

@gemini-code-assistgemini-code-assistBot 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 introduces a comprehensive example application for the cupertino_ui package, adding platform-specific runners and build configurations for Linux, macOS, Windows, and Web, as well as associated widget tests. Feedback on the changes identifies a compilation issue in the Windows runner utility due to an undefined macro, and recommends improvements in the main Dart file to enable a const constructor for the example app and simplify URL generation logic.

#include <stdio.h>
#include <windows.h>

#include <iostream>

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.

high

The macro UNICODE_STRING_MAX_CHARS is used in Utf8FromUtf16 but is not defined in standard Windows headers or the provided codebase. This will cause a compilation error. Please define it at the top of the file.

#include<iostream>// Maximum length of a UNICODE_STRING in characters.#defineUNICODE_STRING_MAX_CHARS 32767

Comment on lines +76 to +80
ExampleApp({super.key});

static const title = 'Cupertino Examples';

final _examples = <_Example>[

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

Making _examples a static final list allows ExampleApp to have a const constructor, which is a standard Flutter best practice for performance and widget reusability. Additionally, adding an explicit type annotation to the public title constant improves type safety and adheres to the style guide.

Suggested change
ExampleApp({super.key});
staticconst title ='Cupertino Examples';
final _examples =<_Example>[
constExampleApp({super.key});
staticconstStringtitle ='Cupertino Examples';
staticfinalList<_Example> _examples =<_Example>[

Comment on lines +373 to +384
String get url {
final segments = filepath.split('/');
assert(segments.length == 2);
final directory = segments.first;
final filename = segments.last;

final filenameSegments = filename.split('.');
assert(filenameSegments.length >= 3);
final number = filenameSegments[filenameSegments.length - 2];

return '/$directory/$filename/$number';
}

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 URL generation logic can be simplified and made more robust. Since filepath is already $directory/$filename, we can construct the URL directly using /$filepath/$number. This avoids unnecessary splitting and assumptions about the directory structure, making it safe for nested directories and removing the need for runtime asserts that are stripped in release builds.

Stringget url {
finalString filename = filepath.split('/').last;
finalList<String> filenameSegments = filename.split('.');
finalString number = filenameSegments.length >=3? filenameSegments[filenameSegments.length -2]
:'0';
return'/$filepath/$number';
}

@SwiftaxeSwiftaxe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks mostly good. Added a couple of comments.


static final _examples = <_Example>[
_Example(
'activity_indicator/cupertino_activity_indicator.0.dart',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Material UI examples have user-friendly titles like 'App bars', 'Badges', etc. Consider adding titles here as well.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good call!

Comment threadpackages/cupertino_ui/example/lib/main.dart

@SwiftaxeSwiftaxe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!

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

Super cool. LGTM 🎉

Comment threadpackages/cupertino_ui/pending_changelogs/change_2026_08_05.yaml Outdated
Grammar nit from Kate
Co-authored-by: Kate Lovett <katelovett@google.com>
@justinmcjustinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 10, 2026
@auto-submit
auto-submitBot merged commit aaaf246 into flutter:mainAug 10, 2026
13 checks passed
pullBot pushed a commit to Klomgor/flutter that referenced this pull request Aug 11, 2026
…r#190923)
flutter/packages@1861b68...aaaf246
2026-08-10 jmccandless@google.com [cupertino_ui] Main example
(flutter/packages#12380)
2026-08-10 katelovett@google.com Update ci for + releases
(flutter/packages#12419)
2026-08-10 engine-flutter-autoroll@skia.org Manual roll Flutter from
b766512 to 27b0988 (29 revisions) (flutter/packages#12420)
2026-08-10 engine-flutter-autoroll@skia.org Manual roll Flutter from
e52f01c to b766512 (42 revisions) (flutter/packages#12406)
2026-08-10 41930132+hellohuanlin@users.noreply.github.com [camera]fix
test flake due to expectation fulfilled before flag is toggled
(flutter/packages#12400)
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-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.
To file a bug in Flutter:
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit AppCICDRun CI/CDp: cupertino_uiplatform-linuxplatform-macosplatform-webplatform-windowstriage-frameworkShould be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@justinmc@Swiftaxe@Piinks