Skip to content

CupertinoDialogAction.isDefaultAction is a misleading name #32005

Closed

Description

@LongCatIsLooong

CupertinoDialogAction.isDefaultAction is a misleading name for iOS developers.

On iOS UIAlertAction.Style is an enum with 3 cases:

case `default`
case cancel
case destructive

CupertinoDialogAction's constructor's signature:

const CupertinoDialogAction({
  VoidCallback onPressed,
  bool isDefaultAction: false,
  bool isDestructiveAction: false,
  TextStyle textStyle,
  @required Widget child
})

where isDefaultAction is easily mistakable for the default case but they do different things and are not mutually exclusive.

Should probably explicitly state in the documentation that isDefaultAction is not the same as UIAlertAction.Style.default

Version

Channel master, v1.5.9-pre.117

Activity

  1. added
    d: api docsIssues with https://api.flutter.dev/
    p: cupertino_uicupertino_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    on May 2, 2019
  2. riccardoratta commented on May 3, 2019

    @riccardoratta
    Contributor

    I propose a constructor like this Inspired to LKAlertController library for iOS.

    const CupertinoDialogAction({
      VoidCallback onPressed,
      ActionStyle style = ActionStyle.Default,
      TextStyle textStyle,
      bool preferredAction = false, // this will bold the text in the child
      @required Widget child,
    })

    with the enum:

    enum ActionStyle {
      /// Apply the default style to the action’s button.
      Default,
      /// Apply a style that indicates the action cancels the operation and leaves things unchanged.
      Cancel,
      /// Apply a style that indicates the action might change or delete data.
      Destructive,
    }
  3. github-actions commented on Aug 29, 2021

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

  4. locked as resolved and limited conversation to collaborators on Aug 29, 2021
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

    d: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.p: cupertino_uicupertino_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions