null_widget

☁️ Lightweight placeholder widget for flutter

MIT License

Stars
8
Committers
1

null_widget

Tiny widget which is good to be used as a placeholder

This article explains the motivation behind this widget

Installation

pubspec.yaml:

dependencies:
  null_widget: ^1.0.0

Example

class MyWidget extends StatelessWidget {
  final String id;
  final String title;
  final String subtitle;

  @override
  Widget build(BuildContext) {
    return Column(
      children: [
        id.isEmpty ? const NullWidget() : Text('id $id'),
        guard(() => Text(title)),
        guard(() => Text(subtitle), Text('No subtitle')),
      ],
    );
  }
}

License

MIT