Coder Social home page Coder Social logo

aagarwal1012 / liquid-pull-to-refresh Goto Github PK

View Code? Open in Web Editor NEW
1.2K 24.0 93.0 15.8 MB

πŸ” A custom refresh indicator for flutter.

Home Page: https://pub.dev/packages/liquid_pull_to_refresh

License: MIT License

Dart 86.40% Java 0.91% Objective-C 1.97% Kotlin 0.30% Swift 0.97% HTML 9.45%
pull-to-refresh refresh-indicator flutter swiperefreshlayout swipe-refresh swipe-to-refresh android ios hacktoberfest

liquid-pull-to-refresh's Introduction

Liquid Pull To Refresh

A beautiful and custom refresh indicator for flutter highly inspired from Ramotion Pull Down to Refresh. Try out our live example app.



Table of contents

Installing

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  liquid_pull_to_refresh: ^3.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

3. Import it

Now in your Dart code, you can use:

import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart';

Usage

For adding this custom refresh indicator in your flutter app, you have to simply wrap ListView or GridView inside LiquidPullToRefresh. Also you have provide the value of onRefresh parameter which is a refresh callback.

Note - LiquidPullToRefresh can only be used with a vertical scroll view.

For example:

LiquidPullToRefresh(
        key: _refreshIndicatorKey,	// key if you want to add
        onRefresh: _handleRefresh,	// refresh callback
        child: ListView(),		// scroll view
      );

If you do not want the opacity transition of child then set showChildOpacityTransition: false. Preview regarding the both form of this widget is follows :-

showChildOpacityTransition: true showChildOpacityTransition: false

Documentation

LiquidPullToRefresh Class

Dart attribute Datatype Description Default Value
child ScrollView The widget below this widget in the tree. @required
onRefresh RefreshCallback A function that's called when the refreshing of page takes place. @required
height double The distance from the child's top or bottom edge to where the box will settle after the spring effect. 100.0
springAnimationDurationInMilliseconds int Duration in milliseconds of springy effect that occurs when we leave dragging after full drag. 1000
borderWidth double Border width of progressing circle in Progressing Indicator. 2.0
showChildOpacityTransition bool Whether to show child opacity transition or not. true
color Color The progress indicator's foreground color. ColorScheme.secondary
backgroundColor Color The progress indicator's background color. ThemeData.canvasColor
animSpeedFactor double Controls the speed of the animation after refresh. Used to fasten the ending animation. 1.0

For help on editing package code, view the flutter documentation.

Bugs or 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.

See Contributing.md.

Donate

If you found this project helpful or you learned something from the source code and want to thank me, consider buying me a cup of β˜•

Contributors

Thanks goes to these wonderful people (emoji key):


opannapo

πŸ’»

Anthony Taormina

πŸ“–

Erzhan

⚠️

Puttipong Wongrak

πŸ›

Aayush Malhotra

πŸ›

benja8151

πŸ“¦ 🚧

Remco Schrijver

πŸ“¦ 🚧

This project follows the all-contributors specification. Contributions of any kind welcome! See Contributing.md.

License

Liquid-Pull-To-Refresh is licensed under MIT license. View license.

liquid-pull-to-refresh's People

Contributors

aadumkhor avatar aagarwal1012 avatar allcontributors[bot] avatar benja8151 avatar bigdadz avatar imgbot[bot] avatar kekland avatar opannapo avatar remcoschrijver avatar taormina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liquid-pull-to-refresh's Issues

DiagnosticsNode Compiler Error?

Is your feature request related to a problem? Please describe.
I see some compiling error when trying to use the package. It looks like it has broken more than just this pckage.

Describe the solution you'd like
I have no clue. I just use the package not write them

Additional context
This is the compiler error:

file:///Users/brennan/flutter/.pub-cache/hosted/pub.dartlang.org/liquid_pull_to_refresh-1.1.0/lib/liquid_pull_to_refresh.dart:512:24: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.

  • 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///Users/brennan/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
    Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
    context: 'when calling onRefresh',

Refresh Controller?

Is your feature request related to a problem? Please describe.
I'm unable to initiate a refresh externally (like upon navigating into a route, by clicking a button, etc)

Describe the solution you'd like
I would like for an optional "refresh controller" that allows for a refresh to be requested external to the LiquidPullToRefresh.

Describe alternatives you've considered
Currently using SmartRefresher to accomplish this but like the looks of this one better.

Additional context

LPTR depends on deprecated color selectors for coloration.

