surfaceAttrs function
Map<String, String>
surfaceAttrs({
- required String surface,
- required String id,
- bool initiallyOpen = false,
- bool dismissible = true,
- bool escapeCloses = true,
- bool focusTrap = true,
- bool scrimCloses = true,
- bool restoreFocus = true,
- String? anchorId,
- String? anchorPlacement,
- String? anchorOffset,
- String? anchorAlign,
- String? animation,
- String? group,
- bool exclusive = false,
Implementation
Map<String, String> surfaceAttrs({
required String surface,
required String id,
bool initiallyOpen = false,
bool dismissible = true,
bool escapeCloses = true,
bool focusTrap = true,
bool scrimCloses = true,
bool restoreFocus = true,
String? anchorId,
String? anchorPlacement,
String? anchorOffset,
String? anchorAlign,
String? animation,
String? group,
bool exclusive = false,
}) {
final Map<String, String> out = <String, String>{
'data-arcane-surface': surface,
'data-arcane-id': id,
'data-arcane-state': initiallyOpen ? 'open' : 'closed',
};
if (!dismissible) out['data-arcane-dismissible'] = 'false';
if (!escapeCloses) out['data-arcane-escape-closes'] = 'false';
if (!focusTrap) out['data-arcane-focus-trap'] = 'false';
if (!scrimCloses) out['data-arcane-scrim-closes'] = 'false';
if (!restoreFocus) out['data-arcane-restore-focus'] = 'false';
if (anchorId != null && anchorId.isNotEmpty) {
out['data-arcane-anchor'] = anchorId;
}
if (anchorPlacement != null && anchorPlacement.isNotEmpty) {
out['data-arcane-anchor-placement'] = anchorPlacement;
}
if (anchorOffset != null && anchorOffset.isNotEmpty) {
out['data-arcane-anchor-offset'] = anchorOffset;
}
if (anchorAlign != null && anchorAlign.isNotEmpty) {
out['data-arcane-anchor-align'] = anchorAlign;
}
if (animation != null && animation.isNotEmpty) {
out['data-arcane-animation'] = animation;
}
if (group != null && group.isNotEmpty) {
out['data-arcane-surface-group'] = group;
}
if (exclusive) out['data-arcane-exclusive'] = 'true';
if (!initiallyOpen) out['hidden'] = '';
return out;
}