buildAppBarWidget function

Widget 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. double hMargin,
  15. EdgeInsets actionsEdgeInsets,
  16. EdgeInsets leadingEdgeInsets,
  17. AlignmentGeometry actionsAlign,
  18. AlignmentGeometry leadingAlign}
)

公共控件/

Implementation

Widget 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,
  double hMargin,
  EdgeInsets actionsEdgeInsets,
  EdgeInsets leadingEdgeInsets,
  AlignmentGeometry actionsAlign,
  AlignmentGeometry leadingAlign,
}){
  return AppBar(
    toolbarHeight: toolbarHeight,
    leadingWidth: leadingWidth,
    automaticallyImplyLeading: automaticallyImplyLeading??centerTitle,
    titleSpacing: titleSpacing??Theme.of(context).appBarTheme.titleSpacing,
    title: titleWidget??buildText(title, fontWeight: fontWeight, textStyle: textStyle??Theme.of(context).appBarTheme.titleTextStyle),
    bottom: bottom,
    leading: isEmpty(leading)? leading : Container(
      alignment: leadingAlign??Alignment.centerLeft,
      padding: leadingEdgeInsets??getEdgeInsetsOnly(left: hMargin??15),
      child: leading,
    ),
    centerTitle: centerTitle,
    backgroundColor: backgroundColor??Theme.of(context).appBarTheme.backgroundColor,
    actions: isEmpty(actions)? null : [
      Container(
        alignment: actionsAlign??Alignment.centerRight,
        padding: actionsEdgeInsets??getEdgeInsetsOnly(right: hMargin??15),
        child: Row(
          children: actions,
        ),
      )
    ],
  );
}