Flutter Sticky Headers - Lets you place "sticky headers" into any scrollable content in your Flutter app. No special wrappers or magic required. Maintainer: @slightfoot

Overview

Flutter Community: sticky_headers

Flutter Sticky Headers

pub package

Lets you place headers on scrollable content that will stick to the top of the container whilst the content is scrolled.

Usage

You can place a StickyHeader or StickyHeaderBuilder inside any scrollable content, such as: ListView, GridView, CustomScrollView, SingleChildScrollView or similar.

Depend on it:

dependencies:
  sticky_headers: "^0.1.8"

Import it:

import 'package:sticky_headers/sticky_headers.dart';

Use it:

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView.builder(itemBuilder: (context, index) {
      return StickyHeader(
        header: Container(
          height: 50.0,
          color: Colors.blueGrey[700],
          padding: EdgeInsets.symmetric(horizontal: 16.0),
          alignment: Alignment.centerLeft,
          child: Text('Header #$index',
            style: const TextStyle(color: Colors.white),
          ),
        ),
        content: Container(
          child: Image.network(imageForIndex(index), fit: BoxFit.cover,
            width: double.infinity, height: 200.0),
        ),
      );
    });
  }
}

Examples

Example 1 - Headers and Content

Demo 1

Example 2 - Animated Headers with Content

Demo 2

Example 3 - Headers overlapping the Content

Demo 3

Bugs/Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on Github and I'll look into it. Pull request are also welcome.

