BaseAppBar class

BaseAppBar

Modern cross-platform app bar with native iOS support.

*** You need to call the build method manually, otherwise BaseThemeData.appBarHeight won't work.

Material 3 Integration:

  • Surface tint and elevation overlays with semantic color integration
  • Modern typography and spacing with enhanced accessibility
  • Cross-platform harmony while preserving platform characteristics

use CupertinoNavigationBar by cupertino *** use cupertino = { forceUseMaterial: true } force use AppBar on cuperitno. use AppBar by material *** use material = { forceUseCupertino: true } force use CupertinoNavigationBar on material.

CupertinoNavigationBar: 2021.04.01 AppBar: 2021.03.30 modify 2021.06.25 by flutter 2.2.2

Inheritance
Implemented types

Constructors

BaseAppBar({Key? key, Widget? leading, Widget? trailing, bool automaticallyImplyLeading = true, bool automaticallyImplyMiddle = true, Color? backgroundColor, Brightness? brightness, String? previousPageTitle, Widget? middle, Border? border = const Border(bottom: BorderSide(color: Color(0x4C000000), width: 0.0, style: BorderStyle.solid)), EdgeInsetsDirectional? padding, bool? transitionBetweenRoutes, Object? heroTag, bool? backdropFilter, double? height, Widget? title, List<Widget>? actions, Widget? flexibleSpace, PreferredSizeWidget? bottom, double? elevation = 4.0, IconThemeData? iconTheme, Color? shadowColor, ShapeBorder? shape, IconThemeData? actionsIconTheme, TextTheme? textTheme, bool primary = true, bool? centerTitle, double? titleSpacing = NavigationToolbar.kMiddleSpacing, bool excludeHeaderSemantics = false, double toolbarOpacity = 1.0, double bottomOpacity = 1.0, Color? foregroundColor, double? leadingWidth, bool? backwardsCompatibility, TextStyle? toolbarTextStyle, TextStyle? titleTextStyle, SystemUiOverlayStyle? systemOverlayStyle, List<BaseNavigationBarAction>? leadingActions, List<BaseNavigationBarAction>? trailingActions, bool transparent = false, bool largeTitle = false, Color? tint, List<String>? segmentedControlLabels, int? segmentedControlSelectedIndex, ValueChanged<int>? onSegmentedControlValueChanged, double? segmentedControlHeight, Color? segmentedControlTint, double? segmentedControlLabelSize, BaseParam? baseParam})
const

Properties

