apptomate_custom_carousel 0.0.1 copy "apptomate_custom_carousel: ^0.0.1" to clipboard
apptomate_custom_carousel: ^0.0.1 copied to clipboard

A highly customizable carousel widget for Flutter applications with support for images, titles, subtitles, and various interactive features.

example/lib/main.dart

import 'package:apptomate_custom_carousel/apptomate_custom_carousel.dart';
import 'package:flutter/material.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(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home:  CustomCarouselWidget(),
    );
  }
}

class CustomCarouselWidget extends StatelessWidget {
  final List<CarouselItem> items = [
    CarouselItem(
      imageUrl: 'https://source.unsplash.com/random/800x600/?nature',
      title: 'Nature',
      subtitle: 'Beautiful landscapes from around the world',
    ),
    CarouselItem(
      imageUrl: 'https://source.unsplash.com/random/800x600/?city',
      title: 'City Life',
      subtitle: 'Urban landscapes and architecture',
    ),
    CarouselItem(
      imageUrl: 'https://source.unsplash.com/random/800x600/?technology',
      title: 'Technology',
      subtitle: 'Latest tech innovations',
    ),
    CarouselItem(
      imageUrl: 'https://source.unsplash.com/random/800x600/?people',
      title: 'People',
      subtitle: 'Diverse cultures and lifestyles',
    ),
  ];

   CustomCarouselWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Custom Carousel Example'),
        centerTitle: true,
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 16.0),
          child: CustomCarousel(
            items: items,
            height: 250.0,
            aspectRatio: 16 / 9,
            borderRadius: 16.0,
            isAutoScroll: true,
            isNetworkImage: true,
            backgroundColor: Colors.grey.shade200,
            viewportFraction: 0.9,
            enlargeCenterPage: true,
            indicatorColor: Colors.grey.shade400,
            activeIndicatorColor: Colors.blue.shade700,
            autoPlayInterval: 4,
            showNavigationButtons: true,
            showIndicator: true,
            titleTextStyle: const TextStyle(
              fontSize: 20,
              fontWeight: FontWeight.bold,
              color: Colors.white,
            ),
            subtitleTextStyle: const TextStyle(
              fontSize: 14,
              color: Colors.white70,
            ),
            onItemTap: (index) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text('Tapped on ${items[index].title}'),
                  duration: const Duration(seconds: 1),
                ),
              );
            },
          ),
        ),
      ),
    );
  }
}
1
likes
140
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

A highly customizable carousel widget for Flutter applications with support for images, titles, subtitles, and various interactive features.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

carousel_slider, flutter, smooth_page_indicator

More

Packages that depend on apptomate_custom_carousel