14 Commits

Author SHA1 Message Date
Ian Hickson
c319b890b3
Allow ChangeNotifier to be mixed in again (#23631)
Luckily this class didn't actually need to extend its superclass, it
only implements the interface. So we can change `extends` to
`implements` and that's close enough, while allowing the class to be
mixed in again.
2018-10-29 19:44:36 -07:00
Alexandre Ardhuin
d927c93310
Unnecessary new (#20138)
* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
2018-09-12 08:29:29 +02:00
Ian Hickson
b9a7f1b915
Add a hasListeners to ChangeNotifier (#14946)
I found that some ValueListeners want to know when they should start
doing work (e.g. if the value comes from polling a network resource).
2018-02-28 16:37:36 -08:00
Alexandre Ardhuin
c02b6a8bcf
some whitespace cleanup (#14443) 2018-02-02 23:27:29 +01:00
xster
8aacc288ce Simplify change notifier toString and handle nulls (#9368) 2017-04-12 23:09:40 -07:00
Adam Barth
9a83659d78 Add ValueNotifier (#8463)
It's common to have a ChangeNotifier that wraps a single value. This class
makes that easy by providing a generic implementation.
2017-02-28 11:25:23 -08:00
Adam Barth
aa82b741e2 Revert "Strengthen animation listener iteration patterns" (#7552) 2017-01-19 14:36:25 -08:00
Adam Barth
3312af7da5 Strengthen animation listener iteration patterns (#7537)
This patch aligns the iteration patterns used by animations and
ChangeNotifier. They now both respect re-entrant removal of listeners
and coalesce duplication registrations. (Also, ChangeNotifier
notification is no longer N^2).

Fixes #7533
2017-01-18 22:17:13 -08:00
Ian Hickson
9ece6daff6 Add more asserts and docs to ChangeNotifier. (#7513)
It took me a while to figure out what was going on (I was removing a
listener after disposal). These asserts helped.
2017-01-17 14:17:00 -08:00
Adam Barth
2b742289d4 Fix several minor bugs and add many tests (#7506)
* MultiTapGestureRecognizer previously would assert if there was no
   competition.
 * GestureArenaTeam would always select the first recongizer as the
   winner even if a later recognizer actually accepted the pointer
   sequence.
 * debugPrintStack would fail a type check if maxFrames was non-null.
 * FractionalOffset.lerp would throw a null-pointer exception if its
   second argument was null.

Also, add a number of tests for previously untested lines of code.
2017-01-17 11:00:10 -08:00
Ian Hickson
b2c244efe8 Allow nulls in Listenable.merge (#7355)
This lets you use `Listenable.merge` without having to sanitize your
incoming list of change notifiers, in case your semantics are that
they are optional.
2017-01-05 13:10:30 -08:00
Ian Hickson
977a25f29c Listenable.merge (#7256)
Sometimes you have several listenables, but you want to hand them to an
API (e.g. CustomPainter) that only expects one.
2016-12-15 13:54:53 -08:00
Adam Barth
b00efda7fc Improve change notifier (#4747)
This patch improves some subtle behaviors about the change notifier.
2016-06-24 15:53:48 -07:00
Ian Hickson
0618da7ca2 PaginatedDataTable (part 1) (#4306)
This introduces the key parts of a paginated data table, not including
the built-in pagination features.

* Provide more data for the data table demo, so there's data to page.

* Introduce a ChangeNotifier class which abstracts out
  addListener/removeListener/notifyListeners. We might be able to use
  this to simplify existing classes as well, though this patch doesn't
  do that.

* Introduce DataTableSource, a delegate for getting data for data
  tables. This will also be used by ScrollingDataTable in due course.

* Introduce PaginatedDataTable, a widget that wraps DataTable and only
  shows N rows at a time, fed by a DataTableSource.
2016-06-01 16:13:40 -07:00