Describe the bug
Starting from Flutter 2.5.0 the usage of ThemeData.accentColor is deprecated and there is still a dependency on it, creating unexpected color behaviour when tryin to change colors starting from 2.5.0.

To Reproduce

  1. Create a theme with the recommendend method of setting your Theme.colorScheme with ColorScheme.fromSwatch()
  2. LPRT does not follow this coloring.

Expected behavior
LPTR to follow the coloring set int he ColorScheme field of the theme.

Flutter:

  • version 2.8.1
  • channel stable

Additional context
The dependency should be moved to the secondary color of the colorScheme property of Theme, see https://docs.flutter.dev/release/breaking-changes/theme-data-accent-properties

App still uses Android embedding V1.0

Describe the bug
While running flutter pub get we get an warning that application is still using older version of android embedding.

Assign the issue to me for hacktoberfest. I can migrate the project to Android embedding V2.0

Don't support reverse List ?

Need to implement chat like functionality where last list item stays at the bottom of the screen on initial load and newly loaded items are added on top of that.

Maintainer Required

Due to multiple engagements and commitments, I am unable to devote time to solving issues and maintaining the package. Therefore, I strongly require someone who can spend his time to maintaining this repository.
Anyone interested can comment below and please start working on the current issues! In case of any difficultly, I am ready for a quick call to solve ambiguities.

"New Posts" like in facebook app

Is your feature request related to a problem? Please describe.
Pulling every time for updates is tiresome.

Describe the solution you'd like
Instead of pulling the list for updates each time, show a rounded banner on top saying "New posts available" when the user clicks on it, the list refreshes. I think this will be easy to implement into the library. It would be better user experience.

_scrollController.position.pixels doesn't work when ListView in widget LiquidPullToRefresh

Describe the bug
I am trying to let the list load more when the end is reached using

_scrollController.addListener(
  () {
    print(_scrollController.position.pixels);
    if (_scrollController.position.pixels ==
        _scrollController.position.maxScrollExtent) {
      _nextPage();
    }
  },
);

but when the Listview is wrapped inside a LiquidPullToRefresh is doesn't return the value.

To Reproduce
Steps to reproduce the behavior:

  1. Use this code:

ScrollController _scrollController = new ScrollController();

@OverRide
void initState() {
super.initState();
_nextPage();

_scrollController.addListener(
  () {
    print(_scrollController.position.pixels);
    if (_scrollController.position.pixels ==
        _scrollController.position.maxScrollExtent) {
      _nextPage();
    }
  },
);

}

