getAppBar static method
dynamic
getAppBar(
- BuildContext context,
- OutlineRF local,
- String pageTitle,
- FlexBarRF flex,
- EdgeInsets pageHeaderPanelPadding,
- TemplateRF template,
Implementation
static getAppBar(
BuildContext context,
OutlineRF local,
String pageTitle,
FlexBarRF flex,
EdgeInsets pageHeaderPanelPadding,
TemplateRF template,
) {
OutlineRF _source = OutlineRF();
var appBar;
// _source.pageHeader = local?.pageHeader ?? implemented.pageHeader;
_source.appBar = AppBarRF(
leading: local.appBar?.leading ?? implemented.appBar!.leading,
drawer: local.appBar?.drawer ?? implemented.appBar!.drawer,
actions: local.appBar?.actions ?? implemented.appBar!.actions,
backgroundColor:
local.appBar?.backgroundColor ?? implemented.appBar!.backgroundColor,
foregroundColor:
local.appBar?.foregroundColor ?? implemented.appBar!.foregroundColor,
elevation: local.appBar?.elevation ?? implemented.appBar!.elevation,
);
_source.stickyHeader = local.stickyHeader ?? implemented.stickyHeader;
customAppBar() {
AppBar? pageHeader;
PreferredSizeWidget? _headerPanel =
_source.stickyHeader as PreferredSizeWidget;
var pageBottom = PreferredSize(
child: Container(
color: Colors.transparent,
height: 50.0,
width: ScreenRF.width(context),
child: Padding(
padding: EdgeInsets.only(
top: pageHeaderPanelPadding.top ?? 5,
bottom: pageHeaderPanelPadding.bottom ?? 5),
child: _headerPanel is Widget
? _headerPanel
: (_headerPanel as TabBarRF).toTabBar,
),
),
preferredSize: Size.fromHeight(50.0),
);
if (_source.appBar is AppBarRF) {
pageHeader = AppBar(
titleSpacing: 0,
actionsIconTheme: IconThemeData(
color:
(_source.appBar as AppBarRF).foregroundColor ?? Colors.white),
elevation: (_source.appBar as AppBarRF).elevation,
backgroundColor: (_source.appBar as AppBarRF).backgroundColor,
leading: (_source.appBar as AppBarRF).leading is EmptyRF
? null
: (_source.appBar as AppBarRF).leading,
title: Text(pageTitle,
style: TextStyle(
color: (_source.appBar as AppBarRF).foregroundColor)),
actions: (_source.appBar as AppBarRF).actions,
bottom: _headerPanel == null ? _headerPanel : pageBottom,
);
return pageHeader;
} else if (_source.appBar is AppBar) {
pageHeader = _source.appBar as AppBar; //ImroseX
} else if (_source.appBar is EmptyRF) {
return null;
}
return AppBar(
leading: (pageHeader)!.leading is EmptyRF ? null : (pageHeader).leading,
automaticallyImplyLeading:
(pageHeader).automaticallyImplyLeading ?? true,
title: Text(pageTitle),
actions: (pageHeader).actions,
flexibleSpace: (pageHeader).flexibleSpace,
bottom: PreferredSize(
child: Container(
color: Colors.transparent,
height: 50.0,
width: 800,
child: _headerPanel is Widget
? _headerPanel
: (_headerPanel as TabBarRF).toTabBar,
),
preferredSize: Size.fromHeight(50.0)),
elevation: (pageHeader).elevation,
shape: (pageHeader).shape,
//backgroundColor: (pageHeader)?.backgroundColor,
//brightness: (pageHeader).brightness,
iconTheme: (pageHeader).iconTheme,
actionsIconTheme: (pageHeader).actionsIconTheme,
// textTheme: (pageHeader).textTheme,
primary: (pageHeader).primary ?? true,
centerTitle: (pageHeader).centerTitle,
excludeHeaderSemantics: (pageHeader).centerTitle ?? false,
titleSpacing:
(pageHeader).titleSpacing ?? NavigationToolbar.kMiddleSpacing,
toolbarOpacity: (pageHeader).toolbarOpacity ?? 1.0,
bottomOpacity: (pageHeader).bottomOpacity ?? 1.0,
);
}
return appBar;
}