OudsTopAppBar class

OUDS Android Top app bar design guidelines

Reference design version : 1.0.0

Top app bars display information and actions at the top of the screen.

The OudsTopAppBar is a flexible app bar that can be customized with different sizes, icons, titles, and actions. It supports leading icons, avatars, and custom action widgets to fit your app's requirements.

Typically, OudsTopAppBar is used in the Scaffold.appBar property.

OudsTopAppBar default appearance is opaque but, if you need a translucent blurred top app bar as specified on OUDS design side. To do this, use OudsTopAppBar with translucent parameter set to true and :

Example of code:

Scaffold(
  extendBodyBehindAppBar: true,
  appBar: OudsTopAppBar(...),
  body: MyScrollableContent(),
);

For the OudsTopBarSize.small size, the app bar has a fixed height. If you need a variable height, you can use OudsTopBarSize.medium or OudsTopBarSize.large, allowing you to adjust the top app bar's height as needed.

Parameters:

OudsTopAppBar(
  size: OudsTopBarSize.small,
  title: 'Profile',
  translucent: true,
  centerTitle: true,
  showAvatar: true,
  leadingActions: [
      OudsTopBarActionConfig.back(
        onActionPressed: () => Navigator.of(context).pop(),
      ),
    ],
  trailingActions: [
      OudsTopBarActionConfig.icon(
        customIcon: "assets/icons/search.svg",
        contentDescription: "Search",
        onActionPressed: () {
          // Handle search action
        },
      ),
    OudsTopBarActionConfig.avatar(
      avatarConfig: OudsTopAppBarAvatarConfig(
        monogram: 'A',
      ),
    ),
   ],
)
Inheritance
Implemented types

Constructors

OudsTopAppBar({Key? key, OudsTopBarSize size = OudsTopBarSize.small, List<OudsTopBarActionConfig>? leadingActions, String? title, List<OudsTopBarActionConfig>? trailingActions, bool? centerTitle = false, bool translucent = false, double? expandedHeight, int titleMaxLines = 1, bool showAvatar = false, String? icon})
const

Properties

centerTitle bool?
final
expandedHeight double?
final
hashCode int
The hash code for this object.
no setterinherited
icon String?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leadingActions List<OudsTopBarActionConfig>?
final
preferredSize Size
The size this widget would prefer if it were otherwise unconstrained.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showAvatar bool
final
size OudsTopBarSize
final
title String?
final
titleMaxLines int
final
trailingActions List<OudsTopBarActionConfig>?
final
translucent bool
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<OudsTopAppBar>
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

Static Methods

getHeight(OudsTopBarSize size, double? expandedHeight) double
getPreferredSize({OudsTopBarSize size = OudsTopBarSize.small, double? expandedHeight}) Size