Commit a4048970 authored by Adam Barth's avatar Adam Barth

Merge pull request #1648 from abarth/polish_overlay

Overlay polish
parents f3b1748c 26d23904
...@@ -62,8 +62,10 @@ class _OverlayEntryState extends State<_OverlayEntry> { ...@@ -62,8 +62,10 @@ class _OverlayEntryState extends State<_OverlayEntry> {
class Overlay extends StatefulComponent { class Overlay extends StatefulComponent {
Overlay({ Overlay({
Key key, Key key,
this.initialEntries this.initialEntries: const <OverlayEntry>[]
}) : super(key: key); }) : super(key: key) {
assert(initialEntries != null);
}
/// The entries to include in the overlay initially. /// The entries to include in the overlay initially.
final List<OverlayEntry> initialEntries; final List<OverlayEntry> initialEntries;
...@@ -103,6 +105,8 @@ class OverlayState extends State<Overlay> { ...@@ -103,6 +105,8 @@ class OverlayState extends State<Overlay> {
/// Otherwise, the entries are inserted on top. /// Otherwise, the entries are inserted on top.
void insertAll(Iterable<OverlayEntry> entries, { OverlayEntry above }) { void insertAll(Iterable<OverlayEntry> entries, { OverlayEntry above }) {
assert(above == null || (above._overlay == this && _entries.contains(above))); assert(above == null || (above._overlay == this && _entries.contains(above)));
if (entries.isEmpty)
return;
for (OverlayEntry entry in entries) { for (OverlayEntry entry in entries) {
assert(entry._overlay == null); assert(entry._overlay == null);
entry._overlay = this; entry._overlay = this;
......
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