and add the
child: ListView.builder(
controller: _scrollController,

Scroll to the bottom and nothing happens. When you take away the LiquidPullToRefresh it does return the value.

Expected behavior
That the controller of the Listview gives the position.pixels

Cannot trigger refresh programmatically using the global key. The method 'show' was called on null.

Describe the bug
Calling _refreshIndicatorKey.currentState.show(); throws an error "The method 'show' was called on null."

To Reproduce

Just run the example app for the library and button that executes _refreshIndicatorKey.currentState.show();
Steps to reproduce the behavior

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Flutter:
v1.9.1+hotfix.6

I replaced the LiquidPullToRefresh to Flutter's own RefreshIndicator and the show method worked as expected.

Not working with ListView.builder

I am trying to implement LiquidPullToRefresh as follows:

 LiquidPullToRefresh(
        onRefresh: _refresh,	                         // refresh callback
        child: postImagesWidget(),		// scroll view
      )

But I get following error in the console:

'FutureBuilderDocumentSnapshot>>' is not a subtype of type 'ScrollView'

The "normal" RefreshIndicator is working fine with the same code.

Here is my postImagesWidget:

             Widget postImagesWidget() {
             return FutureBuilder(
             future: _future,
             builder: ((context, AsyncSnapshot<List<DocumentSnapshot>> snapshot) {
             if (snapshot.hasData) {
             if (snapshot.connectionState == ConnectionState.done) {

            return ListView.builder(
              //shrinkWrap: true,
                itemCount: snapshot.data.length,
                itemBuilder: ((context, index) =>

                      SinglePost(
                      list: snapshot.data,
                      index: index,
                      followingUser: followingUser,
                        currentUser: currentUser,

                    )));
          } else {
            return Center(
              child: CircularProgressIndicator(),
            );
          }
        } else {
          return Center(
            child: CircularProgressIndicator(),
          );
        }
      }),
    );
    }

Programmatically Trigger Pull-To-Refresh

Is your feature request related to a problem? Please describe.
Currently, the Liquid Pull To Refresh package only supports refresh triggered by user's pull-down gesture. This limitation becomes apparent in scenarios where an app might need to programmatically initiate the refresh process, similar to how one might want to trigger a refresh when a user navigates back to a page using the phone's back button. This limitation can be frustrating in user experiences that benefit from seamless refresh capabilities, such as in social media applications like Facebook, Instagram, and Reddit, where content freshness is crucial.

Describe the solution you'd like
I would like the package to include a feature that allows developers to programmatically trigger the pull-to-refresh action. This could be implemented as a method in the LiquidPullToRefresh widget's controller, which, when called, initiates the pull-to-refresh animation and the attached refresh callback programmatically. This method would enable developers to control the refresh behavior based on application logic, such as pressing the back button or other user actions that do not involve the pull-down gesture.

Describe alternatives you've considered
An alternative solution could be to manually trigger the refresh logic tied to the pull-to-refresh action, but this approach lacks the visual feedback and consistency provided by the pull-to-refresh animation. It also requires additional implementation effort to replicate the animation effects, making the overall solution less seamless and integrated.

Additional context
The ability to programmatically trigger pull-to-refresh actions would significantly enhance the flexibility and usability of the Liquid Pull To Refresh package. It aligns with user expectations set by major social media platforms and improves the user experience by ensuring that content can be refreshed in a way that is both intuitive and consistent with the rest of the application's design. Adding this feature would make the package more versatile and valuable to developers looking to implement sophisticated and user-friendly refresh behaviors in their Flutter applications.

Can't pull to refresh when swipe down on non-scrollable objects

Describe the bug
The swipe refresh only works for a scrollable object like ListView, SingleChildScrollView. And if "swipe down" performed on a non-scrollable object (Container, Text), the LiquidPullToRefresh not worked.

To Reproduce
Steps to reproduce the behavior:

  1. Use this code: https://gist.github.com/IkhwanSI13/c38089a2ef6853b837e10a5988ec6475
  2. Run the code
  3. Swipe down at Container Text

Expected behavior
the onRefresh function of LiquidPullToRefresh runs when swiping down at Container Text.

Flutter:

  • version: 1.22.6
  • channel: stable

Dart:

  • version: 2.10.5

Additional context

  • liquid_pull_to_refresh: ^2.0.0

Can't pull down to refresh when the list of items is short

Describe the bug

Our app is using a grid view with liquid pull to refresh. It works great if you have a lis that is long enough to overflow the view and cause it to scroll. However if you have a short list, the grid view is not scrolling and you cannot pull it to refresh.
IMG_8581

To Reproduce

I attached your sample code edited to use a GridView with only 3 items in it. You can't pull down until you add more items into the list.

Sample Code

import 'dart:async';
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart';

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

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Liquid Pull To Refresh'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@OverRide
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State {
final GlobalKey _scaffoldKey = GlobalKey();
final GlobalKey _refreshIndicatorKey =
GlobalKey();

static int refreshNum = 10; // number that changes when refreshed
Stream counterStream =
Stream.periodic(Duration(seconds: 3), (x) => refreshNum);

ScrollController _scrollController;

@OverRide
void initState() {
super.initState();
_scrollController = new ScrollController();
}

static final List _items = [
'A',
'B',
'C',
];

Future handleRefresh() {
final Completer completer = Completer();
Timer(const Duration(seconds: 3), () {
completer.complete();
});
setState(() {
refreshNum = new Random().nextInt(100);
});
return completer.future.then((
) {
_scaffoldKey.currentState?.showSnackBar(SnackBar(
content: const Text('Refresh complete'),
action: SnackBarAction(
label: 'RETRY',
onPressed: () {
_refreshIndicatorKey.currentState.show();
})));
});
}

@OverRide
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Stack(
children: [
Align(alignment: Alignment(-1.0, 0.0), child: Icon(Icons.reorder)),
Align(alignment: Alignment(-0.3, 0.0), child: Text(widget.title)),
],
),
),
body: LiquidPullToRefresh(
key: _refreshIndicatorKey,
onRefresh: _handleRefresh,
showChildOpacityTransition: false,
child: StreamBuilder(
stream: counterStream,
builder: (context, snapshot) {
return GridView.builder(
itemCount: _items.length,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
final String item = _items[index];
return ListTile(
isThreeLine: true,
leading: CircleAvatar(child: Text(item)),
title: Text('This item represents $item.'),
subtitle: Text(
'Even more additional list item information appears on line three. ${snapshot.data}'),
);
},
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2),
);
}),
),
);
}
}

