In a container widget I am showing a text widget for displaying content. I am using same container but the text content differs based on user selection. when user choose different option is it possible to fade the old content and show new content with animation.
String content = "content";
String subcontent = "subContent";
switch (contentType) {
case 1:
content = "content1";
subcontent = "subContent1";
break;case 2:
content = "content2";
subcontent = "subContent2";
break;case 3:
content = "content3";
subcontent = "subContent3";
break;
default:
constantDataName = "content1";
subcontentFieldName = "subContent1";
break;
}
return Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
margin: const EdgeInsets.only(left: 20, right: 20),
padding: const EdgeInsets.all(20),
decoration: const BoxDecoration(
color: Color.fromRGBO(255, 255, 255, 1),
borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25), bottomLeft: Radius.circular(25), bottomRight: Radius.circular(25)),
boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.03999999910593033), offset: Offset(0, 1), spreadRadius: 5, blurRadius: 10)],
),
child: Column(
children: [
Text(content1),const SizedBox(height: 10),Text(subcontent1),],
),
);
Thanks,