buildScaffoldWidget function

Widget buildScaffoldWidget(
  1. {@required Widget body,
  2. double mToolBarHeight,
  3. Color backgroundColor,
  4. Color appBarBackColor,
  5. Widget leading,
  6. bool useAppBar = true,
  7. bool automaticallyImplyLeading,
  8. TextStyle textStyle,
  9. Widget titleWidget,
  10. double hMargin,
  11. double titleTextSize,
  12. FontWeight fontWeight,
  13. bool centerTitle = true,
  14. String title = '',
  15. double titleSpacing,
  16. EdgeInsets padding,
  17. Widget bottomNavigationBar,
  18. double leadingWidth,
  19. PreferredSizeWidget bottom,
  20. bool useSafeArea = true,
  21. List<Widget> actions,
  22. bool resizeToAvoidBottomInset = false,
  23. PreferredSize appBar,
  24. EdgeInsets actionsEdgeInsets,
  25. EdgeInsets leadingEdgeInsets,
  26. AlignmentGeometry actionsAlign,
  27. AlignmentGeometry leadingAlign}
)

获取SafeArea的布局

Implementation

Widget buildScaffoldWidget({
  @required Widget body,
  double mToolBarHeight,
  Color backgroundColor,
  Color appBarBackColor,
  Widget leading,
  bool useAppBar = true,
  bool automaticallyImplyLeading,
  TextStyle textStyle,
  Widget titleWidget,
  double hMargin,
  double titleTextSize,
  FontWeight fontWeight,
  bool centerTitle = true,
  String title = '',
  double titleSpacing,
  EdgeInsets padding,
  Widget bottomNavigationBar,
  double leadingWidth,
  PreferredSizeWidget bottom,
  bool useSafeArea = true,
  List<Widget> actions,
  bool resizeToAvoidBottomInset = false,
  PreferredSize appBar,
  EdgeInsets actionsEdgeInsets,
  EdgeInsets leadingEdgeInsets,
  AlignmentGeometry actionsAlign,
  AlignmentGeometry leadingAlign,
}){
  double mAppBarHeight = mToolBarHeight??appBarHeight;
  return Scaffold(
    backgroundColor: backgroundColor??Theme.of(context).canvasColor,
    appBar: useAppBar? appBar??buildAppBarWidget(
        toolbarHeight: mAppBarHeight,
        leadingWidth: leadingWidth,
        leadingAlign: leadingAlign,
        title: title,
        hMargin: hMargin,
        actionsEdgeInsets: actionsEdgeInsets,
        leadingEdgeInsets: leadingEdgeInsets,
        actionsAlign: actionsAlign,
        automaticallyImplyLeading: automaticallyImplyLeading,
        titleWidget: titleWidget,
        fontWeight: fontWeight,
        leading: leading,
        titleSpacing: titleSpacing,
        centerTitle: centerTitle,
        textStyle: textStyle,
        backgroundColor: appBarBackColor,
        bottom: bottom,
        actions: actions
    ):  null,
    resizeToAvoidBottomInset: resizeToAvoidBottomInset,
    bottomNavigationBar: bottomNavigationBar,
    body: useSafeArea? SafeArea(
      child: Padding(
        padding: padding??getEdgeInsetsAll(0),
        child: body,
      ),
    ) : Padding(
      padding: padding??getEdgeInsetsAll(0),
      child: body,
    ),
  );
}