showActionSheet static method

Future<void> showActionSheet({
  1. required CPActionSheetTemplate template,
  2. bool animated = true,
})

It will present CPActionSheetTemplate modally.

  • template is to present modally.
  • If animated is true, CarPlay animates the presentation of the template.

! CarPlay can only present one modal template at a time.

Implementation

static Future<void> showActionSheet({
  required CPActionSheetTemplate template,
  bool animated = true,
}) {
  return FlutterCarPlayController.flutterToNativeModule(
    FCPChannelTypes.setActionSheet,
    <String, dynamic>{
      'rootTemplate': template.toJson(),
      'animated': animated,
    },
  ).then((value) {
    if (value == true) {
      FlutterCarPlayController.currentPresentTemplate = template;
    }
  });
}