flutter_staggered_grid_view icon indicating copy to clipboard operation
flutter_staggered_grid_view copied to clipboard

scrollbar bounce while scrolling

Open OPY-bbt opened this issue 5 years ago • 3 comments

I want to add scrollbar in grid view, but the scrollbar position is bouncing while scrolling.

OPY-bbt avatar Jul 11 '19 09:07 OPY-bbt

I don't understand the issue, please give me more details.

letsar avatar Dec 12 '21 17:12 letsar

When You use BouncingPhysics on ScrollBox and scroll to End, Scroll starts to move to something strange

[
        SliverList(
          delegate: SliverChildListDelegate(
            [
              const SizedBox(height: 30),
              const Align(
                alignment: Alignment.centerLeft,
                child: H2Text(
                  'Iron Club',
                  color: ColorData.allMainBlack,
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(top: 5.0),
                child: ReadMoreText(
                  'Flutter is Google’s mobile UI open source framework to build high-quality native (super fast) interfaces for iOS and Android apps with the unified codebase.',
                  trimLines: 2,
                  delimiter: '',
                  colorClickableText: ColorData.allMainActivegray,
                  trimMode: TrimMode.Line,
                  trimCollapsedText: ' показать полностью',
                  trimExpandedText: ' скрыть',
                  style: const TextStyle(
                    fontSize: P3TextStyle.fontSize,
                    fontWeight: P3TextStyle.fontWeight,
                    height: P3TextStyle.height,
                    color: ColorData.allMainGray,
                  ),
                  moreStyle: TextStyle(
                    fontSize: P3TextStyle.fontSize,
                    fontWeight:
                        FontWeight.values[P3TextStyle.fontWeight.index + 1],
                    height: P3TextStyle.height,
                    color: ColorData.allMainActivegray,
                  ),
                ),
              ),
              const Padding(
                padding: EdgeInsets.symmetric(vertical: 10),
                child: ClubBottomCards(
                  rating: 5,
                  price: 20,
                  locationText: 1,
                ),
              ),
              WorkTimeCard(
                title: 'Сегодня 06:00 — 22:00',
                label: 'label',
                onPhoneTap: () {},
                onNetworkTap: () {},
              ),
              Padding(
                padding: const EdgeInsets.only(top: 20),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: const [
                    AddressCard(),
                    SizedBox(height: 10),
                    CustomButton(
                      color: Colors.white,
                      title: 'dwa',
                      titleColor: Colors.black,
                    )
                  ],
                ),
              ),
            ],
          ),
        ),
        const SliverToBoxAdapter(
          child: Padding(
            padding: EdgeInsets.only(bottom: 20, top: 40),
            child: H2Text(
              'Дополнительно',
              color: ColorData.mainBlack,
            ),
          ),
        ),
        SliverLayoutBuilder(
          builder: (context, constraints) {
            return SliverMasonryGrid.count(
              crossAxisCount: (constraints.crossAxisExtent / 160).ceil(),
              itemBuilder: (ctx, index) {
                return Container(
                  padding: const EdgeInsets.all(15),
                  decoration: const BoxDecoration(
                    color: ColorData.allMessagesbackground,
                    borderRadius: BorderRadius.all(
                      Radius.circular(15),
                    ),
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      const SizedBox(height: 24, width: 24),
                      Padding(
                        padding: const EdgeInsets.only(top: 5),
                        child: P2Text(index.toString()),
                      ),
                    ],
                  ),
                );
              },
              childCount: 10,
              mainAxisSpacing: 10,
              crossAxisSpacing: 10,
            );
          },
        ),

        const SliverToBoxAdapter(
          child: Padding(
            padding: EdgeInsets.only(bottom: 10.0, top: 40),
            child: H2Text(
              'Контакты',
              color: ColorData.allMainBlack,
            ),
          ),
        ),
        SliverLayoutBuilder(
          builder: (context, constraints) {
            return SliverMasonryGrid.count(
              crossAxisSpacing: 10,
              mainAxisSpacing: 10,
              crossAxisCount: (constraints.crossAxisExtent / 240).ceil(),
              itemBuilder: (ctx, index) {
                return Container(
                  padding: const EdgeInsets.all(15),
                  decoration: const BoxDecoration(
                    color: ColorData.allMessagesbackground,
                    borderRadius: BorderRadius.all(
                      Radius.circular(15),
                    ),
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: const [
                      SizedBox(height: 46, width: 46),
                      Padding(
                        padding: EdgeInsets.only(top: 5, bottom: 3),
                        child: P3BoldText('Телефон'),
                      ),
                      P3Text('@ironclubkz')
                    ],
                  ),
                );
              },
              childCount: 5,
            );
          },
        ),

]

Hellomik2002 avatar Apr 01 '22 10:04 Hellomik2002

@Hellomik2002 can you please make a video or something to show me what is going on? Or a code sample I would just have to copy/paste and run?

letsar avatar Jul 10 '22 08:07 letsar

cacheExtent: did the trick for me

vincent-iQontrol avatar Oct 21 '22 08:10 vincent-iQontrol

I'm closing since I'm not sure how to help

letsar avatar Nov 01 '22 10:11 letsar