如您所见,轮播点未按预期排列。
我正在尝试获取
SizedBox
高于 SmoothPageIndicator
的高度,以便指示器位于屏幕底部。
这是我的页面布局:
SafeArea(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height -
kBottomNavigationBarHeight -
AppBar().preferredSize.height -
PlatformDispatcher.instance.views.first.physicalSize.height*0.07,
child: PageView.builder(
controller: controller,
itemCount: pages.length,
onPageChanged: (index) {
setState(
() {
hourIndex = index;
},
);
},
itemBuilder: (_, index) {
return pages[index % pages.length];
},
physics: const AlwaysScrollableScrollPhysics(),
),
),
const SizedBox(height: 2),
SmoothPageIndicator(
controller: controller,
count: pages.length,
effect: const WormEffect(
dotHeight: 16,
dotWidth: 16,
type: WormType.thinUnderground,
),
),
],
),
),
);
如你所见,我尝试使用以下公式计算高度,但惨败了:
height: MediaQuery.of(context).size.height -
kBottomNavigationBarHeight -
AppBar().preferredSize.height -
PlatformDispatcher.instance.views.first.physicalSize.height*0.07,
我正在使用以下四个模拟器:
我该如何解决这个问题?