Animation customization requests

  • Animation duration when closing the refresh widget should be adjustable (and faster by default)
  • Refreshing should be cancelled if you pulled the screen down, then pulled it back up manually (and shouldn't flatten horizontally)
  • Option to replace the spinning widget with CircularProgressIndicator(value: )

Use with SingleChildScrollView

Is your feature request related to a problem? Please describe.
I have multiple ScrollViews nested in a SingleChildScrollView widget and I would like to update a nested list on pull to refresh.

I get this error when try to wrap the liquid pull to refresh around the SingleChildScrollView.

The argument type 'SingleChildScrollView' can't be assigned to the parameter type 'ScrollView'.

Describe the solution you'd like
It'd be great if you allowed a SingleChildScrollView to be a child of this widget because it can scroll. This would mean making the child named parameter be of type Widget instead of ScrollView like the built in RefreshIndicator.

Interact with list item

Is it possible to interact with list items using on pressed?

For example, I would like to navigate to another screen based on which item is pressed.

Thanks!

ListView with ScrollController stopped working

My code

LiquidPullToRefresh(
		key: _refreshIndicatorKey,
		onRefresh: _reload,
		showChildOpacityTransition: false,
		backgroundColor: Theme.of(context).accentColor,
		color: Theme.of(context).primaryColor,
		child: new ListView.builder(
		  padding: EdgeInsets.only(
			  bottom: 5.0, top: 5.0),
		  itemCount: _posts.length + 1,
		  itemBuilder: (context, index) {
			if (this._posts.length == index) {
			  return _buildProgressIndicator();
			} else {
			  return PostWidget(
				  post: _posts[index]);
			}
		  },
		  controller: widget.scrollController,
		),
	)

This listener stopped working

widget.scrollController.addListener(() {
      if (widget.scrollController.position.pixels ==
          widget.scrollController.position.maxScrollExtent) {
        _getMoreData();
      }
    });

Any suggestion?

Liquid pull to refresh for list<object>

Is your feature can use for list? Please describe.
I'm always frustrated when trying to showing my list. it doesnt print any data. just empty on page. the error i was get was:

  • I/flutter ( 4437): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#2182f NEEDS-LAYOUT NEEDS-PAINT
  • I/flutter ( 4437): Another exception was thrown: Incorrect use of ParentDataWidget.
  • I/flutter ( 4437): Another exception was thrown: Every child of a RenderCustomMultiChildLayoutBox must have an ID in its parent data.

please give me an example to showing list using your packages.
thank you :)

Refresh indicator overlays on list view

Describe the bug
Hi, when you pull to refresh and the refresh indicator is overlayed on top of the list rather than pushing the list view down as shown in the screencasts on the readme.

To Reproduce
Steps to reproduce the behavior:

  1. running latest table version of flutter and dart

Expected behavior
The refresh indicator should push the list view down.

Screenshots

Flutter:

    β€’ Flutter version 1.12.13+hotfix.9 at C:\tools\flutter
    β€’ Framework revision f139b11009 (4 weeks ago), 2020-03-30 13:57:30 -0700
    β€’ Engine revision af51afceb8

Dart:
β€’ Dart version 2.7.2

Additional context
sdk: ">=2.7.0 <3.0.0"
liquid_pull_to_refresh: ^1.2.0

@override
  Widget build(BuildContext context) {
    final formatter = LastUpdatedDateFormatter(
        lastUpdated: _endpointsData != null
            ? _endpointsData.values[EndPoint.cases]?.date ?? DateTime.now()
            : null);
    return Scaffold(
      appBar: AppBar(
        title: Text("Covid19 Tracker"),
        actions: [
          IconButton(
            icon: Icon(Icons.settings),
            onPressed: () {
              //Navigate to Settings screen
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => Settings(),
                ),
              );
            },
          )
        ],
      ),
      body: LiquidPullToRefresh(
        onRefresh: _updateData,
        showChildOpacityTransition: false,
        springAnimationDurationInMilliseconds: 600,
        backgroundColor: Theme.of(context).canvasColor,
        child: ListView(
          children: <Widget>[
            LastUpdatedStatus(
              text: formatter.lastUpdatedStatusText(),
            ),
            for (var endpoint in EndPoint.values)
              EndPointCard(
                endpoint: endpoint,
                value: _endpointsData != null
                    ? _endpointsData.values[endpoint]?.value
                    : null,
              ),
          ],
        ),
      ),
    );
  }