Comments
  • Blinking 1px line above the sticky header

    Blinking 1px line above the sticky header

    First off, huge thanks for this plugin. Big big help!

    Tiny bug: When scrolling there is a 1px line above the header. See here: https://share.icloud.com/photos/00iofG5V2K9aKDL6Mb2gZ8uKg

    demostration: https://share.icloud.com/photos/0O38S_lN4_3i1TAmXjyu22QiQ

    Here is the code:

    Expanded(
                    child: ListView.builder(
                      itemCount: 1,
                      itemBuilder: (BuildContext context, int index) {
                        return Column(
                          children: <Widget>[
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.stretch,
                              children: <Widget>[
                                ByCategory(category: 'WORLD'),
                                SizedBox(
                                  height: grid1,
                                ),
                                WorldRow1(),
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                                  children: <Widget>[
                                    WorldRow3(
                                      statusColor: themeOrange,
                                      title: 'ACTIVE',
                                    ),
                                    SizedBox(
                                      width: grid2,
                                    ),
                                    WorldRow3(
                                      statusColor: themeRed,
                                      title: 'DIED',
                                    ),
                                    SizedBox(
                                      width: grid2,
                                    ),
                                    WorldRow3(
                                      statusColor: themeGreen,
                                      title: 'RECOVERED',
                                    ),
                                  ],
                                ),
                              ],
                            ),
                            Padding(
                              padding: const EdgeInsets.only(top: grid7),
                              child: StickyHeader(
                                header: Container(
                                  padding: EdgeInsets.only(top: 88.0),
                                  decoration: BoxDecoration(
                                    color: themeBackgroundColor,
                                    borderRadius: BorderRadius.only(
                                      bottomLeft: Radius.circular(grid2),
                                      bottomRight: Radius.circular(grid2),
                                    ),
                                  ),
                                  child: Column(
                                    crossAxisAlignment: CrossAxisAlignment.stretch,
                                    children: <Widget>[
                                      ByCategory(category: 'BY COUNTRY'),
                                      SizedBox(
                                        height: grid1,
                                      ),
                                      CountriesTableHeader(),
                                    ],
                                  ),
                                ),
                                content: Column(
                                  children: <Widget>[
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                    CountryRow(),
                                  ],
                                ),
                              ),
                            ),
                          ],
                        );
                      },
                    ),
                  ),
    
    opened by tomasbaran 16
  • Is there a way to have multiple content under one StickyHeader?

    Is there a way to have multiple content under one StickyHeader?

    Is there a way to have more than one content for one StickyHeader?

    As of right now, I can only manage to get one ListTile widget underneath a StickyHeader widget. But I want to make a single ListView with two StickyHeader widgets and five ListTile widgets underneath each StickyHeader widget -- is that possible?

    Thank you in advance @slightfoot for any help you can provide!

    parked 
    opened by ctrinh98 14
  • Headers don't get stick to top after disappearing keyboard.

    Headers don't get stick to top after disappearing keyboard.

    sticky_header_issue

    Headers don't get stick to top when I try to disappear keyboard . it does not work as it should do. sticky header overlaps its own content . when I scroll little bit then it goes to its place on top as you can see in uploaded Gif.

    opened by am1tr0r 6
  • Null safety

    Null safety

    Hi,

    Our team is using this package and is works really well, thank you.

    To continue using it we need this package to be upgraded to null stafety: https://dart.dev/null-safety/migration-guide

    Please let us know if this is planned for this package.

    opened by jj-hoeksema 5
  • Silent exception occurring when build StickyHeaders.

    Silent exception occurring when build StickyHeaders.

    NoSuchMethodError (NoSuchMethodError: The method '-' was called on null. Receiver: null

    Intro

    Hi, my team is facing an exception when building a list of StickyHeader. The exception does not affect the user but is polluting our crashlytics.

    Images

    image image

    To reproduce:

    • Clone https://github.com/fluttercommunity/flutter_sticky_headers
    • Run the example
    • Turn on All Breakpoints and Uncaught Exceptions.
    • Navigate to any example

    Additional Information

    • Flutter Doctor:
    Running flutter doctor...
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale pt-BR)
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    [✓] Xcode - develop for iOS and macOS (Xcode 11.7)
    [✓] Android Studio (version 3.6)
    [✓] VS Code (version 1.48.2)
    [✓] Connected device (2 available) 
    
    
    opened by irvine5k 5
  • Sticky Header Not Stick on Top

    Sticky Header Not Stick on Top

    Sticky Header Not Stick on Top

    Images

    Screenshot_1603361527

    Screenshot_1603361536

    Step To Reproduce

    1. ListView Builder with Sticky Header
    2. At the end of content put form
    3. Scroll down to form and tap/focus on any input box keyboard will show.
    4. After the keyboard opens just close using the android navigation return key.
    5. Sticky header will show in the middle of the screen.

    My Sample Code

    ListView.builder(
                      itemCount: 1,
                      controller: _scrollController,
                      physics: BouncingScrollPhysics(),
                      itemBuilder: (context, index) {
                        return StickyHeader(
                          overlapHeaders: true,
                          header: Material(
                            color: AppColors.White,
                            shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.zero,
                            ),
                            child: Padding(
                              padding: EdgeInsets.all(10),
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                mainAxisAlignment: MainAxisAlignment.start,
                                mainAxisSize: MainAxisSize.max,
                                children: [
                                  InkWell(
                                    child: Padding(
                                      padding: EdgeInsets.all(10),
                                      child: Icon(
                                        Icons.comment,
                                        color: AppColors.Red,
                                      ),
                                    ),
                                    splashColor: AppColors.Red.withOpacity(0.5),
                                    onTap: () {
                                      setState(() {
                                        _shareYourThoughts = true;
                                      });
                                      var scrollPosition = _scrollController.position;
                                      if (scrollPosition.viewportDimension < scrollPosition.maxScrollExtent) {
                                        _scrollController.animateTo(
                                          scrollPosition.maxScrollExtent,
                                          duration: new Duration(milliseconds: 200),
                                          curve: Curves.easeOut,
                                        );
                                      }
                                    },
                                  ),
                                  InkWell(
                                    child: Padding(
                                      padding: EdgeInsets.all(10),
                                      child: Icon(
                                        Icons.email,
                                        color: AppColors.Red,
                                      ),
                                    ),
                                    splashColor: AppColors.Red.withOpacity(0.2),
                                    onTap: () {},
                                  ),
                                  InkWell(
                                    child: Padding(
                                      padding: EdgeInsets.all(10),
                                      child: Icon(
                                        Icons.file_download,
                                        color: AppColors.Red,
                                      ),
                                    ),
                                    splashColor: AppColors.Red.withOpacity(0.2),
                                    onTap: () async {
                                      var status = await Permission.storage.status;
                                      if (status.isGranted) {
                                        var listDirectories = await _requestExternalStorageDirectory();
                                        if (listDirectories != null) {
                                          _applicationDocumentDirectory = listDirectories[0];
                                        }
                                        if (_applicationDocumentDirectory != null) {
                                          Directory appDownload = Directory(_applicationDocumentDirectory.path);
                                          taskId = await FlutterDownloader.enqueue(
                                            url: postDownloadUrl,
                                            savedDir: appDownload.path,
                                            showNotification: true, // show download progress in status bar (for Android)
                                            openFileFromNotification: true, // click on notification to open downloaded file (for Android)
                                          );
                                        }
                                      }
                                    },
                                  )
                                ],
                              ),
                            ),
                          ),
                          content: Padding(
                            padding: EdgeInsets.all(20),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              mainAxisAlignment: MainAxisAlignment.start,
                              mainAxisSize: MainAxisSize.max,
                              children: [
                                CategoryButton(
                                  category: postCategory,
                                  categoryId: state.post.catId,
                                ),
                                Padding(
                                  padding: const EdgeInsets.only(top: 10, bottom: 10),
                                  child: Text(
                                    postTitle,
                                    style: TextStyle(
                                      color: AppColors.Black,
                                      fontFamily: AppFonts.Font_Family,
                                      fontWeight: FontWeight.bold,
                                      letterSpacing: 0.1,
                                      shadows: [
                                        Shadow(
                                          blurRadius: 0.1,
                                        )
                                      ],
                                      fontSize: 24,
                                    ),
                                  ),
                                ),
                                Padding(
                                  padding: const EdgeInsets.only(bottom: 10),
                                  child: Text(
                                    DateFormat.yMMMMd().format(DateTime.parse(postDate)),
                                    style: TextStyle(
                                      color: AppColors.Grey,
                                      fontFamily: AppFonts.Font_Family,
                                      fontWeight: FontWeight.normal,
                                      letterSpacing: 0.1,
                                      shadows: [
                                        Shadow(
                                          blurRadius: 0.1,
                                        )
                                      ],
                                      fontSize: 18,
                                    ),
                                  ),
                                ),
                                Html(
                                  data: postContent,
                                  onLinkTap: AppNavigation.launchUrl,
                                  style: {
                                    "p": Style(
                                      color: AppColors.Black,
                                      fontFamily: AppFonts.Font_Family,
                                      fontWeight: FontWeight.w400,
                                      letterSpacing: 0.1,
                                      textShadow: [
                                        Shadow(
                                          blurRadius: 0.1,
                                        )
                                      ],
                                      fontSize: FontSize(18),
                                      padding: EdgeInsets.all(0),
                                    ),
                                    "a": Style(
                                      textDecoration: TextDecoration.none,
                                      color: AppColors.Red,
                                      fontFamily: AppFonts.Font_Family,
                                      fontWeight: FontWeight.w400,
                                      letterSpacing: 0.1,
                                      textShadow: [
                                        Shadow(
                                          blurRadius: 0.1,
                                        )
                                      ],
                                      fontSize: FontSize(18),
                                      padding: EdgeInsets.all(0),
                                    ),
                                    "li": Style(
                                      color: AppColors.Black,
                                      fontFamily: AppFonts.Font_Family,
                                      fontWeight: FontWeight.w400,
                                      letterSpacing: 0.1,
                                      textShadow: [
                                        Shadow(
                                          blurRadius: 0.1,
                                        )
                                      ],
                                      fontSize: FontSize(18),
                                      padding: EdgeInsets.only(
                                        top: 5,
                                        bottom: 2.5,
                                      ),
                                    ),
                                  },
                                ),
                                InkWell(
                                  splashColor: AppColors.Red.withOpacity(0.2),
                                  onTap: () {
                                    setState(() {
                                      _shareYourThoughts = true;
                                    });
                                  },
                                  child: Padding(
                                    padding: const EdgeInsets.only(top: 10, bottom: 10),
                                    child: Text(
                                      "Share your thoughts",
                                      style: TextStyle(
                                        color: AppColors.Red,
                                        fontFamily: AppFonts.Font_Family,
                                        fontWeight: FontWeight.normal,
                                        letterSpacing: 0.1,
                                        shadows: [
                                          Shadow(
                                            blurRadius: 0.1,
                                          )
                                        ],
                                        fontSize: 18,
                                      ),
                                    ),
                                  ),
                                ),
                                if (_shareYourThoughts)
                                  Form(
                                    key: _formKey,
                                    child: Column(
                                      crossAxisAlignment: CrossAxisAlignment.start,
                                      mainAxisAlignment: MainAxisAlignment.start,
                                      mainAxisSize: MainAxisSize.max,
                                      children: [
                                        InputBox(
                                          inputType: TextInputType.name,
                                          labelText: "Name",
                                          currentFocusNode: _nameFocus,
                                          nextFocusNode: _emailFocus,
                                          validator: (value) {
                                            if (value.isEmpty) {
                                              return 'Please enter name';
                                            }
                                            return null;
                                          },
                                        ),
                                        InputBox(
                                            inputType: TextInputType.emailAddress,
                                            labelText: "Email",
                                            currentFocusNode: _emailFocus,
                                            nextFocusNode: _websiteFocus,
                                            validator: (value) {
                                              if (value.isEmpty) {
                                                return 'Please enter email';
                                              }
                                              return null;
                                            }),
                                        InputBox(
                                            inputType: TextInputType.url,
                                            labelText: "Website",
                                            currentFocusNode: _websiteFocus,
                                            nextFocusNode: _commentFocus,
                                            validator: (value) {
                                              if (value.isEmpty) {
                                                return 'Please enter website url';
                                              }
                                              return null;
                                            }),
                                        InputBox(
                                          inputType: TextInputType.multiline,
                                          labelText: "Comment",
                                          currentFocusNode: _commentFocus,
                                          isLastFocus: true,
                                          validator: (value) {
                                            if (value.isEmpty) {
                                              return 'Please enter comment';
                                            }
                                            return null;
                                          },
                                          maxLength: 200,
                                        ),
                                        RaisedButton(
                                          onPressed: () {
                                            if (_formKey.currentState.validate()) {
                                              // If the form is valid, display a Snackbar.
                                              Scaffold.of(context).showSnackBar(SnackBar(content: Text('Processing Data')));
                                            }
                                          },
                                          child: Text(
                                            "Submit",
                                            style: TextStyle(
                                              fontFamily: AppFonts.Font_Family,
                                              fontWeight: FontWeight.normal,
                                              letterSpacing: 0.1,
                                              shadows: [
                                                Shadow(
                                                  blurRadius: 0.1,
                                                )
                                              ],
                                              fontSize: 18,
                                            ),
                                          ),
                                        )
                                      ],
                                    ),
                                  ),
                              ],
                            ),
                          ),
                        );
                      },
                    );
    
    opened by devalp-pro 4
  • Wobbly headers when used along `infinite_listview`

    Wobbly headers when used along `infinite_listview`

    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),
          ),
        );
      }
    }
    
    opened by ghost 4
  • Unhandled exception:  setState() called after dispose()

    Unhandled exception: setState() called after dispose()

    Simon, I get this if I scroll the list fast enough:

    Unhandled exception:
    E/flutter ( 4840): setState() called after dispose(): _StickyHeaderBuilderState#2ad9c(lifecycle state: defunct, not mounted)
    _StickyHeaderBuilderState.build.<anonymous closure>.<anonymous closure> (package:sticky_headers/sticky_headers/widget.dart:121:58)
    

    It tells me this:

    *This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback. The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
    

    E/flutter ( 4840): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().*

    I believe the item is being removed from the tree (because of scrolling) before the next frame is displayed.

    opened by marcglasberg 4
  • [BUG] StickyHeader not working inside a CustomScrollView

    [BUG] StickyHeader not working inside a CustomScrollView

    I get the following error when trying to use a StickyHeader inside a CustomScrollView:

    A RenderViewport expected a child of type RenderSliver but received a child of type RenderStickyHeader

    It seems to be misleading that the top of the README for the package states:

    You can place a StickyHeader or StickyHeaderBuilder inside any scrollable content, such as: ListView, GridView, CustomScrollView, SingleChildScrollView or similar.

    opened by Areopagitics 3
  • gridview line header

    gridview line header

    Hello. I have one gridview. I am listing 3 pictures per line. I want to put a title on those 3 pictures. I tried an example like in the picture, but it put the whole list. If I just wrap the cachedimagenetwork, this time it adds a title to each image.

    I want a title for every line, that is, every 3 pictures. You can see my list from the design in the example I posted.

    I searched a lot but couldn't find anything about wrapping the line. Do you have any suggestions?

    Thanks in advance.

    image

    opened by yagizdo 3
  • Sticky Header Crash

    Sticky Header Crash

    Screen Shot 2020-10-29 at 07 11 04 Screen Shot 2020-10-29 at 07 27 12 Screen Shot 2020-10-29 at 07 15 36

    if itemCount set to 2, will cause crash.

    Widget _buildBody(BuildContext context) {
        return ListView.builder(
          controller: _scrollController,
          physics: BouncingScrollPhysics(),
          itemCount: 2,
          itemBuilder: (context, index) {
            return StickyHeader(
              overlapHeaders: true,
              header: Container(
                height: 50.0,
                color: MyColors.lightGrayColor,
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                alignment: Alignment.centerLeft,
                child: Text('Header #$index',
                  style: const TextStyle(color: Colors.white),
                ),
              ),
              content: _buildContent(context),
            );
          },
        );
      }
    
      Widget _buildContent(BuildContext context) {
        return GridView.builder(
          controller: _scrollController,
          shrinkWrap: true,
          physics: BouncingScrollPhysics(),
          itemCount: 30,
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
            mainAxisSpacing: 1,
            crossAxisSpacing: 1,
            childAspectRatio: 1,
          ), 
          itemBuilder: (BuildContext context, int index) {
            return Container(
              height: 44,
              color: MyColors.backgroundColor,
              child: Text(index.toString()),
            );
          },
        );
      }
    

    @brianegan , pls help to check this crash. Thanks a lot!

    opened by xuhongfei 3
  • Adds the possibility to nest multiple sticky headers

    Adds the possibility to nest multiple sticky headers

    This PR partially solves #68.

    I achieved this result with StickyHeaderBuilder since it's rebuilt every time its stuck amount changes, but couldn't achieve it yet with just StickyHeader.

    opened by Skogsfrae 1
  • Nested StickyHeaders

    Nested StickyHeaders

    It would be nice to be able to nest multiple StickyHeaders and keep the inner ones visible under the outer ones. With the current version of the library the inner ones will go under the outer ones and stick on the top corner of the list making them not visible.

    Current behaviour: Simulator Screen Recording - iPhone 14 Pro Max - 2022-12-01 at 09 54 29

    Desired behaviour: Simulator Screen Recording - iPhone 14 Pro Max - 2022-12-01 at 09 47 27

    Use case:

    ListView.builder(
      primary: controller == null,
      controller: controller,
      itemBuilder: (context, index) {
        return StickyHeader(
          controller: controller, // Optional
          header: Container(
            height: 50.0,
            color: Colors.blueGrey[700]?.withOpacity(.7),
            padding: const EdgeInsets.symmetric(horizontal: 16.0),
            alignment: Alignment.centerLeft,
            child: Text(
              'Header #$index',
              style: const TextStyle(color: Colors.white),
            ),
          ),
          content: Column(
            children: [1, 2, 3]
                .map(
                  (index) => StickyHeaderBuilder(
                    controller: controller,
                    builder: (context, stuckAmount) {
                      return Container(
                        height: 30.0,
                        color: Colors.red[700]?.withOpacity(1),
                        padding: const EdgeInsets.symmetric(horizontal: 16.0),
                        alignment: Alignment.centerLeft,
                        child: Text(
                          'Subheader #$index',
                          style: const TextStyle(color: Colors.white),
                        ),
                      );
                    },
                    content: Container(
                      color: Colors.grey[300],
                      child: Image.network(
                        imageForIndex(index),
                        fit: BoxFit.cover,
                        width: double.infinity,
                        height: 200.0,
                      ),
                    ),
                  ),
                )
                .toList(),
          ),
        );
      },
    );
    
    opened by Skogsfrae 0
  •  [BUG] Jumpy header inside CustomScrollView with center key

    [BUG] Jumpy header inside CustomScrollView with center key

    When using StickyHeader inside a CustomScrollView with center key, the header immediately before the center header month jumps around; all the other header months have no problems. A plug and play ready example is found below. If there is an easy way to fix the problem, it would be much appreciated. I have tried countless other options...I am really surprised the sticky header is not included with the flutter CustomScrollView widgets.

    Peek 2022-10-22 13-18

    import 'package:flutter/material.dart';
    import 'package:sticky_headers/sticky_headers.dart';
    
    Map _months = {
      1:'January',
      2:'February',
      3:'March',
      4:'April',
      5:'May',
      6:'June',
      7:'July',
      8:'August',
      9:'September',
      10:'October',
      11:'November',
      12:'December',
    };
    
    abstract class BasePage extends StatefulWidget {
      BasePage({Key? key}) : super(key: key);
    }
    
    abstract class BaseState<Page extends BasePage> extends State<Page> {
      String screenName();
    }
    class CalendarPage extends BasePage {
      CalendarPage({Key? key}) : super(key: key);
      @override
      _CalendarPageState createState() => _CalendarPageState();
    }
    
    
    class _CalendarPageState extends BaseState<CalendarPage>{
      _CalendarPageState();
    
    
      Key centerKey = ValueKey<String>('center');
      var date = DateTime.now();
    
    
     Widget monthBuilder (BuildContext context, int plusMinus){
        int count = (date.month - 13) * -1;
        if(plusMinus==-1){count=date.month-1;}
        return SliverList(
          key: plusMinus==1 ? centerKey:null,
          delegate: SliverChildBuilderDelegate(
            (BuildContext context, int index) {
              int month=date.month+index;
              if(plusMinus==-1){month=date.month-1+(-1*index);}
              return StickyHeader(
                header: Container(
                  color: Colors.brown,
                  padding: EdgeInsets.symmetric(vertical: 12.0),
                  alignment: Alignment.center,
                  child: Text('${_months[month]}',
                    style: Theme.of(context).textTheme.headline2,
                  ),
                ),
                content: ListView.builder(
                  shrinkWrap: true,
                  itemCount: DateTime(date.year,month+1,0).day,//check last day of month for days,
                  itemBuilder: (context, int index) {
                    return Column(children: [
                      Divider(),
                      TextButton( onPressed: () {  },
                      child: Text('Data'),),
                    ]);
                  },
                ),
              );
            },
            childCount: count,
          )
        );
      }
    
      @override
      String screenName() => "Calendar ${date.year}";
    
      @override
      Widget build(BuildContext context) {
        return CustomScrollView(
            center: centerKey,
            slivers: [
              monthBuilder(context, -1),
              monthBuilder(context, 1),
            ],
          );
      }
    }
    
    opened by Areopagitics 1
  • Listview Subheaders

    Listview Subheaders

    I have a listview and I would like to have a sticky header only on certain rows. However, when I do this the sticky header scrolls off as soon as the next non header row comes into view. Is this type of scenario supported at all?

    opened by zachary22321 0
  • Rect argument contained a NaN value

    Rect argument contained a NaN value

    StickyHeader( header: YyTips( msg: "xiangyu_gps_false".tr, btnTitle: "btn_go_setting".tr, onPressed: () {}, ), content: ws)

    当切换到其他pageview页面的时候,会出现异常Rect argument contained a NaN value

    When switching to other pageview pages, an exception will appear " Rect argument contained a NaN value "

    opened by mstestlp 1
