scroll_snap_effect 0.1.0 copy "scroll_snap_effect: ^0.1.0" to clipboard
scroll_snap_effect: ^0.1.0 copied to clipboard

A Flutter package to create easy scroll snap effect

example/example.dart

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

void main() {
  runApp(
    const MaterialApp(
      home: ExamplePage(),
    ),
  );
}

class ExamplePage extends StatelessWidget {
  const ExamplePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Example"),
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const Padding(
            padding: EdgeInsets.symmetric(horizontal: 20),
            child: Text("scrollDirection: Axis.horizontal"),
          ),
          const SizedBox(height: 10),
          SizedBox(
            height: 100,
            width: double.infinity,
            child: ScrollSnapEffect(
              itemSize: 110,
              itemCount: 10,
              padding: const EdgeInsets.symmetric(horizontal: 20),
              scrollDirection: Axis.horizontal,
              itemBuilder: (context, index) {
                return const Padding(
                  padding: EdgeInsets.only(right: 10),
                  child: SizedBox.square(
                    dimension: 100,
                    child: ColoredBox(
                      color: Colors.lightBlue,
                    ),
                  ),
                );
              },
            ),
          ),
          const Padding(
            padding: EdgeInsets.fromLTRB(20, 30, 20, 10),
            child: Text("scrollDirection: Axis.vertical"),
          ),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 20),
            child: SizedBox(
              height: 100,
              width: 100,
              child: ScrollSnapEffect(
                itemSize: 110,
                itemCount: 10,
                scrollDirection: Axis.vertical,
                itemBuilder: (context, index) {
                  return const Padding(
                    padding: EdgeInsets.only(bottom: 10),
                    child: SizedBox.square(
                      dimension: 100,
                      child: ColoredBox(
                        color: Colors.amber,
                      ),
                    ),
                  );
                },
              ),
            ),
          ),
        ],
      ),
    );
  }
}
26
likes
140
pub points
49%
popularity

Publisher

verified publisherfarhanfadila.site

A Flutter package to create easy scroll snap effect

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on scroll_snap_effect