firstActionMetadata method
Implementation
InlineBannerActionMetadata firstActionMetadata(VariableScope scope) {
final steps = optList(resolvedOnClick(scope), 'steps') ?? const [];
for (final rawStep in steps.whereType<Map>()) {
final step = rawStep.cast<String, dynamic>();
final type = optString(step, 'type');
final data = optMap(step, 'data') ?? const <String, dynamic>{};
switch (type) {
case 'Action.openUrl':
final url = optString(data, 'url');
final launchMode = optString(data, 'launchMode');
return InlineBannerActionMetadata(
actionType: launchMode == 'platformDefault' ? 'deeplink' : 'url',
actionUrl: url.isEmpty ? null : url,
);
case 'Action.share':
return const InlineBannerActionMetadata(actionType: 'share');
case 'Action.copyToClipBoard':
return const InlineBannerActionMetadata(actionType: 'copy');
case 'Action.customKV':
return const InlineBannerActionMetadata(actionType: 'custom_kv');
}
}
return const InlineBannerActionMetadata();
}