card_slider 1.0.5 copy "card_slider: ^1.0.5" to clipboard
card_slider: ^1.0.5 copied to clipboard

A draggable Flutter image carousel slider, swipe or drag to change the slide!

example/lib/main.dart

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

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

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

  @override
  State<MainPage> createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  @override
  Widget build(BuildContext context) {
    List<Color> valuesDataColors = [
      Colors.purple,
      Colors.yellow,
      Colors.green,
      Colors.red,
      Colors.grey,
      Colors.blue,
    ];

    List<Widget> valuesWidget = [];
    for (int i = 0; i < valuesDataColors.length; i++) {
      valuesWidget.add(Container(
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(12.0),
            color: valuesDataColors[i],
          ),
          child: Align(
            alignment: Alignment.center,
            child: Text(
              i.toString(),
              style: const TextStyle(
                fontSize: 28,
              ),
            ),
          )));
    }

    return Scaffold(
      backgroundColor: const Color(0xFF1560BD),
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        elevation: 0,
        title: const Text(
          "Cards",
          style: TextStyle(
              fontSize: 14, fontWeight: FontWeight.w600, color: Colors.white),
        ),
        centerTitle: true,
      ),
      body: CardSlider(
        cards: valuesWidget,
        bottomOffset: .0003,
        cardHeight: 0.75,
        containerHeight: MediaQuery.of(context).size.height - 100,
        itemDotOffset: -0.05,
      ),
    );
  }
}
27
likes
110
pub points
86%
popularity

Publisher

unverified uploader

A draggable Flutter image carousel slider, swipe or drag to change the slide!

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on card_slider