From 8d08e187e8d68b5c61365f52323c90ca39d64f7a Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 25 Nov 2020 14:54:10 +0800 Subject: [PATCH] 0.0.3 scaffold add appBar --- lib/scaffold/as_scaffold.dart | 35 ++++++++++++++++++++--------------- pubspec.yaml | 2 +- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/scaffold/as_scaffold.dart b/lib/scaffold/as_scaffold.dart index ed87b62..b0859d8 100644 --- a/lib/scaffold/as_scaffold.dart +++ b/lib/scaffold/as_scaffold.dart @@ -30,6 +30,9 @@ class ASScaffold extends StatefulWidget { /// /// 右方向的抽屉 final Widget endDrawer; + + /// `AppBar` appBar + final Widget appBar; ASScaffold({ Key key, @required this.title, @@ -38,6 +41,7 @@ class ASScaffold extends StatefulWidget { this.bottomNavigationBar, this.appBarBottom, this.endDrawer, + this.appBar, }) : super(key: key); @override @@ -51,22 +55,23 @@ class _ASScaffoldState extends State { endDrawer: widget.endDrawer, backgroundColor: kBackgroundColor, bottomNavigationBar: widget.bottomNavigationBar, - appBar: AppBar( - brightness: Brightness.light, - backgroundColor: kForegroundColor, - elevation: 0, - leading: widget.leading ?? ASBackButton(), - centerTitle: true, - title: DefaultTextStyle( - style: TextStyle( - color: kTextColor, - fontSize: 18.sp, - fontWeight: FontWeight.bold, + appBar: widget.appBar ?? + AppBar( + brightness: Brightness.light, + backgroundColor: kForegroundColor, + elevation: 0, + leading: widget.leading ?? ASBackButton(), + centerTitle: true, + title: DefaultTextStyle( + style: TextStyle( + color: kTextColor, + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + child: widget.title is String ? Text(widget.title) : widget.title, + ), + bottom: widget.appBarBottom, ), - child: widget.title is String ? Text(widget.title) : widget.title, - ), - bottom: widget.appBarBottom, - ), body: widget.body, ); } diff --git a/pubspec.yaml b/pubspec.yaml index aa9dcf8..13eaab7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ansu_ui description: A new Flutter package. -version: 0.0.2 +version: 0.0.3 author: environment: