Kanat
Kanat

Reputation: 21

Laggs when scrolling SliverGrid

I couldn't create a problem on github, so I'm asking here. This is a prototype of the main page of the app I'm going to put into production. On the main page I'm using few SliverToBoxAdapters, two SliverGrid, to show categories, ads, popular goods and shops, and everything seems to be working fine, but when scroll, I notice some lags when the scrolling is about to stop. It happens with enabled/disabled Impeller, though with enabled Impeller scrolling is better. This happens on android, I haven't tested it on iOS yet. My device: android realme C67, supports Vulkan Steps to reproduce this problem:

  1. clone from the repo from my git: https://github.com/Kanat9494/mars.git
  2. Run flutter pub get
  3. Run the app in profile mode
  4. Scroll items

I have tried set a fixed height and width Image widgets, but it didn't help. I do not know what I am doing wrong, because I am new to flutter.

Upvotes: 0

Views: 61

Answers (1)

Farooq Haroon
Farooq Haroon

Reputation: 79

Just removing the height parameters and adding the isBottomBarVisible in the behalf of height can fix this issue

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(),

Upvotes: 0

Related Questions