retro_infinity_scroll 0.0.2 copy "retro_infinity_scroll: ^0.0.2" to clipboard
retro_infinity_scroll: ^0.0.2 copied to clipboard

outdated

A Flutter plugin to implement infinity scroll and inflact paginated data into a ListView.

retro_infinity_scroll #

A Flutter plugin to implement infinity scroll and inflact paginated data into a ListView

Features #

  • Load more items when user reached the last
  • Swipe to refresh (default and customization available)
  • Custom Widget if list is empty or having errors
  • Custom Widget while loading the data

Getting Started #

  • Add retro_infinity_scroll as dependancy in pubspec.yaml
dependencies:
  retro_infinity_scroll: <latest version>
  • Import plugin class to your file
import 'package:retro_infinity_scroll/retro_infinity_scroll.dart';
Simple use

RetroListView(
  hasMore: false,
  itemCount: _photos.length,
  stateType: _loading
      ? InfiniteScrollStateType.loading
      : _error
        ? InfiniteScrollStateType.error
        : InfiniteScrollStateType.loaded,
  itemBuilder: (context, index)=>//Your item
)
Using loadmore

RetroListView(
  hasMore: _hasMore,
  itemCount: _photos.length,
  stateType: _isLoading
      ? InfiniteScrollStateType.loading
      : _error
          ? InfiniteScrollStateType.error
          : InfiniteScrollStateType.loaded,
  onLoadMore: () => fetchPhotos(), // Implements loadmore
  itemBuilder: (context, index)=>//Your item
),
      
Android style refresh

RetroListView(
  hasMore: _hasMore,
  itemCount: _photos.length,
  stateType: _loading
      ? InfiniteScrollStateType.loading
      : _error
          ? InfiniteScrollStateType.error
          : InfiniteScrollStateType.loaded,
  onLoadMore: () => fetchPhotos(), // Implements loadmore
  // To Implement Android Refresh Indicator
  refreshIndicatorType: RefreshIndicatorType.android,
      onRefresh: (){
        return Future.delayed(Duration(seconds: 2));
      },
  itemBuilder: (context, index)=>//Your item
)
      
IOS style refresh

RetroListView(
  hasMore: _hasMore,
  itemCount: _photos.length,
  physics: BouncingScrollPhysics(),
  // To be used in if running on Android Devices
  // and [refreshIndicatorType]
  // is [RefreshIndicatorType.ios] or [RefreshIndicatorType.custom]
  stateType: _loading
      ? InfiniteScrollStateType.loading
      : _error
          ? InfiniteScrollStateType.error
          : InfiniteScrollStateType.loaded,
  onLoadMore: () => fetchPhotos(), // Implements loadmore
  // To Implement IOS Sliver refresh indicator
  refreshIndicatorType: RefreshIndicatorType.ios,
  onRefresh: (){
    return Future.delayed(Duration(seconds: 2));
  },
  itemBuilder: (context, index)=>//Your item
)
      
Custom error idget

RetroListView(
  hasMore: false,
  itemCount: _photos.length,
  stateType: InfiniteScrollStateType.error,
  errorWidget: Center(child: Text('Some error occurred')),
  itemBuilder: (ctx, index)=>//Your item
  },
)      
Custom empty widget

RetroListView(
  hasMore: false,
  itemCount: 0,
  stateType: InfiniteScrollStateType.loaded,
  emptyWidget: Center(child: Text('No data found')),
  itemBuilder: (ctx, index)=>//Your item
  },
)
      
13
likes
0
pub points
0%
popularity

Publisher

verified publishersmarttersstudio.com

A Flutter plugin to implement infinity scroll and inflact paginated data into a ListView.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on retro_infinity_scroll