To do that you have to change three things: First, transform from StatelessWidget to StatefulWidget; Second, create a variable for the height of the container and initialized whit the initial height; Thread, you have to change the container with an AnimatedContaire ad crate a function onPressd Like this:
AnimatedContainer(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5.0),
boxShadow: [
BoxShadow(
color: Colors.black,
blurRadius: 6.0,
spreadRadius: 0.5,
offset: Offset(0.7, 0.7),
),
],
),
duration: Duration(milliseconds: 1),
height: heigntValue,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
RaisedButton(
onPressed: () {
setState(() {
if (heigntValue == 350) {
heigntValue -= 300;
} else {
heigntValue += 300;
}
print(heigntValue);
});
},
),
],
),
),
],
),
),
CLICK HERE to find out more related problems solutions.