clean_swiper 0.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 74

clean_swiper #

Clean Swiper is a starting point for clean and simple swiper. Whenever you just need to swipe multiply elements and you don't need any fancy features clean_swiper is here for you.

Clean Swiper Exmaple

Installing #

Include clean_swiper in your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  clean_swiper: <latest_version>

If your IDE doesn't do it automatically, type:

flutter packages get

Using #

import 'package:clean_swiper/clean_swiper.dart';

Container(
  height: 250,
  child: CleanSwiper(
    viewportFraction: 0.9,
    initialPage: 0,
    children: <Widget>[
      Card(
        color: Colors.yellow,
        child: Center(child: Text('Card 1'))
      ),
      Card(
        color: Colors.pink,
        child: Center(child: Text('Card 2'))
      ),
      Card(
        color: Colors.teal,
        child: Center(child: Text('Card 3'))
      ),
    ]
  ),
)
...

[0.0.5] - 19 Nov 2019 #

  • Allow to pass own controller to CleanSwiper

[0.0.4] - 19 Nov 2019 #

  • Code formatting based on pub.dev qa checks

[0.0.3] - 19 Nov 2019 #

  • Added example usage
  • Added readme

[0.0.2] - 17 Nov 2019 #

  • initalPage param added

[0.0.1] - 17 Nov 2019 #

  • Created clean_swiper which provides basic swipe widget feature

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Clean Swiper Demo',
      home: ExamplePage()
    );
  }
}

class ExamplePage extends StatelessWidget {
  final _pageController = PageController(
    initialPage: 1
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Clean Swiper Example')
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Container(
              height: 200,
              child: CleanSwiper(
                viewportFraction: 0.9,
                children: <Widget>[
                  Container(
                    margin: EdgeInsets.symmetric(horizontal: 5),
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        image: NetworkImage("https://images.pexels.com/photos/257840/pexels-photo-257840.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500"),
                        fit: BoxFit.cover,
                      )
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.symmetric(horizontal: 5),
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        image: NetworkImage("https://images.pexels.com/photos/33109/fall-autumn-red-season.jpg?auto=compress&cs=tinysrgb&dpr=2&w=500"),
                        fit: BoxFit.cover,
                      )
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.symmetric(horizontal: 5),
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        image: NetworkImage("https://images.pexels.com/photos/814499/pexels-photo-814499.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500"),
                        fit: BoxFit.cover,
                      )
                    ),
                  ),
                ],
              ),
          ),
          Container(
              height: 250,
              child: CleanSwiper(
                viewportFraction: 0.9,
                children: <Widget>[
                  Card(
                    color: Colors.yellow,
                    child: Center(child: Text('Card 1'))
                  ),
                  Card(
                    color: Colors.pink,
                    child: Center(child: Text('Card 2'))
                  ),
                  Card(
                    color: Colors.teal,
                    child: Center(child: Text('Card 3'))
                  ),
                ],
              ),
          ),
          Container(
            margin: EdgeInsets.symmetric(vertical: 50),
            height: 30,
            color: Colors.white38,
            child: CleanSwiper(
              controller: _pageController,
              viewportFraction: 1,
              children: <Widget>[
                Text('Text 1', textAlign: TextAlign.center,),
                Text('Text 2', textAlign: TextAlign.center,),
                Text('Text 3', textAlign: TextAlign.center,),
              ],
            )
          )
        ],
      )
      
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  clean_swiper: ^0.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:clean_swiper/clean_swiper.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/clean_swiper.dart. (-1 points)

Analysis of lib/clean_swiper.dart reported 2 hints:

line 3 col 8: Unused import: 'dart:ui'.

line 7 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: CleanSwiper.controller

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test