Skip to content

Commit 9a7ae5e

Browse files
committed
fix: #383
1 parent b9740e2 commit 9a7ae5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/widget/forum/auto_banner.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,14 @@ class AutoBannerState extends State<AutoBanner> {
153153
return Container();
154154
}
155155
list ??= AnnouncementRepository.getInstance().getBannerExtras();
156-
// Only update if list is null
156+
// Only update if list is null. And if the update fails, return nil
157157
if (list == null && !updateBannerList()) {
158158
return Container();
159159
}
160+
// If the list is empty (i.e. no banner), return nil
161+
if (list!.isEmpty) {
162+
return Container(); // FIXME: using `nil` here will break the layout. Don't know why.
163+
}
160164

161165
// Since the banner is not a fixed size, we need to use [SizedByChildBuilder]
162166
// to get the height of the banner. Otherwise, [Swiper] will have infinite

0 commit comments

Comments
 (0)