gradient_list_view 0.1.3 copy "gradient_list_view: ^0.1.3" to clipboard
gradient_list_view: ^0.1.3 copied to clipboard

A Flutter package to easily add gradient fade effects to the top and bottom of any scrollable widget, making content blend seamlessly.

example/lib/main.dart

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,

        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Expanded(
              child: GradientListView(
                gradientColors: [
                  Colors.red,
                  Colors.red.withValues(alpha: .0),
                  Colors.red.withValues(alpha: .0),
                  Colors.red.withValues(alpha: .0),
                  Colors.red,
                ],
                gradientStops: const [0.0, 0.1, 0.5, 0.9, 1.0],
                // gradientHeight: 200,
                child: ListView.builder(
                  itemCount: 100,
                  itemBuilder: (context, index) {
                    return Card(
                      margin: const EdgeInsets.symmetric(vertical: 8.0),
                      elevation: 2,
                      child: ListTile(
                        leading: CircleAvatar(child: Text('${index + 1}')),
                        title: Text('List Item ${index + 1}'),
                        subtitle: const Text(
                          'This is a detailed description for the list item.',
                        ),
                        trailing: const Icon(Icons.arrow_forward_ios),
                        onTap: () {
                          ScaffoldMessenger.of(context).showSnackBar(
                            SnackBar(
                              content: Text('Tapped on Item ${index + 1}'),
                            ),
                          );
                        },
                      ),
                    );
                  },
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
160
points
215
downloads

Publisher

verified publisherdevastral.tr

Weekly Downloads

A Flutter package to easily add gradient fade effects to the top and bottom of any scrollable widget, making content blend seamlessly.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on gradient_list_view