'Flutter Animated Positioned with Text Child Sliding onto the Screen
I'm new to animations in flutter and I am running into this weird error on my text/button animation.
So I'm trying to build an app page where on click of a button, this AnimatedContainer
with two children: Text
and Raised Button
(with Text
child) slide onto the screen from where they were originally off the screen.
AnimatedPositioned(
bottom: _bottom,
left: _left,
right: _right,
curve: Curves.bounceOut,
duration: Duration(seconds: 2),
child: Container(
width: MediaQuery.of(context).size.width,
child: Column(
children: <Widget>[
Text(
"how was your experience?",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
RaisedButton(
onPressed: () {
expSubmitted();
},
elevation: 2.0,
color: Color(0xffffee57),
child: Text(
"next"
),
padding: EdgeInsets.all(15.0),
)
],
),
),
)
However, when the text animates onto the page, the text appears but stacked on the page and when it leaves the screen, the text for some reason stays (see video). Is there a specific widget that I should be using instead of AnimatedPositioned
here? Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|