Owner
Flutter Community
A central place for all community made Flutter packages. To get started, see the README of the 'community' repository.
Flutter Community
Flutter implementation of sticky headers for sliver

flutter_sticky_header A Flutter implementation of sticky headers with a sliver as a child. Features Accepts one sliver as content. Header can overlap

Romain Rastel 775 Jan 3, 2023
Flutter Sticky Headers - Lets you place

Flutter Sticky Headers Lets you place headers on scrollable content that will stick to the top of the container whilst the content is scrolled. Usage

Flutter Community 901 Dec 28, 2022
State Persistence - Persist state across app launches. By default this library store state as a local JSON file called `data.json` in the applications data directory. Maintainer: @slightfoot

State Persistence Persist state across app launches. By default this library store state as a local JSON file called data.json in the applications dat

Flutter Community 70 Sep 28, 2022
Flutter Infinite ListView - ListView with items that can be scrolled infinitely in both directions. Maintainer: @slightfoot

Flutter Infinite ListView ListView with items that can be scrolled infinitely in both directions. Quick Usage Replace your existing ListView with Infi

Flutter Community 257 Jan 8, 2023
Multi directional infinite list with Sticky headers for Flutter applications

Sticky Infinite List Infinite list with sticky headers. This package was made in order to make possible render infinite list in both directions with s

