createAppBar method

  1. @protected
Widget createAppBar(
  1. BuildContext context,
  2. VM viewModel
)

创建AppBar控件,子类可override自定义

Implementation

@protected
Widget createAppBar(BuildContext context, VM viewModel) {
  return GetBuilderUtil.builder<AppbarController>(
      (controller) => Visibility(
          visible: controller.visible,
          child: AppBar(
            // 禁止appbar因为滚动控件滚动导致的背景颜色变化
            surfaceTintColor: Colors.transparent,
            leading: GestureDetector(
              onTap: () {
                viewModel.onBackPressed();
              },
              child: SizedBox(
                  width: 56,
                  height: 48,
                  child: Icon(
                    controller.appbarBackIcon,
                    color: controller.appbarBackIconColor,
                    size: 24,
                  )),
            ),
            backgroundColor: controller.appbarBackgroundColor,
            title: Text(controller.appbarTitle ?? ""),
            centerTitle: true,
            titleTextStyle: controller.appbarTitleStyle,
            actions: controller.appbarActions,
          )),
      init: viewModel.appbarController);
}