flutter_slidercarousel 0.0.2 copy "flutter_slidercarousel: ^0.0.2" to clipboard
flutter_slidercarousel: ^0.0.2 copied to clipboard

discontinued

A new slider carousel widget with custom scaling and item spacing.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_slidercarousel/flutter_slidercarousel.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo SliderCarousel',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Flutter SliderCarousel'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

List<Color> colors = [
  Colors.blue,
  Colors.red,
  Colors.yellow,
  Colors.green,
  Colors.pink
];

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: SliderCarousel(
          itemCount: 5,
          onIndexChanged: (index)=>print("onIndexChanged: "+index.toString()),
          onTap: (index)=>print("onTap: "+index.toString()),
          itemBuilder: (context, idx) {
            return Container(
              decoration: BoxDecoration(
                shape: BoxShape.circle,
                color: colors[idx],
              ),
            );
          },
          offsetCenter: 0.75,
          scaleCenter: 1.25,
          itemWidth: 150,
          itemHeight: 150,
        ),
      ),
    );
  }
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A new slider carousel widget with custom scaling and item spacing.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, transformer_page_view

More

Packages that depend on flutter_slidercarousel