Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CupertinoListSection and CupertinoListTile #78732

Merged
merged 19 commits into from Jul 19, 2022

Conversation

campovski
Copy link
Contributor

@campovski campovski commented Mar 21, 2021

This pull request adds two important widgets that were missing, a CupertinoListSection (a close relative of Material Design ListView) and a CupertinoListTile (a iOS-style twin of Material Design ListTile).

D99B6A58-B6E7-4B10-AC3F-CEB00EF5801D
8BDF3105-8FD0-423C-8A94-BA8126057C80
BEB0C1D4-E3D1-49C1-8515-8A3D17A54032
C7A7C150-B6E8-48DC-B1D4-90E142DABAE6

Fixes #19228

Repo flutter/tests left intact.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • 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 feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

Pull Request steps

  • Implement CupertinoListSection and CupertinoListTile.
  • Dedup code between these widgets and CupertinoFormSection and CupertinoFormRow.
  • Add tests for CupertinoListSection and CupertinoListTile. These tests should be similar to the ones already present for CupertinoFormSection and CupertinoFormRow.
  • Organize PR into meaningful commits.
  • Review the code before removing Draft.

@flutter-dashboard flutter-dashboard bot added f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels. labels Mar 21, 2021
@google-cla google-cla bot added the cla: yes label Mar 21, 2021
@skia-gold
Copy link

Gold has detected about 5 untriaged digest(s) on patchset 2.
View them at https://flutter-gold.skia.org/cl/github/78732

@skia-gold
Copy link

Gold has detected about 5 untriaged digest(s) on patchset 3.
View them at https://flutter-gold.skia.org/cl/github/78732

@skia-gold
Copy link

Gold has detected about 5 untriaged digest(s) on patchset 4.
View them at https://flutter-gold.skia.org/cl/github/78732

@bsr203
Copy link

bsr203 commented May 20, 2021

hi @campovski do you happen to have the source of demo screens from above available? It looks great and thank you for the work on it.

@campovski
Copy link
Contributor Author

campovski commented May 20, 2021

@bsr203 I am glad you find this useful! I am just sorry that I didn't have so much time lately to finish this PR.

Yes, the examples are available here.

@bsr203
Copy link

bsr203 commented May 21, 2021

@campovski thanks a lot for getting back to me and your time building the examples. I copies your code to latest flutter and it didn't give any error. Will try out the examples of usage. Thanks again for sharing your work. Cheers.

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@skia-gold
Copy link

Gold has detected about 57 new digest(s) on patchset 16.
View them at https://flutter-gold.skia.org/cl/github/78732

Copy link
Contributor

@albertodev01 albertodev01 left a comment

Choose a reason for hiding this comment

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

Found some minor things that could be addressed

/// The [onTap] function is called when a user taps on [CupertinoListTile]. If
/// left `null`, the [CupertinoListTile] will not show any visual information
/// when tapped.
final Future<void> Function()? onTap;
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why is this declared as final Future<void> Function()? onTap; rather than final void Function()? onTap; (or, in an equivalent form, final VoidCallback? onTap;)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. I think I have had an usecase where this needed to be a Future<void> but it makes sense to turn this into a VoidCallback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should not be a VoidCallback for the following reason: pressing a "list tile" on iOS that navigates to a new route, highlights that list tile. Once the route is poped, the list tile is still highlighted in remains to be so, until route is completely popped. If this function completes instantly, given current implementation (simple yet effective) the list tile become not highlighted instantly.

It would make sense to turn this into a FutureOr<void> function, however AFAIR this is against Flutter coding standards. I will however still convert this to a FutureOr<void> Function()? onTap.

packages/flutter/lib/src/cupertino/list_section.dart Outdated Show resolved Hide resolved
packages/flutter/lib/src/cupertino/list_section.dart Outdated Show resolved Hide resolved
@Hixie
Copy link
Contributor

Hixie commented Jan 24, 2022

@campovski At a high level this looks great. It probably needs some work e.g. resolving analysis issues and some code review comments and such, but before I get too into the weeds I wanted to ask you what the best way to help you is. Are you still interested in landing this? (I'm painfully aware that it has taken us months to get to it and I'm really sorry about that.)

@campovski
Copy link
Contributor Author

@Hixie Yes, I would like to land this, however unfortunately I haven't got time lately to work on Flutter in general. What I am a bit worried about this PR is organizing it into meaningful commits. I did my best to do so when I actively developed this feature but now it became a bit of a mess with last few commits.

Nonetheless, I promise to resolve the analysis issues and comments tomorrow. Looking forward to it!

@Hixie
Copy link
Contributor

Hixie commented Jan 24, 2022

Please don't feel like I'm rushing you, I'm obviously in no position to do so since we've been so slow here. Your contributions are massively welcome regardless. :-)

@campovski
Copy link
Contributor Author

@Hixie just wanted to let you know that this PR is now ready.

The analysis errors have been fixed and CR comments either applied or (I believe justiable) answered.

Please, explicitly say, if it is required, that this PR be organised into meaningful commits.

@Hixie
Copy link
Contributor

Hixie commented Feb 4, 2022

No, no need to worry about the commits. It all gets squashed into one when it lands anyway. The only reason to worry about the commits is if doing so would make it notably easier to review (e.g. if one commit is all automated fixes created by a regular expression, or something, vs hand-written code).

@campovski
Copy link
Contributor Author

Ok, that was my thought as well but since this PR affects just a few files, it is probably redundant to organize commits, I agree.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 24, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 24, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
@manuel-plavsic
Copy link

Which flutter stable version will include these new widgets?

@jmagman
Copy link
Member

jmagman commented Aug 2, 2022

This merged in commit 0c40945 and right now is only available in the master channel. You can follow along on that commit as tags get added to it https://github.com/flutter/flutter/wiki/Where's-my-Commit%3F#finding-the-versions-that-contain-framework-commit-x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: fidelity Matching the OEM platforms better c: new feature Nothing broken; request for a new capability f: cupertino flutter/packages/flutter/cupertino repository f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a CupertinoTableRow and CupertinoTable