swipe_up 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new61

Swipe Up #

A flutter package that provides swipe up widget similar to Instagram's

Screenshot #

image

Do ⭐ the repo if you like it! #

Usage #

To use this package add the following dependency to your pubspec.yaml file:

  dependencies:
    flutter:
      sdk: flutter
    swipe_up:

Usage Example #

An example file can be found here

1. body (Type Widget) (@required)

Swipe up overlays a gesture detector on its body. The body parameter is the widget you want to implement the swipe up action on.

2. child (Type Widget) (@required)

Takes in a widget that is supposed to appear at the bottom of the swipe up body. For example, a text widget saying 'Swipe Up'.

3. onSwipe (Type VoidCallBack)

Called on swiping up.

4. sensitivity (Type double)

Adjusts the sensitivity of swipe detection.

5. showArrow (Type bool)

Toggles the upward pointing arrow icon.

6. color (Type Color)

Color of the upward pointing arrow.

7. animate (Type bool)

Toggles the floating animation of the child.

8. expand (Type bool)

Toggles whether the child expands on swiping up or not.

License #

Copyright 2020 Abhishek Upmanyu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[1.0.0] - 22 March 2020. #

  • First release

example/example.dart

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

class SwipeUpExample extends StatefulWidget {
  @override
  _SwipeUpExampleState createState() => _SwipeUpExampleState();
}

class _SwipeUpExampleState extends State<SwipeUpExample> {
  @override
  Widget build(BuildContext context) {
    return SwipeUp(
        color: Colors.white,
        sensitivity: 0.5,
        onSwipe: () {
          Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => SecondPage()));
        },
        body: Material(
          color: Colors.lightBlueAccent,
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text('COOL',
                    style: TextStyle(color: Colors.white, fontSize: 94.0)),
                Text('NEW',
                    style: TextStyle(color: Colors.white, fontSize: 166.0)),
                Text('STUFF',
                    style: TextStyle(color: Colors.white, fontSize: 94.0))
              ],
            ),
          ),
        ),
        child: Material(
            color: Colors.transparent,
            child: Text('Swipe Up', style: TextStyle(color: Colors.white))));
  }
}

class SecondPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.greenAccent,
      child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text('UP',
                  style: TextStyle(color: Colors.white, fontSize: 94.0)),
              Text('YOU',
                  style: TextStyle(color: Colors.white, fontSize: 166.0)),
              Text('SWIPED!',
                  style: TextStyle(color: Colors.white, fontSize: 94.0))
            ],
          )
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  swipe_up: ^1.0.0

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:swipe_up/swipe_up.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
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

Format lib/swipe_up.dart.

Run flutter format to format lib/swipe_up.dart.

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