So I have a Widget and inside the build method:
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraint) {
return Container(
child: GestureDetector(
behavior: HitTestBehavior.translucent,
child: swipeTile),
);
});
}
When I call setState in another function the Widget wont update. It will still show the old "swipeTile".
void newSwipeTile(int swipeDirection) {
swipeTile.tile.disposeAnim();
setState(() {
this.swipeDirection = swipeDirection;
this.round++;
this.swipeTile = new SwipeTile(size: 40);
});
}
I already tried using a Container and asigning an Unique Key to it with the swipe tile as a child. That acutally worked but then I got this error message: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4606 pos 12: '_state._element == null': is not true.
child: Container(
key: UniqueKey(),
child: swipeTile,
)