BankAccountSwitcher class

Bottom-sheet or inline widget for selecting among multiple bank accounts.

Typically presented as a modal bottom sheet via BankAccountSwitcher.show:

final selected = await BankAccountSwitcher.show(
  context,
  accounts: myAccounts,
  selectedAccountId: currentAccount.id,
);
if (selected != null) { /* switch to selected */ }

When embedded inline (e.g. inside an existing sheet), construct the widget directly and provide an onSelected callback.

Each row is 72 px tall and follows the 44×44 minimum tap-target rule. A drag handle is rendered at the top of the sheet for discoverability. Privacy mode is respected: balances are masked when BankUiScopeData.privacyEnabled is true.

Inheritance

Constructors

BankAccountSwitcher({required List<BankAccount> accounts, required ValueChanged<BankAccount> onSelected, Key? key, String? selectedAccountId, Widget itemBuilder(BuildContext, BankAccount, bool isSelected)?, Color? backgroundColor, BorderRadius? radius, Color? handleColor, Widget? header, EdgeInsetsGeometry? padding, double? maxHeightFraction, double? rowHeight, TextStyle? titleStyle, TextStyle? subtitleStyle, TextStyle? amountStyle, IconData? selectedIcon, Color? accentColor})
const

Properties

accentColor Color?
Overrides the accent used for the checkmark and ink splash. Defaults to the theme primary.
final
accounts List<BankAccount>
The list of accounts to display.
final
amountStyle TextStyle?
Merged over each row's balance style (BankTokens.numeralSmall).
final
backgroundColor Color?
Overrides the sheet background colour. Defaults to the theme surface.
final
handleColor Color?
Overrides the drag-handle colour. Defaults to the theme outline.
final
hashCode int
The hash code for this object.
no setterinherited
Optional widget rendered between the drag handle and the list, e.g. a sheet title. Defaults to nothing.
final
itemBuilder Widget Function(BuildContext, BankAccount, bool isSelected)?
Optional full override for each row. When non-null, this builder is called instead of the default _AccountRow for every list item.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxHeightFraction double?
Fraction of the screen height the sheet may grow to. Defaults to 0.70.
final
onSelected ValueChanged<BankAccount>
Called when the user taps a row. In the bottom-sheet flow this callback is wired to Navigator.of(context).pop(account) by show.
final
padding EdgeInsetsGeometry?
Overrides the list padding. Defaults to a bottom inset covering the safe area plus BankTokens.space4.
final
radius BorderRadius?
Overrides the sheet corner radius. Defaults to the theme sheetRadius.
final
rowHeight double?
Minimum height of each default row. Defaults to 72.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedAccountId String?
The ID of the currently active account. Its row receives a trailing checkmark.
final
selectedIcon IconData?
Overrides the selected-row checkmark glyph. Defaults to Icons.check_circle.
final
subtitleStyle TextStyle?
Merged over each row's masked-number style (BankTokens.bodySmall).
final
titleStyle TextStyle?
Merged over each row's account-name style (BankTokens.labelLarge).
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

Static Methods

show(BuildContext context, {required List<BankAccount> accounts, String? selectedAccountId}) Future<BankAccount?>
Presents BankAccountSwitcher as a transparent-background modal bottom sheet and returns the account the user tapped, or null if dismissed.