I make use of the flutter animations package: https://pub.dev/packages/animations
I am trying to open the container automatically after 3 seconds in my initState function. Is there any way to trigger the container programmatically? I can not find any implementation of a controller or something...
@override
Widget build(BuildContext context) {
OpenContainer(
transitionDuration: Duration(milliseconds: 400),
transitionType: _transitionType,
openBuilder: (BuildContext context, VoidCallback _) {
return AddRouteParent();
},
closedElevation: 6.0,
closedShape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(_fabDimension / 2),
),
),
closedColor: Color(0xff17c387),
closedBuilder:
(BuildContext context, VoidCallback openContainer) {
return Showcase(
shapeBorder: CircleBorder(),
radius: BorderRadius.all(Radius.circular(30)),
overlayPadding: EdgeInsets.all(5),
key: _five,
description:
'Hier kannst du dir deine\neigene Route erstellen.',
child: SizedBox(
height: _fabDimension,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 20, 0),
child: Row(mainAxisSize: MainAxisSize.min, children: [
Icon(
Icons.add,
color: Colors.white,
),
SizedBox(width: 12),
Text("Erstellen",
style:
TextStyle(color: Colors.white, fontSize: 18))
]),
),
),
);
});
}
Solved this a while ago, just store the action parameter from the closedBuilder like this:
closedBuilder: (BuildContext context, void Function() action) {
_openContainer = action;
Then call it anywhere else like this: _openContainer.call();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With