YAppBar function

Widget YAppBar({
  1. String? title,
  2. Color? navBarTitleColor,
  3. bool canBack = true,
  4. bool divider = false,
  5. Widget? left,
  6. Widget? right,
  7. Widget? widget,
  8. String? statubar,
  9. String? navBar,
})

Implementation

Widget YAppBar({String? title, Color? navBarTitleColor, bool canBack = true, bool divider = false, Widget? left, Widget? right, Widget? widget, String? statubar, String? navBar}) {
  var screenSize = yScreenSize();
  double statubarHeight = yStatubarHeight();
  double navBarHeight = yNavBarHeight();
  return Column(
    mainAxisSize: MainAxisSize.max,
    children: <Widget>[
      Image.asset(statubar ?? YConfig.statubar, width: screenSize.width, height: statubarHeight, fit: BoxFit.fill),
      Stack(children: <Widget>[
        Image.asset(navBar ?? YConfig.navBar, width: screenSize.width, height: navBarHeight, fit: BoxFit.fill),
        SizedBox(
          height: navBarHeight,
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            mainAxisSize: MainAxisSize.max,
            children: widget == null
                ? <Widget>[
                    SizedBox(width: navBarHeight, height: navBarHeight, child: left ?? (canBack ? _YFlatButton(Icon(Icons.arrow_back_ios, color: navBarTitleColor ?? YConfig.navBarTitleColor), onClick: () => yPages.last.yFinish()) : YEmpty())),
                    YTitleWidget(title, navBarTitleColor: navBarTitleColor),
                    SizedBox(width: navBarHeight, height: navBarHeight, child: right ?? YEmpty()),
                  ]
                : <Widget>[SizedBox(width: screenSize.width, height: navBarHeight, child: widget)],
          ),
        ),
      ]),
      divider ? Divider(height: 1, color: Colors.grey.shade400) : YEmpty(),
    ],
  );
}