build method
Builds the widget subtree for this state.
Implementation
@override
Widget build(BuildContext context) {
if (_entries.isEmpty) return SizedBox.shrink();
// Find the lowest entry we need to render: start from the last opaque
// entry and include everything from there upward.
var startIndex = 0;
for (var i = _entries.length - 1; i >= 0; i--) {
if (_entries[i].opaque) {
startIndex = i;
break;
}
}
final children = <Widget>[];
for (var i = startIndex; i < _entries.length; i++) {
final entry = _entries[i];
// Skip entries below an opaque entry that don't maintain state.
if (i < startIndex && !entry.maintainState) continue;
children.add(entry.builder(context));
}
if (children.isEmpty) return SizedBox.shrink();
// Keep the render shape stable as entries are inserted/removed so
// descendants (for example PopupMenuButton triggers) are not remounted
// when overlay entry count changes.
return Stack(fit: StackFit.expand, children: children);
}