I want to do a slide-down
animation for a widget. I've seen a lot of examples from the internet but nothing meets my requirements. Here is what I need. Below is a custom widget I made.
Widget Toast(String content, ToastType type) {
return Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(50),
child: Card(
elevation: 10,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
color: ToastColors[type.index],
child: Padding(
padding: const EdgeInsets.only(left: 15, right: 20, top: 10, bottom: 10),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ToastIcons[type.index],
SizedBox(
width: 15,
),
Flexible(
child: Text(
content,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w400,
),
),
),
],
),
),
),
),
],
);
}
It's a toast layout. I want this to be accessible from anywhere within the app. That's why I've created separate dart
file for this.
What I want? When the widget is shown, I want the toast layout to slide down. I don't want to loop or reverse the animation. After the animation is completed, the widget must stay still in the end position.