For anyone like me who was wondering what is “the correct way” to show an empty widget – official Material codebase uses this:
Widget build(BuildContext context) {
return SizedBox.shrink();
}
SizedBox.shrink()
is a widget that is unlike Container
or Material
has no background or any decorations whatsoever. It sizes itself to the smallest area possible, if not influenced by parent constraints.