From 1d5c169e431a3cbb2085dd34633b4a8d6bf347ad Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 26 Nov 2020 11:14:24 +0800 Subject: [PATCH] fix appBar height --- lib/scaffold/as_scaffold.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/scaffold/as_scaffold.dart b/lib/scaffold/as_scaffold.dart index 25a2a5d..4dd6177 100644 --- a/lib/scaffold/as_scaffold.dart +++ b/lib/scaffold/as_scaffold.dart @@ -11,7 +11,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; /// ///`title`,`body`,`leading`,`bottomNavigationBar`,`appBarBottom`,`appBar` /// -///title 和 AppBar 均为 `null`时不显示scaffold的AppBar +///title , AppBar 和 AppBarBottom 均为 `null`时不显示scaffold的AppBar +/// +///只有AppBarBottom时只显示AppBarBottom中的内容 class ASScaffold extends StatefulWidget { ///标题,可为`String`或`Text` final dynamic title; @@ -57,13 +59,18 @@ class _ASScaffoldState extends State { endDrawer: widget.endDrawer, backgroundColor: kBackgroundColor, bottomNavigationBar: widget.bottomNavigationBar, - appBar: widget.title == null && widget.appBar == null + appBar: widget.title == null && + widget.appBar == null && + widget.appBarBottom == null ? null : widget.appBar ?? AppBar( brightness: Brightness.light, backgroundColor: kForegroundColor, elevation: 0, + toolbarHeight: widget.title == null && widget.appBar == null + ? widget.appBarBottom.preferredSize.height + 2.0 + : null, leading: widget.leading ?? ASBackButton(), centerTitle: true, title: DefaultTextStyle(