我无法在github上创建问题,所以我在这里问。 这是我将要投入生产的应用程序主页的原型。在主页上,我使用了几个 SliverToBoxAdapters、两个 SliverGrid 来显示类别、广告、热门商品和商店,一切似乎都工作正常,但是当滚动时,我注意到当滚动即将停止时有一些滞后。启用/禁用叶轮时会发生这种情况,尽管启用叶轮滚动效果更好。 Android 上会出现这种情况,iOS 上我还没有测试过。 我的设备:android realme C67,支持Vulkan 重现此问题的步骤:
我尝试设置固定高度和宽度的图像小部件,但没有帮助。我不知道我做错了什么,因为我是颤振的新手。
只需删除高度参数并添加代表高度的 isBottomBarVisible 即可解决此问题
var isBottomBarVisible = true;
bottomNavigationBar: isBottomBarVisible
? AnimatedBuilder(
animation: _scrollController,
builder: (context, child) => AnimatedContainer(
duration: const Duration(milliseconds: 300),
child: BottomNavigationBar(
showSelectedLabels: false,
showUnselectedLabels: false,
iconSize: 35,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home_outlined),
label: '',
),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle_outlined),
label: '',
)
],
),
))
: const SizedBox.shrink(),