Empty - No Data
Loading preview
Starting the Flutter app
Icon, message, and CTA button empty state variant
import 'package:flutter/material.dart';
class EmptyNoData extends StatelessWidget {
const EmptyNoData({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Empty State')),
body: Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.inbox_outlined,
size: 80,
color: Theme.of(context).colorScheme.outline,
),
const SizedBox(height: 24),
Text(
'No data yet',
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(height: 8),
Text(
'When you add items, they will appear here.',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 24),
FilledButton.icon(
onPressed: () => _showDemo(context, 'Add Item (demo)'),
icon: const Icon(Icons.add),
label: const Text('Add Item'),
),
],
),
),
),
);
}
}
void _showDemo(BuildContext context, String message) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
Add it to your project
Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.
First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.
How it works
The most minimal of the state screens: a centered Column with an outline-colored Icons.inbox_outlined, heading, sentence and button. It’s stateless with no logic, and Add Item shows a demo SnackBar. Having its own Scaffold and AppBar means it’s a full page, not a drop-in list placeholder.
Adapting it
- Drop the
Scaffold, leaving theCenter, so it can render inside an existing page body. - Add constructor parameters for icon, title, message and an
onPressedaction. - Hide the
FilledButton.iconwhen the viewer can’t create items.