fluttercommunity / flutter_sticky_headers

Flutter Sticky Headers - Lets you place "sticky headers" into any scrollable content in your Flutter app. No special wrappers or magic required. Maintainer: @slightfoot
https://pub.dev/packages/sticky_headers
MIT License
1.1k stars 129 forks source link

Wobbly headers when used along `infinite_listview` #27

Closed ghost closed 2 years ago

ghost commented 5 years ago

When using this library along with infinite_listview, some headers of the negative indexes get flicky. It happens until the index 0 is visible, then it stops.

You should be able to see some blank spaces between some headers and the AppBar:

ezgif com-video-to-gif

The code used in the example above:

import 'package:flutter/material.dart';
import 'package:infinite_listview/infinite_listview.dart';
import 'package:sticky_headers/sticky_headers.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Example(),
      theme: ThemeData(primarySwatch: Colors.blueGrey),
    );
  }
}

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Example'),
      ),
      body: InfiniteListView.builder(
        itemBuilder: (_, int index) {
          return StickyHeader(
            header: header(context),
            content: ListTile(
              title: Text('Item #$index'),
              subtitle: Text('Description'),
            ),
          );
        },
      ),
    );
  }

  Container header(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(16),
      width: double.infinity,
      color: Colors.blueGrey[700],
      child: Text(
        'Header',
        style: Theme.of(context).textTheme.title.copyWith(color: Colors.white),
      ),
    );
  }
}
TatsuUkraine commented 5 years ago

@hugocbpassos Had same issue https://github.com/fluttercommunity/flutter_sticky_headers/issues/19, since I didn't get any response, I wrote own implementation of sticky headers that doesn't have this issue and published to pub dart

TatsuUkraine commented 5 years ago

@hugocbpassos https://pub.dev/packages/sticky_infinite_list

loomp commented 4 years ago

Having the same issue. It happens after scrollTo/jumpTo is called of ScrollablePositionedList (Google).

slightfoot commented 2 years ago

This should be fixed as-of v0.3.0.