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.actionsfinal - actionsIconTheme → IconThemeData?
-
AppBar.actionsIconThemefinal - automaticallyImplyLeading → bool
-
CupertinoNavigationBar.automaticallyImplyLeadingorAppBar.automaticallyImplyLeadingfinal - automaticallyImplyMiddle → bool
-
CupertinoNavigationBar.automaticallyImplyMiddleorAppBar.automaticallyImplyMiddlefinal - backdropFilter → bool?
-
CupertinoNavigationBar.backdropFilter, default is truefinal - backgroundColor → Color?
-
CupertinoNavigationBar.backgroundColorfinal - backwardsCompatibility → bool?
-
AppBar.backwardsCompatibilityfinal - baseParam → BaseParam?
-
Personalization parameters, gets platform parameters first, then mode parameters
finalinherited
- border → Border?
-
CupertinoNavigationBar.borderfinal - bottom → PreferredSizeWidget?
-
CupertinoNavigationBar.bottom, cupertino also support orAppBar.bottomfinal - bottomOpacity → double
-
CupertinoNavigationBar.bottomOpacity, cupertino also support orAppBar.bottomOpacityfinal - brightness → Brightness?
-
AppBar.brightnessorCupertinoNavigationBar.backgroundColorfinal - centerTitle → bool?
-
AppBar.centerTitlefinal - elevation → double?
-
AppBar.elevationfinal - excludeHeaderSemantics → bool
-
AppBar.excludeHeaderSemanticsfinal - flexibleSpace → Widget?
-
AppBar.flexibleSpacefinal - foregroundColor → Color?
-
AppBar.foregroundColorfinal - hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
CupertinoNavigationBar.navBarPersistentHeightdefault isCupertinoNavigationBar._kNavBarPersistentHeight= 44.0 orAppBar.toolbarHeightdefault is kToolbarHeight = 56.0final - heroTag → Object?
-
CupertinoNavigationBar.heroTagfinal - iconTheme → IconThemeData?
-
AppBar.iconThemefinal - 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.leadingorAppBar.leadingfinal -
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.leadingWidthfinal - middle → Widget?
-
CupertinoNavigationBar.middlefinal -
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.paddingfinal - 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.previousPageTitlefinal - primary → bool
-
AppBar.primaryfinal - 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.shadowColorfinal - shape → ShapeBorder?
-
AppBar.shapefinal - systemOverlayStyle → SystemUiOverlayStyle?
-
AppBar.systemOverlayStylefinal - textTheme → TextTheme?
-
AppBar.textThemefinal - 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.titlefinal - titleSpacing → double?
-
AppBar.titleSpacingfinal - titleTextStyle → TextStyle?
-
AppBar.titleTextStylefinal - toolbarOpacity → double
-
CupertinoNavigationBar.toolbarOpacity, cupertino also support orAppBar.toolbarOpacityfinal - toolbarTextStyle → TextStyle?
-
AppBar.toolbarTextStylefinal - trailing → Widget?
-
CupertinoNavigationBar.trailingfinal -
trailingActions
→ List<
BaseNavigationBarAction> ? -
Trailing navigation actions for native iOS mode (BaseNavigationBar)
Use this when baseParam.nativeIOS is true
Accepts List
final
- transitionBetweenRoutes → bool?
-
CupertinoNavigationBar.transitionBetweenRoutesfinal - 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