OudsTopBarActionConfig class

A configuration object that defines the appearance and behavior of a single action within an OudsTopBar.

Use the provided factory constructors like OudsTopBarActionConfig.icon, or OudsTopBarActionConfig.text to create type-safe and platform-appropriate actions.

Common Parameters (All Platforms)

iOS/Cupertino-Only Parameters

This helps users understand their navigation context by showing where the back action will take them.

Android/Material-Only Parameters

Example of usage

OudsTopBar(
  title: "My App",
  leadingActions: [
    OudsTopBarActionConfig.back(onActionPressed: () => Navigator.pop(context)),
    previousPageTitle: 'Settings', // Shows: "← Settings"
  ],
  trailingActions: [
    OudsTopBarActionConfig.icon(
      icon: 'assets/icons/search.svg',
      contentDescription: 'Search',
      onActionPressed: () => _handleSearch(),
    ),
    OudsTopBarActionConfig.text(
      actionLabel: 'Done',
      onActionPressed: () => _handleDone(),
    ),
  ],
)

Platform-Specific Considerations

iOS Guidelines

  • Use OudsTopBarActionConfig.text for primary actions.
  • Keep action labels short (1-2 words).
  • A maximum of 3 trailing actions is recommended.

Android Guidelines

  • Use OudsTopBarActionConfig.icon for most actions.
  • A maximum of 3 trailing actions is recommended.
  • Use an overflow menu for additional actions (not directly provided by this component).

See Also

  • OudsTopBar - The adaptive top bar component that uses this configuration.
  • OudsTopAppBar - The Material Design implementation of the top bar.
  • OudsToolbarTop - The Cupertino (iOS) implementation of the top bar.

Constructors

OudsTopBarActionConfig.avatar({required OudsTopAppBarAvatarConfig avatarConfig, VoidCallback? onActionPressed, String? contentDescription})
Creates a configuration for an avatar action.
factory
OudsTopBarActionConfig.back({String? previousPageTitle, VoidCallback? onActionPressed, String? contentDescription})
Creates a configuration for a standard 'back' navigation action.
factory
OudsTopBarActionConfig.close({String? actionLabel, VoidCallback? onActionPressed, String? contentDescription})
Creates a configuration for a close action.
factory
OudsTopBarActionConfig.custom({required String icon, VoidCallback? onActionPressed, String? contentDescription})
Creates a configuration for a custom leading icon-based action.
factory
OudsTopBarActionConfig.icon({required String icon, VoidCallback? onActionPressed, String? contentDescription, OudsTopAppBarActionBadge? badge})
Creates a configuration for an icon-based action.
factory
OudsTopBarActionConfig.menu({VoidCallback? onActionPressed, String? contentDescription})
Creates a configuration for a standard 'menu' (hamburger) navigation action.
factory
OudsTopBarActionConfig.none()
Creates a configuration for an empty action, resulting in no visible output.
factory
OudsTopBarActionConfig.text({required String actionLabel, VoidCallback? onActionPressed, String? contentDescription})
Creates a configuration for a text-based action.
factory
OudsTopBarActionConfig.widget({required Widget widget, VoidCallback? onActionPressed, String? contentDescription})
Creates a configuration that displays a custom, developer-defined widget.
factory

Properties

actionLabel String?
Cupertino-Only Parameters
final
avatarConfig OudsTopAppBarAvatarConfig?
Material-Only Parameters
final
badge OudsTopAppBarActionBadge?
final
contentDescription String?
final
hashCode int
The hash code for this object.
no setterinherited
icon String?
final
onActionPressed VoidCallback?
final
previousPageTitle String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type OudsTopBarActionType
Common parameters
final
widget Widget?
final

Methods

buildToolbarTopAction(BuildContext context, bool isLeadingAction) Widget
An internal method that builds the widget for this action on the iOS platform.
buildTopAppbarTrailingAction(BuildContext context, bool showAvatar) Widget
An internal method that builds the widget for this action on the Android platform.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited