I am trying to make custom Navigation Bar. I need to animate the width of each item according to it's content. using Animated Container right now and width hardcoded. I need that width to be variable. Dont wanna use flexible with the text widget cause that messes up the height. Any solutions?
AnimatedContainer(
width: isActive ? 110 : 50,
duration: const Duration(milliseconds: 500),
decoration: BoxDecoration(
color: isActive ? primaryColor.withOpacity(0.2) : Colors.transparent,
borderRadius: BorderRadius.circular(20.0),
),
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 10.0),
child: isActive
? Row(
children: [
SvgPicture.asset(
svgIcon,
color: primaryColor,
height: 20.0,
),
10.horizontalSpace,
Text(
label,
style: const TextStyle(
color: primaryColor,
),
),
],
)
: SvgPicture.asset(
svgIcon,
color: Colors.grey,
height: 20.0,
),
),