Denis Beketsky 291 Dec 20, 2022
Flutter implementation of sticky headers for sliver

flutter_sticky_header A Flutter implementation of sticky headers with a sliver as a child. Features Accepts one sliver as content. Header can overlap

Romain Rastel 775 Jan 3, 2023
Multi directional infinite list with Sticky headers for Flutter applications

Sticky Infinite List Infinite list with sticky headers. This package was made in order to make possible render infinite list in both directions with s

Denis Beketsky 291 Dec 20, 2022
A Flutter sticky headers & index ListView. Based on scrollable_positioned_list.

Language: English | 中文简体 azlistview A Flutter sticky headers & index ListView. Based on scrollable_positioned_list. AzListView, SuspensionView, IndexB

Flutter中国开源项目 971 Jan 7, 2023
Build a grouped list, which support expand/collapse section and sticky headers, support use it with sliver widget.

sticky_and_expandable_list Flutter implementation of sticky headers and expandable list.Support use it in a CustomScrollView. README i18n:中文说明 Feature

tp7309 114 Nov 16, 2022
Flutter Community - A central place for community made Flutter content.

Flutter Community A central place for community made Flutter content. The Flutter Community is an organization aimed at providing a central place for

Flutter Community 1.3k Jan 1, 2023
LakhanKumawat ᵖ⁺ 12 Dec 6, 2022
This pub lets you share any kind of files (csv, mp4, png etc), take screenshot of the widgets you want and return as Image and share them directly as well in the form of an image.

