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

A widget for creating fully custom, animated scrollable lists. It manages all of the tricky logic surrounding scroll interactions and physics, and leaves the visual presentation of items up to you.

example/lib/main.dart

import 'dart:ui';

import 'package:example/views/views.dart';
import 'package:flutter/material.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Enable scrolling on desktop via mouse drag for the whole app.
      // This can be applied to specific carousels via `CustomCarousel.scrollBehavior`.
      scrollBehavior: AppScrollBehavior(),
      theme: ThemeData.dark()
          .copyWith(scaffoldBackgroundColor: const Color(0xFF151530)),
      home: const HomeView(),
    );
  }
}

// Create a subclass of ScrollBehavior that enables scrolling via mouse drag.
class AppScrollBehavior extends ScrollBehavior {
  @override
  Set<PointerDeviceKind> get dragDevices {
    final devices = Set<PointerDeviceKind>.from(super.dragDevices);
    devices.add(PointerDeviceKind.mouse);
    return devices;
  }
}
242
likes
150
pub points
87%
popularity

Publisher

verified publishergskinner.com

A widget for creating fully custom, animated scrollable lists. It manages all of the tricky logic surrounding scroll interactions and physics, and leaves the visual presentation of items up to you.

Repository (GitHub)
View/report issues

Topics

#ui #list #widget #carousel #animation

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, flutter_animate

More

Packages that depend on flutter_custom_carousel