shadowed_carded_list 0.2.0 copy "shadowed_carded_list: ^0.2.0" to clipboard
shadowed_carded_list: ^0.2.0 copied to clipboard

A Flutter widget package providing a carded list with shadowed, scrollable content and small UI helpers.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'CardedList Example',
      theme: ThemeData.light(),
      home: const ExampleHomePage(),
    );
  }
}

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

  @override
  State<ExampleHomePage> createState() => _ExampleHomePageState();
}

class _ExampleHomePageState extends State<ExampleHomePage> {
  final List<String> _items = [];
  int _counter = 0;
  double _shadowSize = 16.0;

  void _addItem() {
    setState(() {
      _items.insert(0, 'Item ${++_counter}');
    });
  }

  void _clearItems() {
    setState(() {
      _items.clear();
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('CardedList Example')),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            Expanded(
              child: CardedList<String>(
                header: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    const Text(
                      'My Items',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    Row(
                      children: [
                        IconButton(
                          onPressed: _addItem,
                          icon: const Icon(Icons.add),
                          tooltip: 'Add item',
                        ),
                        IconButton(
                          onPressed: _clearItems,
                          icon: const Icon(Icons.clear_all),
                          tooltip: 'Clear items',
                        ),
                      ],
                    ),
                  ],
                ),
                footer: Text('${_items.length} item(s)'),
                items: _items,
                emptyListMessage: 'No items yet. Tap + to add one.',
                shadowSize: _shadowSize,
                itemBuilder: (context, index) {
                  final text = _items[index];
                  return ListTile(
                    key: ValueKey(text),
                    title: Text(text),
                    leading: const CircleAvatar(child: Icon(Icons.list)),
                  );
                },
              ),
            ),
            const SizedBox(height: 12),
            Column(
              children: [
                Text('Shadow Size: ${_shadowSize.round()}px'),
                Slider(
                  value: _shadowSize,
                  min: 0,
                  max: 40,
                  divisions: 40,
                  onChanged: (value) {
                    setState(() {
                      _shadowSize = value;
                    });
                  },
                ),
                const Text('Demo controls: add / clear inside the header buttons'),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
138
downloads

Publisher

verified publisherrediflowai.com

Weekly Downloads

A Flutter widget package providing a carded list with shadowed, scrollable content and small UI helpers.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on shadowed_carded_list