Privacy mask
PrivacyMask hides what it wraps behind a plain surface and a lock icon while obscured is true. Use it for account numbers, identity details and balances that should not show in the app switcher or on a shared screen.
Decide when to obscure, usually from the app lifecycle. The mask covers the Flutter content only; it does not stop the operating system from capturing the screen, so add platform screenshot protection yourself.


PrivacyMask( obscured: obscured, child: const Text('3100000000001234'), );Variants
Section titled “Variants”Variants: visible, obscured.
Obscured
Section titled “Obscured”The child stays laid out underneath, so nothing jumps when the mask lifts. The cover uses PaymentTheme.surface with a 48 px lock icon in textSecondary. The lock keeps 16 dp from the cover’s edges, and in a strip shorter than the icon it scales down instead of filling the strip.
Which variant when
Section titled “Which variant when”| Situation | Variant / composition | Payment example |
|---|---|---|
| App switcher protection | obscured | Cover sensitive screen content when the host says it is obscured. |
Use masked text for NIK in review.
States
Section titled “States”obscured: true covers the content and removes it from semantics. The host decides when sensitive content should be hidden.
Do and don’t
Section titled “Do and don’t”Do: Cover sensitive screen content when the host says it is obscured.
Don’t: Claim PrivacyMask encrypts or persists data securely.
Content guidelines
Section titled “Content guidelines”- Mask whole blocks, not single digits. A half-covered number still leaks.
- Unmask as soon as the app is active again. The mask is not a lock screen; it asks for nothing.
Accessibility
Section titled “Accessibility”- While obscured, the child is excluded from semantics and screen readers hear “Content hidden” instead.
PrivacyMask
class PrivacyMask extends StatelessWidget · lib/src/foundation/primitives.dart
Covers sensitive content when obscured is true, for example while the host app is in the app switcher. OS-level screenshot protection remains the host's responsibility.
| Parameter | Type | Default | Description |
|---|---|---|---|
obscured:required | bool | — | — |
child:required | Widget | — | — |
See also
Section titled “See also”- Host-owned decisions, privacy boundary.
- Verification (KYC)