Appbar is bugged on the released version only when i use a streambuilder inside the badgeContent on a Badge widget. It shows a white overlay on the appbar when i run the released version and it works just fine on the debug version.
appBar: AppBar(
elevation: 0,
title: showProfileIcon == true
? IconButton(
onPressed: () {
Navigator.pushNamed(context, ProfilePage.id);
},
icon: const Icon(FontAwesomeIcons.solidUser))
: null,
actions: showShoppingCartIcon == true
? [
badges.Badge(
position: badges.BadgePosition.topEnd(top: 0, end: 2),
showBadge: true,
ignorePointer: false,
badgeContent: StreamBuilder(
stream: _firestore
.collection('ShoppingCart')
.doc(_auth.currentUser!.uid)
.snapshots(),
builder: (context, AsyncSnapshot snapshot) {
if (!snapshot.hasData) {
return const Text('.');
} else {
int cartListItemsLength =
snapshot.data['Cart'].length;
return Positioned(
top: 3.0,
left: 4.0,
child: Text(
cartListItemsLength.toString(),
style: const TextStyle(color: kPrimaryColor),
),
);
}
}),
badgeStyle: const badges.BadgeStyle(
shape: badges.BadgeShape.circle,
badgeColor: kLightGreyColor,
elevation: 0,
),
child: IconButton(
onPressed: () {
Navigator.pushNamed(context, ShoppingCart.id);
},
icon: const Icon(FontAwesomeIcons.cartShopping)),
),
]
: customActions),
This how it looks like on debug version:
This is how it looks like on release version:
I tried to use a plain Text widget without a streambuilder inside the badgeContent to check whether the problem is from the Badge package or from the streambuilder itself and it just worked fine without the overlay that appears on the release version.
I'm using flutter build apk --release
to build the apk release version.