fix: logo display

This commit is contained in:
lollipopkit
2024-05-10 11:28:27 +08:00
parent 9a60e8f075
commit d538367354

View File

@@ -103,10 +103,11 @@ class _ServerDetailPageState extends State<ServerDetailPage>
Widget _buildMainPage(Server si) { Widget _buildMainPage(Server si) {
final buildFuncs = !Stores.setting.moveOutServerTabFuncBtns.fetch(); final buildFuncs = !Stores.setting.moveOutServerTabFuncBtns.fetch();
final logoUrl = si.spi.custom?.logoUrl; final logoUrl = si.spi.custom?.logoUrl;
final listLen = () { final buildLogo = logoUrl != null;
var len = _cardsOrder.length; final moreLen = () {
var len = 0;
if (buildLogo) len++;
if (buildFuncs) len++; if (buildFuncs) len++;
if (logoUrl != null) len++;
return len; return len;
}(); }();
return Scaffold( return Scaffold(
@@ -130,16 +131,15 @@ class _ServerDetailPageState extends State<ServerDetailPage>
right: 13, right: 13,
bottom: _media.padding.bottom + 77, bottom: _media.padding.bottom + 77,
), ),
itemCount: listLen, itemCount: _cardsOrder.length + moreLen,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == 0 && logoUrl != null) { index -= moreLen;
if (index == -2 && buildLogo) {
return _buildLogo(logoUrl, si.status.more[StatusCmdType.sys]?.dist); return _buildLogo(logoUrl, si.status.more[StatusCmdType.sys]?.dist);
} }
if (index == 1 && buildFuncs) { if (index == -1 && buildFuncs) {
return ServerFuncBtns(spi: widget.spi); return ServerFuncBtns(spi: widget.spi);
} }
if (logoUrl != null) index--;
if (buildFuncs) index--;
return _cardBuildMap[_cardsOrder[index]]?.call(si.status); return _cardBuildMap[_cardsOrder[index]]?.call(si.status);
}, },
), ),