Skip to content

Deprecate CupertinoDialog class #20397

Closed
Closed

Description

@matthew-carroll

CupertinoDialog and CupertinoAlertDialog have both existed for some time. For that time both dialogs have been rendered in a manner that does not match iOS accurately. Both dialogs essentially treated an iOS dialog as a generic modal comprised of a blurred rounded rect + some content. But this isn't what a dialog really is in iOS.

iOS only offers an alert dialog. There is no generic dialog. The alert dialog separates content from buttons with gap dividers that show through to the blurred area behind it. This is a very specific layout policy and therefore it does not generalize to some universal concept of a dialog.

Thus, CupertinoDialog is neither an existing iOS UI element, nor is it a faithful generalization of iOS layout and rendering policy. As a result, we should eliminate CupertinoDialog. Developers should either use CupertinoAlertDialog as a direct replacement for an alert dialog in iOS, or developers should create whatever their custom modal is (because no other modal is a legitimate iOS replica).

PS - If there are building blocks that we should provide to make it easier for developers to make iOS-ish dialogs, that may be completely legitimate and I'm happy to consider creating those building blocks.

Activity

  1. Hixie commented on Aug 9, 2018

    @Hixie
    Contributor

    Ideally, CupertinoDialog would just be the blurring part of CupertinoAlertDialog, I think, so that people who want to create new kinds of dialogs that look like iOS dialogs would get the same blurring effect for free.

  2. matthew-carroll commented on Aug 9, 2018

    @matthew-carroll
    ContributorAuthor

    @Hixie @xster pulling conversation here from email thread. Looks like both of you said the same thing.

    I think if we want to provide some kind of blurred box (which still won't do anything for people that need gaps), then I think we should offer it with a name that suggests a building block. The name CupertinoDialog seems far too official and high-level to me...the thing we're rendering is not a "dialog". Sure, it's modal, assuming you launch it with showDialog(), but that's completely outside the purview of what the current CupertinoDialog is doing. It really is just a rounded rect with a particular blur applied to it. It doesn't even include the white color on top because the alert dialog needs to add that with custom render objects.

    So if you really think people need the blurred rectangle then I would like to give it a much more accurate name.

    If not, then I'd like to get rid of it.

  3. xster commented on Aug 10, 2018

    @xster
    Member

    Sure, sounds reasonable. https://github.com/flutter/flutter/pull/7395/files#diff-dc35a23fd1ef0ca6af75e4a62218b990R58 's intent is more like a CupertinoDialogContainer or CupertinoDialogFrame than CupertinoDialog so we're stuck with the API break anyway. I'm ok with removing it.

  4. matthew-carroll commented on Aug 10, 2018

    @matthew-carroll
    ContributorAuthor

    @xster I'm not sure the word "dialog" belongs at all. This blurred box would be the same thing that is used for the action sheet, too, right?

  5. matthew-carroll commented on Aug 10, 2018

    @matthew-carroll
    ContributorAuthor

    Spoke with @Hixie offline. We're going to introduce a "CupertinoSurface" that knows how to render these blurred boxes. We're going to mark CupertinoDialog as deprecated and have it extend CupertinoSurface. Eventually we can delete CupertinoDialog when usages minimize.

  6. xster commented on Aug 10, 2018

    @xster
    Member

    I would just be cautious of overgeneralizing that class as well since it's not like class Material extends StatefulWidget which is used a bit everywhere. It's rather something like a CupertinoModalOverlaySurface

  7. matthew-carroll commented on Aug 10, 2018

    @matthew-carroll
    ContributorAuthor

    I agree with the sentiment. We discounted "overlay" because it already has a very specific meaning in Flutter. Modal concerns me a bit because I'm not clear on the definition of "modal". Does it include action sheets? Is anything that appears on a dark background considered a modal? What if iOS decides to use this blur effect in other situations?

    So I could probably get behind CupertinoModalSurface, but I need some convincing that we won't regret the "modal".

  8. xster commented on Aug 10, 2018

    @xster
    Member

    How's CupertinoPopupContainer?

    Modal is just anything that appears on top of something else that you need to deal with before going somewhere else. So it includes action sheets but I'm worried maybe one day it's possible that this thing summons something on top of it while remaining in the navigation stack.

    Popup is simple because by virtue of blurring and having a rrect, it implies it's on top of something else and covering it partially. If we either change the name or the implementation, they'll disconnect so much that we already broke the user's intent anyway for using it in the first place that they might as well already use a different API.

    Surface->Container to avoid conflating with Android surfaces and Container parallels what we mean with the word 'container' in flutter already.

  9. matthew-carroll commented on Aug 10, 2018

    @matthew-carroll
    ContributorAuthor

    I think I prefer CupertinoModalSurface on both counts.

    Modal seems more general than Popup, which I think is preferable.

    Container I think goes the wrong direction all the way. This thing is only a container in so far as it takes a child, but that's pretty much every widget in Flutter. What this thing is really providing is a particular kind of surface upon which you can paint whatever you want as a developer.

    Also, I think naming something similar to the existing Container is more likely to confuse people than sharing a name with an Android SDK class that refers to texture rendering.

  10. Hixie commented on Aug 13, 2018

    @Hixie
    Contributor

    It's not clear to me that "modal" is the right term. I could totally imagine using this for entirely non-modal widgets, e.g. tooltips, especially if we aren't including the scrim as part of the widget (it's in the route).

    CupertinoPopupSurface?

  11. matthew-carroll commented on Aug 13, 2018

    @matthew-carroll
    ContributorAuthor

    @Hixie how is a popup different than a modal?

    And if you're not confident that it will only be used as a modal, what makes you confident that it will only be used as a popup?

  12. changed the title [-]Remove CupertinoDialog class[/-] [+]Deprecate CupertinoDialog class[/+] on Aug 14, 2018
  13. Hixie commented on Aug 15, 2018

    @Hixie
    Contributor

    Modal and popup are orthogonal concepts. "Modal" means that you have to deal with the thing before you deal with the next. For example, the Emacs minibuffer is modal. "Popup" means that it is overlaid on top of other content. For example, notifications from chat clients are popups. One example of something for which you might use the feature here is the volume up/down overlays on iOS.

  14. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 21, 2018
  15. removed their assignment
    on May 14, 2019
  16. victorsanni commented on Jul 29, 2024

    @victorsanni
    Contributor

    Closing because this seems to have been fixed by #20649

  17. github-actions commented on Aug 13, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  18. locked as resolved and limited conversation to collaborators on Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: API breakBackwards-incompatible API changesc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: cupertino_uicupertino_ui package in flutter/packagesteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions