我正在尝试使用堆栈和定位小部件将我的文本定位在我的Carousel滑块的顶部,但它一直停留在Carousel的顶部,是否有一种方法我可以去。
body: ListView(
shrinkWrap: true,
children: [
Stack(
alignment: Alignment.center,
children: [
Positioned(
child: Text('TOP OFFERS / DISCOUNT'))
],
),
Container(
height: 150,
width: double.infinity,
color: HexColor("ffa400"),
child:
// Column(
// children: [
CarouselSlider.builder(
options: CarouselOptions(
height: 140,
autoPlay: true,
viewportFraction: 0.8,
enlargeCenterPage: true,
onPageChanged: (index, reason) {
setState(() {
activeIndex = index;
});
}),
itemCount: firstImages.length,
itemBuilder: (context, index, realIndex) {
final firstImage = firstImages[index];
return Column(
children: [
Expanded(child: buildImage(firstImage, index)),
buildIndicator(),
],
);
},
),
使用Column代替ListView