share_files_and_screenshot_widgets This pub lets you share any kind of files (csv, mp4, png etc), take screenshot of the widgets you want and return a

Jay Mehta 22 Dec 28, 2022
A Flutter application ehich brings the magic of Neural Style Transfer to your fingertips

Neural Art A Flutter mobile application ehich brings the magic of Neural Style Transfer to your fingertips. Demo Choose a content image that you want

Jaisidh Singh 7 Nov 2, 2022
Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop.

Git+ for GitLab Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop. Git+ lets you see

Marek Gvora 38 Jan 7, 2023
A sophisticated weather app, works with your location or name of any place. Gives detailed summary of weather condition.

clima_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Michael Okhaimoh 2 Sep 7, 2022
Flutter - Special animated flip card

special_card Flutter UI Design | Animated Flip Card. Demo for the app: animated-flip-card.mp4 Getting Started This project is a starting point for a F

Ulfhrafn 2 Dec 4, 2022
A new flutter plugin with native wrappers that attempts to prove data transfer over sound by means of Frequency modulation

A new flutter plugin with native wrappers that attempts to prove data transfer over sound by means of Frequency modulation

Chiziaruhoma Ogbonda 36 Aug 31, 2022
The web_socket_channel package provides StreamChannel wrappers for WebSocket connections.

The web_socket_channel package provides StreamChannel wrappers for WebSocket connections. It provides a cross-platform WebSocketChannel API, a cross-p

Dart 313 Dec 30, 2022