Request add multi state features

I think your solution is very good, it's look so pretty on my application.
But I want to make a request for new feature: Multi state view

Describe the solution you'd like
As I understand about your solution, PullToRefresh just work for ListView with data, empty list will not show any information.
I hope you can support to add more state: Error, Empty. And user can still pull to refresh to retry or get new data from server in new state.
At this version, if I use another widget to show another state, user cannot perform another action with your animation.

Thanks and Best regards,
Thanh Huan

How to launch a refresh on resumed state ?

Is your feature request related to a problem? Please describe.
How to launch a refresh on resumed state ?

Describe the solution you'd like
a simple callback in order to launch the animation

Describe alternatives you've considered

Additional context

I do not know if it is a bug, but my key is not working

When I use a global key, the currentState is always null.

Even if it were in class scope or inside the BlocBuilder the return is null, would it be a BlocBuilder problem? Or is it my mistake?

Normal RefreshIndicators also do not work.

Thanks for listening.

My reproduction:

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart';

import 'package:genesis/bloc/models/user.dart';
import 'package:genesis/bloc/controllers/index.dart';

class SelectClient extends StatefulWidget {
  final User defaultUser;

  SelectClient({Key key, this.defaultUser}) : super(key: key);

  _SelectClientState createState() => _SelectClientState();
}

class _SelectClientState extends State<SelectClient> {
  final GlobalKey<AutoCompleteTextFieldState<User>> _autoCompleteKey =
      GlobalKey();

  User selectedUser;
  bool initialized = false;

  void _onWidgetDidBuild(Function callback) {
    WidgetsBinding.instance.addPostFrameCallback((_) {
      callback();
    });
  }

