BeeScaffold add FAB option

hmxc
小赖 4 years ago
parent 707950a1f2
commit 932648a707

@ -103,7 +103,6 @@ class _CommunityIndexState extends State<CommunityIndex>
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
size: 40.sp,
), ),
onPressed: noteCreateRouter, onPressed: noteCreateRouter,
); );
@ -115,61 +114,53 @@ class _CommunityIndexState extends State<CommunityIndex>
return BeeScaffold( return BeeScaffold(
title: '社区', title: '社区',
actions: _listActions(), actions: _listActions(),
body: Stack( body: Column(
children: [ children: [
Column( Material(
children: [ color: kForeGroundColor,
Material( child: PreferredSize(
color: kForeGroundColor, preferredSize: Size.fromHeight(kToolbarHeight),
child: PreferredSize( child: Align(
preferredSize: Size.fromHeight(kToolbarHeight), alignment: Alignment.centerLeft,
child: Align( child: TabBar(
alignment: Alignment.centerLeft, indicatorPadding: EdgeInsets.zero,
child: TabBar(
indicatorPadding: EdgeInsets.zero,
controller: _tabController,
isScrollable: true,
indicatorColor: Color(0xffFFd000),
indicatorWeight: 2.w,
indicatorSize: TabBarIndicatorSize.label,
unselectedLabelStyle: TextStyle(
color: Color(0xFF333333),
fontSize: 28.sp,
),
labelStyle: TextStyle(
fontSize: 28.sp,
color: Color(0xff333333),
fontWeight: FontWeight.bold,
),
tabs: List.generate(
tabs.length,
(index) => Tab(
text: tabs[index]['name'],
),
),
),
),
),
),
Expanded(
child: TabBarView(
controller: _tabController, controller: _tabController,
children: List.generate( isScrollable: true,
indicatorColor: Color(0xffFFd000),
indicatorWeight: 2.w,
indicatorSize: TabBarIndicatorSize.label,
unselectedLabelStyle: TextStyle(
color: Color(0xFF333333),
fontSize: 28.sp,
),
labelStyle: TextStyle(
fontSize: 28.sp,
color: Color(0xff333333),
fontWeight: FontWeight.bold,
),
tabs: List.generate(
tabs.length, tabs.length,
(index) => TabList(index: index), (index) => Tab(
text: tabs[index]['name'],
),
), ),
), ),
), ),
// _floatingActionButton(), ),
], ),
Expanded(
child: TabBarView(
controller: _tabController,
children: List.generate(
tabs.length,
(index) => TabList(index: index),
),
),
), ),
Positioned( // _floatingActionButton(),
right: 30.w,
bottom: 50.w,
child: _floatingActionButton(),
)
], ],
), ),
fab: _floatingActionButton(),
); );
} }
} }

@ -22,28 +22,31 @@ class BeeScaffold extends StatefulWidget {
final Widget leading; final Widget leading;
final Widget bottomNavi; final Widget bottomNavi;
final PreferredSizeWidget appBarBottom; final PreferredSizeWidget appBarBottom;
BeeScaffold( final FloatingActionButton fab;
{Key key, BeeScaffold({
@required this.title, Key key,
this.body, @required this.title,
this.actions, this.body,
this.leading, this.actions,
this.bgColor = Colors.white, this.leading,
this.bodyColor = const Color(0xFFF9F9F9), this.bgColor = Colors.white,
this.bottomNavi, this.bodyColor = const Color(0xFFF9F9F9),
this.appBarBottom}) this.bottomNavi,
: super(key: key); this.appBarBottom,
this.fab,
}) : super(key: key);
BeeScaffold.white( BeeScaffold.white({
{Key key, Key key,
@required this.title, @required this.title,
this.body, this.body,
this.actions, this.actions,
this.leading, this.leading,
this.bgColor = Colors.white, this.bgColor = Colors.white,
this.bottomNavi, this.bottomNavi,
this.appBarBottom}) this.appBarBottom,
: this.bodyColor = Colors.white, this.fab,
}) : this.bodyColor = Colors.white,
super(key: key); super(key: key);
@override @override
@ -67,6 +70,7 @@ class _BeeScaffoldState extends State<BeeScaffold> {
), ),
body: widget.body, body: widget.body,
bottomNavigationBar: widget.bottomNavi, bottomNavigationBar: widget.bottomNavi,
floatingActionButton: widget.fab,
); );
} }
} }

Loading…
Cancel
Save