Positioned in the animated version.
Only a child to work when the Stack.
If the child's size will change during the animation, it is a good choice AnimatedPositioned
double indicatorWidth = (width * 2 / 3).ceilToDouble();
double indicatorHeight = 2;
double indicatorTopMargin = height - indicatorHeight*2;
double left = (currentIndex * width + indicatorWidth / 4).ceilToDouble();
Widget _indicator() {
return AnimatedPositioned(
left: left,
child: Container(
height: indicatorHeight,
width: indicatorWidth,
margin: EdgeInsets.only(top: indicatorTopMargin),
color: kGridTextColor,
),
duration: Duration(milliseconds: 200),
);