BankFraudAlertBanner class
High-priority fraud warning banner.
Deliberately resists accidental dismissal:
- No swipe-to-dismiss gesture.
- The onDismiss button is small and positioned as a secondary action.
- The primary action (onPrimaryAction) is the prominent call to act.
Visual treatment:
- A 4 px BankTokens.danger-coloured left border on a
danger.withValues(alpha: 0.08)background. - A Icons.gpp_bad_outlined fraud icon at the top-left.
- title in BankTokens.labelLarge (danger colour).
- body in BankTokens.bodySmall (BankThemeData.onSurface).
- Two action buttons side by side: FilledButton for primaryActionLabel, TextButton for dismissLabel.
Accessibility: the entire widget is annotated as Fraud alert: $title via
Semantics.
BankFraudAlertBanner(
title: 'Suspicious transaction detected',
body: 'A payment of £420 to an unknown recipient was attempted '
'on your account. Did you authorise this?',
primaryActionLabel: 'Secure My Account',
dismissLabel: 'Not me: dismiss',
onPrimaryAction: () => navigator.push(SecureAccountRoute()),
onDismiss: () => bloc.add(DismissFraudAlertEvent()),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- BankFraudAlertBanner
Constructors
- BankFraudAlertBanner({required String title, required String body, required String primaryActionLabel, required String dismissLabel, required VoidCallback onPrimaryAction, required VoidCallback onDismiss, Key? key, EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, Color? foregroundColor, Color? accentColor, IconData? icon, TextStyle? titleStyle, TextStyle? bodyStyle, String? semanticLabel})
-
const
Properties
- accentColor → Color?
-
Accent for the left border, icon, title, and primary button.
Defaults to BankTokens.danger.
final
- backgroundColor → Color?
-
Overrides the banner background. Defaults to the accent colour at
8% alpha.
final
- body → String
-
Detailed description of the suspected fraud.
final
- bodyStyle → TextStyle?
-
Merged over the computed body style (BankTokens.bodySmall in
BankThemeData.onSurface).
final
- dismissLabel → String
-
Label for the dismiss action button.
final
- foregroundColor → Color?
-
Overrides the body text colour. Defaults to
BankThemeData.onSurface.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → IconData?
-
Overrides the fraud glyph. Defaults to Icons.gpp_bad_outlined.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onDismiss → VoidCallback
-
Called when the user explicitly taps the dismiss button.
final
- onPrimaryAction → VoidCallback
-
Called when the user taps the primary action (e.g. "Secure My Account").
final
- padding → EdgeInsetsGeometry?
-
Overrides the content padding. Defaults to
EdgeInsets.all of BankTokens.space4.
final
- primaryActionLabel → String
-
Label for the primary action button.
final
- radius → BorderRadius?
-
Overrides the banner corner radius. Defaults to
BankThemeData.cardRadius.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Overrides the container semantics label. Defaults to
'Fraud alert: $title'.
final
- title → String
-
Short title summarising the security event.
final
- titleStyle → TextStyle?
-
Merged over the computed title style (BankTokens.labelLarge in
the accent colour).
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited