Home > Software engineering >  Flutter change axis coordinates dirrections
Flutter change axis coordinates dirrections

Time:07-20

Inside AnimatedContainer I draw progressBar from left to right. Is there any way to change dirrection (mirror axis) so progress bar will start drawing from right to left ?

SizedBox(
  height: 20,
  child: Stack(
    children: [
      AnimatedContainer(
        width: MediaQuery.of(context).size.width / 100 * perc,
        color: Colors.green,
        duration: const Duration(milliseconds: 500),
      ),
      Row(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text('text1'),
          Text('text2'),
        ],
      ),
    ],
  ),
);

CodePudding user response:

Try using positioned widget like Align or Positioned

Align(
  alignment: Alignment.centerRight,
  child: AnimatedContainer(
    alignment: Alignment.centerRight,
    width: MediaQuery.of(context).size.width / 100 * perc,
  • Related