Widget build(BuildContext context) {
PageController controller = PageController(viewportFraction: 0.5);
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
int _currentIndex = 0;
return Scaffold(
body: Center(
child:Stack(
alignment:Alignment.center ,
children: <Widget>[
SizedBox(
height: height/3, //PageView控件高度
child:Listener(
behavior: HitTestBehavior.opaque, //设置控件接收响应
child:PageView.builder(
onPageChanged: ((currentIndex) =>
_currentIndex = currentIndex
),
controller: controller,
itemCount: _pages.length,
itemBuilder: (BuildContext context, int index) {
Flutter:关于叠加控件事件的接收问题
最新推荐文章于 2024-03-19 20:05:32 发布