buildAppBarWidget function

PreferredSizeWidget buildAppBarWidget({
  1. List<Widget>? actions,
  2. Color? backgroundColor,
  3. Widget? leading,
  4. bool? automaticallyImplyLeading,
  5. TextStyle? textStyle,
  6. Widget? titleWidget,
  7. FontWeight? fontWeight,
  8. bool centerTitle = true,
  9. String title = '',
  10. double? titleSpacing,
  11. PreferredSizeWidget? bottom,
  12. double? leadingWidth,
  13. double? toolbarHeight,
  14. IconThemeData? iconTheme,
})

公共控件/

Implementation

PreferredSizeWidget buildAppBarWidget({
  List<Widget>? actions,
  Color? backgroundColor,
  Widget? leading,
  bool? automaticallyImplyLeading,
  TextStyle? textStyle,
  Widget? titleWidget,
  FontWeight? fontWeight,
  bool centerTitle = true,
  String title = '',
  double? titleSpacing,
  PreferredSizeWidget? bottom,
  double? leadingWidth,
  double? toolbarHeight,
  IconThemeData? iconTheme
}){
  Widget mTitleWidget;

  if(fontWeight != null || textStyle != null){
    mTitleWidget = buildText(title, fontWeight: fontWeight, textStyle: textStyle);
  }else{
    mTitleWidget = Text(title);
  }


  return AppBar(
    iconTheme: iconTheme,
    toolbarHeight: toolbarHeight,
    leadingWidth: leadingWidth,
    automaticallyImplyLeading: automaticallyImplyLeading??centerTitle,
    titleSpacing: titleSpacing,
    title: titleWidget??mTitleWidget,
    bottom: bottom,
    leading: leading,
    centerTitle: centerTitle,
    backgroundColor: backgroundColor,
    actions: actions,
  );
}