actions → List<Widget>?
AppBar.actions
final
actionsIconTheme → IconThemeData?
AppBar.actionsIconTheme
final
automaticallyImplyLeading → bool
CupertinoNavigationBar.automaticallyImplyLeading or AppBar.automaticallyImplyLeading
final
automaticallyImplyMiddle → bool
CupertinoNavigationBar.automaticallyImplyMiddle or AppBar.automaticallyImplyMiddle
final
backdropFilter → bool?
CupertinoNavigationBar.backdropFilter, default is true
final
backgroundColor → Color?
CupertinoNavigationBar.backgroundColor
final
backwardsCompatibility → bool?
AppBar.backwardsCompatibility
final
baseParam → BaseParam?
Personalization parameters, gets platform parameters first, then mode parameters
finalinherited
border → Border?
CupertinoNavigationBar.border
final
bottom → PreferredSizeWidget?
CupertinoNavigationBar.bottom, cupertino also support or AppBar.bottom
final
bottomOpacity → double
CupertinoNavigationBar.bottomOpacity, cupertino also support or AppBar.bottomOpacity
final
brightness → Brightness?
AppBar.brightness or CupertinoNavigationBar.backgroundColor
final
centerTitle → bool?
AppBar.centerTitle
final
elevation → double?
AppBar.elevation
final
excludeHeaderSemantics → bool
AppBar.excludeHeaderSemantics
final
flexibleSpace → Widget?
AppBar.flexibleSpace
final
foregroundColor → Color?
AppBar.foregroundColor
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
CupertinoNavigationBar.navBarPersistentHeight default is CupertinoNavigationBar._kNavBarPersistentHeight = 44.0 or AppBar.toolbarHeight default is kToolbarHeight = 56.0
final
heroTag → Object?
CupertinoNavigationBar.heroTag
final
iconTheme → IconThemeData?
AppBar.iconTheme
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
largeTitle → bool
Whether to use large title style (native iOS mode) When true, displays a large title in the navigation bar
final
leading → Widget?
*** general properties start *** CupertinoNavigationBar.leading or AppBar.leading
final
leadingActions → List<BaseNavigationBarAction>?
*** material properties end *** *** native iOS properties start *** Leading navigation actions for native iOS mode (BaseNavigationBar) Use this when baseParam.nativeIOS is true Accepts List
final
leadingWidth → double?
AppBar.leadingWidth
final
middle → Widget?
CupertinoNavigationBar.middle
final
onSegmentedControlValueChanged → ValueChanged<int>?
Callback when segmented control value changes Use this when baseParam.nativeIOS is true Provides the newly selected index
final
padding → EdgeInsetsDirectional?
CupertinoNavigationBar.padding
final
preferredSize → Size
  • use by { appBar: BaseAppBar() }, the BaseThemeData.appBarHeight won't work, will use preferredSize's height
  • use by { appBar: BaseAppBar().build(context) }, the BaseThemeData.appBarHeight will work, will replace the preferredSize's height
  • Pay attention, two ways's build order is different 1.build BaseScaffold before build BaseAppBar 2.build BaseScaffold after build BaseAppBar
  • no setteroverride
    previousPageTitle → String?
    *** general properties end *** *** cupertino properties start *** CupertinoNavigationBar.previousPageTitle
    final
    primary → bool
    AppBar.primary
    final
    runtimeType → Type
    A representation of the runtime type of the object.
    no setterinherited
    segmentedControlHeight → double?
    Height of the segmented control in the navigation bar Use this when baseParam.nativeIOS is true
    final
    segmentedControlLabels → List<String>?
    Labels for the segmented control in native iOS navigation bar Use this when baseParam.nativeIOS is true Example: 'Notifications', 'Buddy Requests'
    final
    segmentedControlLabelSize → double?
    Label size for the segmented control text Use this when baseParam.nativeIOS is true Controls the font size of segment labels
    final
    segmentedControlSelectedIndex → int?
    Currently selected index in the segmented control Use this when baseParam.nativeIOS is true
    final
    segmentedControlTint → Color?
    Tint color for the segmented control Use this when baseParam.nativeIOS is true
    final
    shadowColor → Color?
    AppBar.shadowColor
    final
    shape → ShapeBorder?
    AppBar.shape
    final
    systemOverlayStyle → SystemUiOverlayStyle?
    AppBar.systemOverlayStyle
    final
    textTheme → TextTheme?
    AppBar.textTheme
    final
    tint → Color?
    Tint color for the navigation bar (native iOS mode) Used for text and icons in the navigation bar
    final
    title → Widget?
    *** cupertino properties ened *** *** material properties start *** AppBar.title
    final
    titleSpacing → double?
    AppBar.titleSpacing
    final
    titleTextStyle → TextStyle?
    AppBar.titleTextStyle
    final
    toolbarOpacity → double
    CupertinoNavigationBar.toolbarOpacity, cupertino also support or AppBar.toolbarOpacity
    final
    toolbarTextStyle → TextStyle?
    AppBar.toolbarTextStyle
    final
    trailing → Widget?
    CupertinoNavigationBar.trailing
    final
    trailingActions → List<BaseNavigationBarAction>?
    Trailing navigation actions for native iOS mode (BaseNavigationBar) Use this when baseParam.nativeIOS is true Accepts List
    final
    transitionBetweenRoutes → bool?
    CupertinoNavigationBar.transitionBetweenRoutes
    final
    transparent → bool
    Whether the navigation bar should be transparent (native iOS mode) When true, the navigation bar will have a transparent background
    final

    Methods

    beforeBuild(BuildContext context) → void
    Called before build
    inherited
    beforeBuildByCupertino(BuildContext context) → void
    Called before buildByCupertino
    inherited
    beforeBuildByCupertinoNative(BuildContext context) → void
    Called before buildByCupertinoNative (native iOS implementation)
    inherited
    beforeBuildByMaterial(BuildContext context) → void
    Called before buildByMaterial
    inherited
    build(BuildContext context) → Widget
    Describes the part of the user interface represented by this widget.
    inherited
    buildByCupertino(BuildContext context) → Widget
    *** native iOS properties end ***
    buildByCupertinoNative(BuildContext context) → Widget
    build on cupertino mode with native iOS components (cupertino_native package) This is called when baseParam.nativeIOS = true Default implementation falls back to buildByCupertino()
    buildByMaterial(BuildContext context) → Widget
    build on material mode
    commonBuild(BuildContext context, BaseParam? baseParam) → dynamic
    inherited
    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
    getBuildMode(BaseParam? baseParam) → WidgetBuildMode
    inherited
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    shouldFullyObstruct(BuildContext context) → bool
    If true, this widget fully obstructs widgets behind it by the specified size.
    override
    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
    valueOf(String key, dynamic value) → dynamic
    inherited
    valueOfBaseParam(BaseParam? baseParam, String key, dynamic value) → dynamic
    No reflection available in Dart First get value from platform, then from mode, finally from value itself
    inherited

    Operators

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