From 703b57dd28c1e19d680e49cd846d1076d4bb76c2 Mon Sep 17 00:00:00 2001 From: toly <1981462002@qq.com> Date: Tue, 12 Apr 2022 09:39:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20AppBar=20=E6=A1=88?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StatefulWidget/AppBar/node2_tab.dart | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/lib/widget_system/widgets/StatefulWidget/AppBar/node2_tab.dart b/lib/widget_system/widgets/StatefulWidget/AppBar/node2_tab.dart index 6279657..6f4e921 100755 --- a/lib/widget_system/widgets/StatefulWidget/AppBar/node2_tab.dart +++ b/lib/widget_system/widgets/StatefulWidget/AppBar/node2_tab.dart @@ -35,33 +35,27 @@ class _TabAppBarState extends State super.dispose(); } +// decoration: const BoxDecoration( +// image: DecorationImage( +// image: AssetImage( +// "assets/images/sabar.webp", +// ), +// fit: BoxFit.cover)) @override Widget build(BuildContext context) { - return Column( - children: [ - Container( - height: 180, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/images/sabar.webp", - ), - fit: BoxFit.cover)), - child: _buildAppBar(), - ), - Container( - height: 150, - color: const Color(0xff916BF0), - child: _buildTableBarView()) - ], + return SizedBox( + height: 220, + child: Scaffold( + appBar: _buildAppBar(), + body: _buildTableBarView(), + ), ); } - Widget _buildAppBar() => AppBar( - title: const Text('风雅六社'), + PreferredSizeWidget _buildAppBar() => AppBar( + title: const Text('风雅六社'), elevation: 1, leading: const BackButton(), - backgroundColor: Colors.amber[500]!.withAlpha(33), centerTitle: true, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( @@ -88,10 +82,13 @@ class _TabAppBarState extends State Widget _buildTableBarView() => TabBarView( controller: _tabController, children: tabs - .map((e) => Center( - child: Text( - e, + .map((e) => ColoredBox( + color: Colors.purple, + child:Center( + child: Text( + e, style: const TextStyle(color: Colors.white, fontSize: 20), - ))) + ), + ))) .toList()); }