TatsuUkraine / flutter_sticky_infinite_list

Multi directional infinite list with Sticky headers for Flutter applications
BSD 2-Clause "Simplified" License
341 stars 31 forks source link

BouncingScrollPhysics does not work at the start of a list when using shrinkwrap #53

Closed Hannnes1 closed 3 years ago

Hannnes1 commented 3 years ago

Describe the bug When creating a ListView and setting shrinkWrap to true the list does not bounce at the start (top if reverse is false, bottom if reverse is true) like it does at the end. This happens even if setting the physics to AllwaysScrollablePhysics(). The problem is also there whether or not the list needs to be scrollable to show all the content.

To Reproduce Steps to reproduce the behavior:

  1. Creatre a new flutter application
  2. Replace home with a ListView
  3. Set shrinkwrap to true
  4. Set physics to BouncingScrollPhysics(parent: AllwaysScrollablePhysics())
  5. Fill the list with some content
  6. Scroll down to the bottom and beyond => List bounces back
  7. Scroll to the top and beyond => List stops without bouncing

Expected behavior The list should bounce the same in both like it does when shrinkwrap is false.

Code example

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(),
        body: ListView.builder(
          shrinkWrap: true,
          physics: BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
          itemCount: 50,
          itemBuilder: (context, index) => 
            Text('Item $index'),
        ),
      ),
    );
  }
}

Environment (please complete the following information):

TatsuUkraine commented 3 years ago

Hey, thank you for this issue. How it applies to this package? Codesample that I see is pure flutter code, without any packages

Hannnes1 commented 3 years ago

Oh, sorry about that... I didn't check what repository I was in when creating the issue. I just thought that I was in the flutter repo.

TatsuUkraine commented 3 years ago

no worries)) glad you were looking at my package, though))