smart_empty_state 0.1.1 copy "smart_empty_state: ^0.1.1" to clipboard
smart_empty_state: ^0.1.1 copied to clipboard

A customizable and responsive empty state widget for Flutter apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:smart_empty_state/smart_empty_state.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: true,
      ),
      home: const ExamplePage(),
    );
  }
}

class ExamplePage extends StatefulWidget {
  const ExamplePage({super.key});

  @override
  State<ExamplePage> createState() => _ExamplePageState();
}

class _ExamplePageState extends State<ExamplePage> {
  EmptyStateType selectedType = EmptyStateType.noData;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Smart Empty State')),
      body: Column(
        children: [
          Padding(
            padding: const EdgeInsets.all(16),
            child: DropdownButtonFormField<EmptyStateType>(
              initialValue: selectedType,
              decoration: const InputDecoration(
                labelText: 'Select State',
                border: OutlineInputBorder(),
              ),
              items: EmptyStateType.values.map((type) {
                return DropdownMenuItem(value: type, child: Text(type.name));
              }).toList(),
              onChanged: (value) {
                if (value == null) return;

                setState(() {
                  selectedType = value;
                });
              },
            ),
          ),
          Expanded(
            child: SmartEmptyState(
              type: selectedType,
              onAction: () {
                debugPrint('${selectedType.name} action pressed');
              },
            ),
          ),
        ],
      ),
    );
  }
}
17
likes
160
points
186
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A customizable and responsive empty state widget for Flutter apps.

Repository (GitHub)
View/report issues

Topics

#flutter #empty-state #widget #ui #reusable

License

MIT (license)

Dependencies

flutter

More

Packages that depend on smart_empty_state