BankAssistantPanel class
Entry surface for an in-app banking assistant: a greeting with an avatar, suggested prompt chips, a free-text ask field with an optional voice button, recent queries, and an optional disclaimer.
Embed it in a bottom sheet or a dedicated screen as the front door to a named-assistant experience. The panel is pure presentation: it performs no networking and contains no AI logic, it only fires callbacks.
While the assistant is working, set isThinking to show a three-dot pulsing indicator beside the avatar; the dots render statically when the platform requests reduced motion.
BankAssistantPanel(
assistantName: 'Aya',
prompts: const [
BankAssistantPrompt(id: 'spend', label: 'Spending this month'),
BankAssistantPrompt(id: 'freeze', label: 'Freeze my card'),
BankAssistantPrompt(id: 'bills', label: 'Upcoming bills'),
BankAssistantPrompt(id: 'rate', label: 'Best savings rate'),
],
recentQueries: const [
'How much did I spend on dining?',
'Show my subscriptions',
],
disclaimerText:
'Aya is an AI assistant. For urgent card issues call us.',
onPromptTap: (prompt) => openAssistant(prompt.label),
onSubmitted: openAssistant,
onMicTap: startVoiceInput,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BankAssistantPanel
Constructors
-
BankAssistantPanel({required String assistantName, Key? key, String greetingTemplate = 'Hi, I am {name}. How can I help?', Widget? avatar, List<
BankAssistantPrompt> prompts = const <BankAssistantPrompt>[], ValueChanged<BankAssistantPrompt> ? onPromptTap, String inputHint = 'Ask anything about your money', ValueChanged<String> ? onSubmitted, VoidCallback? onMicTap, String micSemanticLabel = 'Voice input', String? disclaimerText, List<String> recentQueries = const <String>[], String recentTitle = 'Recent', ValueChanged<String> ? onRecentTap, bool isThinking = false, Widget? header, EdgeInsetsGeometry? padding, BorderRadius? radius, BorderRadius? chipRadius, Color? backgroundColor, Color? foregroundColor, Color? accentColor, Gradient? gradient, List<BoxShadow> ? shadow, BoxBorder? border, Color? chipBackgroundColor, Color? inputBackgroundColor, TextStyle? greetingStyle, TextStyle? chipLabelStyle, TextStyle? recentTitleStyle, TextStyle? recentQueryStyle, TextStyle? disclaimerStyle, IconData? avatarIcon, IconData? micIcon, IconData? recentIcon, double? avatarSize, Duration? animationDuration, Curve? animationCurve, String? semanticLabel}) -
Creates an assistant entry panel.
const
Properties
- accentColor → Color?
-
Overrides the accent used for the avatar fill, chip icons, the
mic button, and the thinking dots. Defaults to
BankThemeData.primary.
final
- animationCurve → Curve?
-
Easing applied to the thinking-dot pulse. Defaults to
BankTokens.curveStandard.
final
- animationDuration → Duration?
-
One pulse cycle of the thinking dots. Defaults to
BankTokens.durationXSlow.
final
- assistantName → String
-
Display name of the assistant, e.g.
'Aya'. Substituted into greetingTemplate and used in the panel semantics label.final - avatar → Widget?
-
Replaces the default avatar (a circle filled with the theme
accent gradient, or primary colour, holding avatarIcon).
final
- avatarIcon → IconData?
-
Glyph inside the default avatar. Defaults to a sparkle
(Icons.auto_awesome). Ignored when avatar is set.
final
- avatarSize → double?
-
Diameter of the default avatar. Defaults to 48. Ignored when
avatar is set.
final
- backgroundColor → Color?
-
Overrides the panel background. Defaults to
BankThemeData.surface.
final
- border → BoxBorder?
-
Overrides the panel outline. Defaults on dark surfaces to a
BankTokens.hairlineWidth hairline in BankTokens.hairlineColor;
light surfaces keep an invisible border of the same width. Pass
const Border()to remove it.final - chipBackgroundColor → Color?
-
Overrides the suggestion-chip fill. Defaults to
BankThemeData.surfaceVariant.
final
- chipLabelStyle → TextStyle?
-
Merged over the chip label style (BankTokens.labelLarge).
final
- chipRadius → BorderRadius?
-
Overrides the suggestion-chip radius. Defaults to
BankThemeData.chipRadius.
final
- disclaimerStyle → TextStyle?
-
Merged over the disclaimer style (BankTokens.bodySmall).
final
- disclaimerText → String?
-
Optional quiet legal or safety line under the panel content,
e.g.
'Aya is an AI assistant. For urgent card issues call us.'. Hidden when null.final -
Slot rendered below all panel content.
final
- foregroundColor → Color?
-
Overrides the primary text colour. Defaults to
BankThemeData.onSurface.
final
- gradient → Gradient?
-
Overrides the default avatar gradient. Defaults to
BankThemeData.accentGradient; when both are null the avatar is
filled with the accent colour.
final
- greetingStyle → TextStyle?
-
Merged over the greeting style (BankTokens.headlineSmall).
final
- greetingTemplate → String
-
Greeting text; every
{name}occurrence is replaced with assistantName.final - hashCode → int
-
The hash code for this object.
no setterinherited
- header → Widget?
-
Slot rendered above the greeting row.
final
- inputBackgroundColor → Color?
-
Overrides the text-field fill. Defaults to
BankThemeData.surfaceVariant.
final
- inputHint → String
-
Placeholder shown in the free-text field.
final
- isThinking → bool
-
Shows a three-dot pulsing indicator beside the avatar while the
assistant is working. Dots render statically when animations are
disabled.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- micIcon → IconData?
-
Glyph on the microphone button. Defaults to
Icons.mic_none_outlined.
final
- micSemanticLabel → String
-
Semantics label for the microphone button.
final
- onMicTap → VoidCallback?
-
When set, a microphone button is shown inside the text field.
final
-
onPromptTap
→ ValueChanged<
BankAssistantPrompt> ? -
Fired when a suggestion chip is tapped. Chips render but do not
respond when null.
final
-
onRecentTap
→ ValueChanged<
String> ? -
Fired when a recent query row is tapped.
final
-
onSubmitted
→ ValueChanged<
String> ? -
Fired with the trimmed text when the user submits the field; the
field is cleared afterwards.
final
- padding → EdgeInsetsGeometry?
-
Overrides the panel content padding. Defaults to
BankTokens.space4 on all sides.
final
-
prompts
→ List<
BankAssistantPrompt> -
Suggested prompts rendered as tappable chips. Empty hides the
section.
final
- radius → BorderRadius?
-
Overrides the panel corner radius. Defaults to
BankThemeData.cardRadius.
final
- recentIcon → IconData?
-
Glyph leading each recent-query row. Defaults to
Icons.history.
final
-
recentQueries
→ List<
String> -
Previously asked queries rendered as quiet rows. Empty hides the
section.
final
- recentQueryStyle → TextStyle?
-
Merged over the recent-query row style (BankTokens.bodyMedium).
final
- recentTitle → String
-
Heading above recentQueries.
final
- recentTitleStyle → TextStyle?
-
Merged over the recent-section title style
(BankTokens.labelMedium).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Overrides the panel container semantics label. Defaults to
'<assistantName> assistant'.final -
shadow
→ List<
BoxShadow> ? -
Overrides the panel shadow. Defaults to BankTokens.shadowCardFor of
the theme background brightness; pass
const []to flatten.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BankAssistantPanel> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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