Commit 079db95b authored by Adam Barth's avatar Adam Barth Committed by GitHub

Switch DatePicker to SliverGrid (#7890)

After this patch, the old grid code is not used in the framework.
parent 31e2a500
......@@ -79,8 +79,20 @@ class SliverChildBuilderDelegate extends SliverChildDelegate {
// /// demand). For example, the body of a dialog box might fit both of these
// /// conditions.
class SliverChildListDelegate extends SliverChildDelegate {
const SliverChildListDelegate(this.children);
const SliverChildListDelegate(this.children, { this.addRepaintBoundaries: true });
/// Whether to wrap each child in a [RepaintBoundary].
///
/// Typically, children in a scrolling container are wrapped in repaint
/// boundaries so that they do not need to be repainted as the list scrolls.
/// If the children are easy to repaint (e.g., solid color blocks or a short
/// snippet of text), it might be more efficient to not add a repaint boundary
/// and simply repaint the children during scrolling.
///
/// Defaults to true.
final bool addRepaintBoundaries;
/// The widgets to display.
final List<Widget> children;
@override
......@@ -90,7 +102,7 @@ class SliverChildListDelegate extends SliverChildDelegate {
return null;
final Widget child = children[index];
assert(child != null);
return new RepaintBoundary.wrap(child, index);
return addRepaintBoundaries ? new RepaintBoundary.wrap(child, index) : child;
}
@override
......
......@@ -41,16 +41,16 @@ void main() {
setState(() {
_selectedDate = value;
});
}
)
)
)
},
),
),
),
);
}
)
)
]
)
},
),
),
],
),
);
await tester.tapAt(const Point(50.0, 100.0));
......@@ -79,7 +79,7 @@ void main() {
expect(_selectedDate, equals(new DateTime(2016, DateTime.SEPTEMBER, 25)));
await tester.pump(const Duration(seconds: 2));
await tester.scroll(find.byKey(_datePickerKey), const Offset(300.0, 10.0));
await tester.scroll(find.byKey(_datePickerKey), const Offset(300.0, 0.0));
await tester.pump();
await tester.pump(const Duration(seconds: 2));
expect(_selectedDate, equals(new DateTime(2016, DateTime.SEPTEMBER, 25)));
......@@ -105,17 +105,17 @@ void main() {
firstDate: new DateTime(0),
lastDate: new DateTime(9999),
onChanged: (DateTime value) { },
selectedDate: new DateTime(2000, DateTime.JANUARY, 1)
)
)
)
)
selectedDate: new DateTime(2000, DateTime.JANUARY, 1),
),
),
),
),
);
}
)
)
]
)
},
),
),
],
),
);
await tester.pump(const Duration(seconds: 5));
});
......
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