Skip to content

showCustomAlert style logic has broken in iOS #27

@touyou

Description

@touyou

I use the showCustomAlert method to use the alert of confirmation.
In v0.6.1, showCustomAlert cannot apply the IosAlertOptions config. So I wrote the code below, and then showCustomAlert would show a strange alert, such as the image.

FlutterPlatformAlert.showCustomAlert(
  windowTitle: '削除',
  text: '削除します。よろしいですか?',
  positiveButtonTitle: '削除',
  negativeButtonTitle: 'キャンセル',
  options: PlatformAlertOptions(
    ios: IosAlertOptions(
      positiveButtonStyle: IosButtonStyle.destructive,
      negativeButtonStyle: IosButtonStyle.cancel,
    ),
  ),
).then((result) {
  if (result == CustomButton.positiveButton) {
    Logger().d('削除しました');
  }
});
image

So please fix it.


I tried to find the reason for this, so I saw it.
Comparing FlutterPlatformAlertPlugin.swift in v0.6.1 and SwiftFlutterPlatformAlertPlugin.swift in v0.5.3, I found that v0.5.3 uses styles by args["...ButtonStyle"], but v0.6.1 uses styles by args["...ButtonTitle"], so if users set a word that does not mean abort or cancel, then users fail to set style properly.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions