showSystemWindow static method

Future<bool?> showSystemWindow({
  1. required SystemWindowHeader header,
  2. SystemWindowBody? body,
  3. SystemWindowFooter? footer,
  4. SystemWindowMargin? margin,
  5. SystemWindowGravity gravity = SystemWindowGravity.CENTER,
  6. int? width,
  7. int? height,
  8. String notificationTitle = "Title",
  9. String notificationBody = "Body",
  10. SystemWindowPrefMode prefMode = SystemWindowPrefMode.DEFAULT,
  11. Color backgroundColor = Colors.white,
  12. bool isDisableClicks = false,
})

Show System Window

header Header content of the window body Body content of the window footer Footer content of the window margin Margin for the window gravity Position of the window and default is SystemWindowGravity.CENTER width Width of the window and default is Constants.MATCH_PARENT height Height of the window and default is Constants.WRAP_CONTENT notificationTitle Notification title, applicable in case of bubble notificationBody Notification body, applicable in case of bubble prefMode Preference for the system window. Default is SystemWindowPrefMode.DEFAULT backgroundColor Background color for the system window. Default is Colors.white. This will be the default background color for header, body, footer isDisableClicks Disables the clicks across the system window. Default is false. This is not applicable for bubbles.

Implementation

static Future<bool?> showSystemWindow(
    {required SystemWindowHeader header,
    SystemWindowBody? body,
    SystemWindowFooter? footer,
    SystemWindowMargin? margin,
    SystemWindowGravity gravity = SystemWindowGravity.CENTER,
    int? width,
    int? height,
    String notificationTitle = "Title",
    String notificationBody = "Body",
    SystemWindowPrefMode prefMode = SystemWindowPrefMode.DEFAULT,
    Color backgroundColor = Colors.white,
    bool isDisableClicks = false}) async {
  final Map<String, dynamic> params = <String, dynamic>{
    'header': header.getMap(),
    'body': body?.getMap(),
    'footer': footer?.getMap(),
    'margin': margin?.getMap(),
    'gravity': Commons.getWindowGravity(gravity),
    'width': width ?? Constants.MATCH_PARENT,
    'height': height ?? Constants.WRAP_CONTENT,
    'bgColor': backgroundColor.toHex(leadingHashSign: true, withAlpha: true),
    'isDisableClicks': isDisableClicks
  };
  return await _channel.invokeMethod('showSystemWindow', [
    notificationTitle,
    notificationBody,
    params,
    Commons.getSystemWindowPrefMode(prefMode)
  ]);
}