Commit 46aabc26 authored by Adam Barth's avatar Adam Barth

Merge pull request #2929 from abarth/fix_travis

Fix Travis
parents 8cbeb2e9 79880991
...@@ -13,7 +13,7 @@ enum LeaveBehindDemoAction { ...@@ -13,7 +13,7 @@ enum LeaveBehindDemoAction {
rightSwipe rightSwipe
} }
class LeaveBehindItem { class LeaveBehindItem implements Comparable<LeaveBehindItem> {
LeaveBehindItem({ this.index, this.name, this.subject, this.body }); LeaveBehindItem({ this.index, this.name, this.subject, this.body });
LeaveBehindItem.from(LeaveBehindItem item) LeaveBehindItem.from(LeaveBehindItem item)
...@@ -23,6 +23,9 @@ class LeaveBehindItem { ...@@ -23,6 +23,9 @@ class LeaveBehindItem {
final String name; final String name;
final String subject; final String subject;
final String body; final String body;
@override
int compareTo(LeaveBehindItem other) => index.compareTo(other.index);
} }
class LeaveBehindDemo extends StatefulWidget { class LeaveBehindDemo extends StatefulWidget {
...@@ -72,9 +75,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -72,9 +75,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
} }
void handleUndo(LeaveBehindItem item) { void handleUndo(LeaveBehindItem item) {
int insertionIndex = lowerBound(leaveBehindItems, item, int insertionIndex = lowerBound(leaveBehindItems, item);
compare: (LeaveBehindItem a, LeaveBehindItem b) => a.index.compareTo(b.index)
);
setState(() { setState(() {
leaveBehindItems.insert(insertionIndex, item); leaveBehindItems.insert(insertionIndex, item);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment