zonble / flutter_platform_alert

Plays native alert sound and shows native dialogs/alerts in your Flutter app.
https://pub.dev/packages/flutter_platform_alert
MIT License
74 stars 14 forks source link

fix: not passing iconPath on linux causing broken dialog #10

Closed alexmercerind closed 2 years ago

alexmercerind commented 2 years ago

If no iconPath is set from FlutterPlatformAlert.showCustomAlert, the string fallbacks to an empty string in the platform channel call. This causes dialog layout to be broken on Linux.

Equivalent Windows implementation checks for an empty string as opposed to a nullptr. While current Linux implementation was checking for a nullptr.

https://github.com/zonble/flutter_platform_alert/blob/13a2c28e6dc9b7424b3aa1d92f22d29189ef8b3d/windows/flutter_platform_alert_plugin.cpp#L376

Before:

Screenshot from 2022-07-23 11 39 54

Now:

Screenshot from 2022-07-23 11 42 52

Equivalent code:

final choice = await FlutterPlatformAlert.showCustomAlert(
  windowTitle: 'Update available: v0.2.7',
  text: 'You can\'t skip this one. Can you? 😏',
  positiveButtonTitle: 'Download now',
  negativeButtonTitle: 'Remind me next time',
  neutralButtonTitle: null,
  options: FlutterPlatformAlertOption(
    preferMessageBoxOnWindows: false,
    additionalWindowTitleOnWindows: 'Update',
    showAsLinksOnWindows: true,
  ),
);
zonble commented 2 years ago

Thanks!