  @override
  void initState() {
    super.initState();

    if (widget.defaultUser != null) {
      setState(() {
        selectedUser = widget.defaultUser;
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    final UserDataBloc _userDataBloc = BlocProvider.of<UserDataBloc>(context);

    return Scaffold(
        body: BlocBuilder(
            bloc: _userDataBloc,
            builder: (BuildContext context, UserDataState state) {
              final GlobalKey<RefreshIndicatorState> _refreshKey =
                  GlobalKey<RefreshIndicatorState>();

              _onWidgetDidBuild(() {
                print("batata");
                print(_refreshKey.currentState); // here
                _refreshKey.currentState?.show();
              });

              return LiquidPullToRefresh(
                key: _refreshKey,
                springAnimationDurationInMilliseconds: 500,
                showChildOpacityTransition: false,
                color: Theme.of(context).scaffoldBackgroundColor,
                backgroundColor: Theme.of(context).primaryColor,
                onRefresh: () {
                  _userDataBloc.dispatch(GetUsers());

                  if (state is UserDataLoading) {
                    return state.future;
                  }

                  return Future.delayed(Duration.zero);
                },
                child: CustomScrollView(
                  slivers: <Widget>[
                    SliverAppBar(
                      floating: false,
                      snap: false,
                      elevation: 0,
                      centerTitle: false,
                      backgroundColor: Colors.transparent,
                      title: Text(
                        'Selecionar cliente',
                        style: Theme.of(context).textTheme.title,
                      ),
                      leading: IconButton(
                        tooltip: "Voltar",
                        icon: Icon(
                          Icons.close,
                          color: Theme.of(context).textTheme.title.color,
                        ),
                        onPressed: () {
                          Navigator.pop(context, null);
                        },
                      ),
                      actions: <Widget>[
                        Container(
                          padding: EdgeInsets.only(right: 5),
                          child: Row(children: <Widget>[
                            FlatButton(
                              textColor: Theme.of(context).primaryColor,
                              shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(4)),
                              child: Text("ConcluΓ­do"),
                              onPressed: () {
                                Navigator.pop(context, selectedUser);
                              },
                            ),
                          ]),
                        )
                      ],
                    ),
                    SliverList(
                      delegate: SliverChildListDelegate(<Widget>[
                        Builder(
                          builder: (BuildContext context) {
                            if (state is UserDataLoaded) {
                              AutoCompleteTextField<User> _autoCompleteField =
                                  AutoCompleteTextField<User>(
                                context: context,
                                itemSubmitted: (v) {},
                                decoration: InputDecoration(
                                    contentPadding: EdgeInsets.all(20),
                                    border: InputBorder.none,
                                    hintText: "Nome do cliente"),
                                key: _autoCompleteKey,
                                suggestions: state.user,
                                clearOnSubmit: false,
                                submitOnSuggestionTap: true,
                                itemFilter: (item, query) {
                                  return item.name
                                          .toLowerCase()
                                          .startsWith(query.toLowerCase()) &&
                                      !item.admin;
                                },
                                itemSorter: (a, b) {
                                  return a.name
                                      .toLowerCase()
                                      .compareTo(b.name.toLowerCase());
                                },
                                itemBuilder: (BuildContext context, User user) {
                                  return ListTile(
                                    selected: user.id == selectedUser?.id,
                                    leading: CircleAvatar(),
                                    title: Text(user.name),
                                    subtitle: Text(user.email),
                                  );
                                },
                              );

                              _autoCompleteField.itemSubmitted = (item) {
                                setState(() {
                                  _autoCompleteField.textField.controller.text =
                                      item.name;
                                  selectedUser = item;
                                });
                              };

                              _onWidgetDidBuild(() {
                                FocusScope.of(context).requestFocus(
                                    _autoCompleteField.textField.focusNode);
                              });

                              if (widget.defaultUser != null && !initialized) {
                                _onWidgetDidBuild(() {
                                  setState(() {
                                    _autoCompleteField.textField.controller
                                        .text = widget.defaultUser.name;
                                    initialized = !initialized;
                                  });
                                });
                              }

                              return _autoCompleteField;
                            }

                            return Container();
                          },
                        )
                      ]),
                    )
                  ],
                ),
              );
            }));
  }
}

Package does not work with AnimatedList

The package works great with lists but it would be nice to see functionality with the AnimatedList Widget

Describe the solution you'd like
Add ability to use Animated List.

Describe alternatives you've considered
I don't think there is an alternative apart from building list animations from scratch.

Pull up to refresh

Is possible to have pull up to refresh? So instead of pulling from top to down, we would pull up from bottom to up.
Please notes this is different from loading more data but to refresh/rebuild the data list.

Thanks in advance.

[Feature Request] Add support for NestedScrollViews

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I'm trying to add a pull to refresh with a NestedScrollView, but this widget doesn't extend ScrollView, so it doesn't work
Describe the solution you'd like
A clear and concise description of what you want to happen.
A widget that works with NestedScrollViews
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

2020-02-03 17 02 35

Cannot refresh if not enough elements in ListView.builder

When there are enough(you can scroll) items in Listview.builder the pull to refresh is working, but if there are lets say 2 elements(not enough items to scroll) in ListView.builder the pull to refresh stops working like it isnt even there...

Flutter:

  • 1.5.4-hotfix2
  • stable
LiquidPullToRefresh(
                  scrollController: _controller,
                  onRefresh: () => store.matchStore.fetchMatches(true),
                  showChildOpacityTransition: true,
                  height: 100,
                  color: Colors.yellow,
                  backgroundColor: Colors.black,
                   child: ListView.builder(
                    itemCount: store.matchStore.listOfMatches.length+1,
                    itemBuilder: (context, index) {
                      if (index == 0) return DropDownWidget();
                      MatchClass match = store.matchStore.listOfMatches[index-1];
                      return MatchCard(
                        match: match,
                        cardKey: new GlobalKey(),
                      );
                    },
                  ), 
                ),

Custom Liquid Effect Color

Hi,
Thank you for this package. I want to use it by changing the background color. But the fluid effect does not work properly. For example, when the ball falls down, the fluidity effect does not appear because background color is red. That effect color needs to be changed to background color. Would you do that, please?

I thing ClipPath must have background color. That same with background color option.

Screenshot_2020-01-14-16-11-35-1

Temporarily disable pull to refresh

I have a situation where I need to temporarily disable the pull to refresh feature. Is there any way to do this programmatically with state (using GetX for my project so it is stateless and I would use obx observable for this). How would you suggest I do this without forking your project? Thanks

Error in installing the dependency.

Describe the bug
I'm trying to install liquid_pull_to_refresh dependency in my Flutter project. It is giving me error as
"Because liquid_pull_to_refresh depends on liquid_pull_to_refresh, version solving failed."

To Reproduce
Steps to reproduce the behavior:

  1. Go to your project
  2. Open terminal in the project directory
  3. run flutter pub add liquid_pull_to_refresh
  4. See error

Expected behavior
I want the package to be installed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.