我有一个底部可扩展抽屉和三个选项卡,底部可扩展抽屉对于所有三个选项卡都是可见的,但是我希望它在特定的选项卡上可见。 树形标签-
class B1Home extends StatefulWidget {
@override
_B1HomeState createState() => _B1HomeState();
}
class _B1HomeState extends State<B1Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Stack(
children: <Widget>[
SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 8),
Header(),
SizedBox(height: 20),
Tabs(refresh: () => setState(() {})),
value == 0 ? Center(child: AbcPage()) : Container(),
value == 1 ? Center(child: SlidingCardsView()) : Container(),
value == 2 ? Center(child: GhiPage()) : Container(),
],
),
),
ExhibitionBottomSheet()
],
),
);
}
}
ExhibitionBottomSheet()是底部可扩展的抽屉,当前可用于所有三个选项卡,因为它位于其中的选项卡小部件下方,我希望仅对SlidingCardsView()可见。我试图将其从标签页并将其添加到SlidingCardsView页,但它会给出定位错误。
SlidingCardsView Page-
class SlidingCardsView extends StatefulWidget {
@override
_SlidingCardsViewState createState() => _SlidingCardsViewState();
}
class _SlidingCardsViewState extends State<SlidingCardsView> {
PageController pageController;
double pageOffset = 0;
@override
void initState() {
super.initState();
pageController = PageController(viewportFraction: 0.8);
pageController.addListener(() {
setState(() => pageOffset = pageController.page);
});
}
@override
void dispose() {
pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Stack(
children:<Widget>[
SafeArea(
child:Column(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.55,
child: PageView(
controller: pageController,
children: <Widget>[
SlidingCard(
name: 'ORIENTATION DAY 2019',
date: '02-06-2019',
assetName: 'steve-johnson.jpeg',
offset: pageOffset,
onTap: AbcPage()
),
SlidingCard(
name: 'SPORTS DAY 2018',
date: '18-11-2018',
assetName: 'rodion-kutsaev.jpeg',
offset: pageOffset - 1,
onTap: AbcPage()
),
],
),
),
/* Positioned(bottom: 147.6,
child: ExhibitionBottomSheet())
//ExhibitionBottomSheet()
*/
//Align(alignment: Alignment.bottomCenter,child: ExhibitionBottomSheet(),)
ExhibitionBottomSheet()
],
),
),
//Align(alignment: Alignment.bottomCenter,child: ExhibitionBottomSheet(),)
//ExhibitionBottomSheet()
]
);
//ExhibitionBottomSheet()
}
}
我尝试了各种方法来放置ExhibitionBottomSheet(),但都给出了定位错误。