Performance issues of banner ad with animations package or any other animation widget
The release version has major performance issues when a new page with the admob banner is loaded. The widget itself is causing this issue. In my case, I have the AdmobBanner() sitting in a class which gets called during init.State of any page and is put in the bottomNavigationBar of the Scaffold(). My home screen has a container transition from the animations package to open up some cards in a list view. You can see the visual examples below. With AdmobBanner() Without AdmobBanner()
My current solution for a smooth open animation is to add a delay of 500-1000ms before returning the AdmobBanner widget and having a FutureBuilder in my bottomNavigationBar (see this example (delay is 2000ms)). The other widgets, expanded/flexible buttons especially, will change their positioning based on this delay which might be against Admob policy and it doesn't look very pretty.
The closing animation can be dealt with by wrapping the scaffold inside WillPopScope and then-
return WillPopScope(
onWillPop: () async {
setState(() {
bannerAd = SizedBox.shrink();
});
await Future.delayed(Duration(milliseconds: 50));
return true;
},
child: Scaffold(
...
));
The closing animation after this workaround works great but the opening sequence is still not very optimal. Also, any ongoing animation gets stuttered when the AdmobBanner kicks in.
Great plugin overall btw and a better replacement for firebase_admob, cheers.