getAppBarWidget static method

Widget getAppBarWidget(
  1. BuildContext context,
  2. String title, {
  3. Widget? rightChild,
  4. bool back = true,
  5. bool top = false,
  6. bool black = false,
  7. Function? pop,
})

导航栏

Implementation

static Widget getAppBarWidget(BuildContext context, String title,
    {Widget? rightChild,
    bool back = true,
    bool top = false,
    bool black = false,
    Function? pop}) {
  return Container(
    height: kToolbarHeight,
    margin: EdgeInsets.only(
      top: top ? ScreenUtil().statusBarHeight : 0,
    ),
    child: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        back
            ? IconButton(
                padding: EdgeInsets.all(0),
                icon: CommonUtils.getLoadWidget(
                    black
                        ? RechargeConstantIcons.card_close
                        : RechargeConstantIcons.app_return,
                    '',
                    RechargeConstantIcons.imagesUrl,
                    RechargeConstantIcons.card_card,
                    RechargeConstantColors.text_tip_color,
                    RechargeConstantColors.app_color,
                    width: ScreenUtil().setWidth(40),
                    height: ScreenUtil().setWidth(40),
                    package: 'mmoo_base_recharge'),
                onPressed: NavigatorUtils.debounce(() {
                  if (pop == null) {
                    Navigator.pop(context);
                  } else {
                    pop();
                  }
                }),
              )
            : SizedBox(width: ScreenUtil().setWidth(20)),
        Expanded(
          child: Text(title,
              style: black
                  ? RechargeConstantText.text20BlackBold
                  : RechargeConstantText.text20WhiteBold,
              maxLines: 1,
              overflow: TextOverflow.ellipsis),
        ),
        rightChild ?? Container()
      ],
    ),
  );
}