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

Flutter package for pull to refresh list data.

Add Refresh Controller #

final RefreshController _refreshController = RefreshController();

add code #

PullToRefresh(
        onRefresh: _handleRefresh,
        showChildOpacityTransition: false,
        backgroundColor: Colors.transparent,
        tColor: Colors.grey,
        onFail: failedIndicator(),
        onComplete: completeindicator(),
        onLoading: loadingindicator(),
        refreshController: _refreshController,
        child: StreamBuilder<int>(
          stream: counterStream,
          builder: (context, snapshot) {
            return ListView.builder(...);
          },
        ),
      )

  loadingindicator() {
    return const Text('Refreshing..',
        style: TextStyle(
            color: Colors.grey, fontFamily: 'SourceSansPro-SemiBold'));
  }

  completeindicator() {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: const <Widget>[
        Icon(
          Icons.done,
          color: Colors.grey,
        ),
        SizedBox(
          width: 10,
        ),
        Text('Refresh Completed',
            style: TextStyle(
                color: Colors.grey, fontFamily: 'SourceSansPro-SemiBold'))
      ],
    );
  }

  failedIndicator() {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: const <Widget>[
        Icon(
          Icons.close,
          color: Colors.grey,
        ),
        SizedBox(
          width: 10,
        ),
        Text('Failed',
            style: TextStyle(
                color: Colors.grey, fontFamily: 'SourceSansPro-SemiBold'))
      ],
    );
  }

5
likes
120
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter package for pull to refresh list data.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on smartrefresh