easy_pip 0.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 74

easy_pip

A widget for creating a Picture-In-Picture interface in Flutter. Note that this is not a plugin for enabling the PIP mode in Android. EasyPIP makes it easy to construct a YouTube like interface in Flutter.

Usage

Import the package

To use this package, add easy_pip as a dependency in your pubspec.yaml

Use the package

import 'package:easy_pip/easy_pip.dart';

The main widget to use is PIPStack.

The PIPStack has three elements:

  1. Background Widget (Displays behind the pip widget)
  2. PIP Widget (The widget which shrinks to go into PIP mode)
  3. PIP Expanded Content (The content below the PIP widget when the widget is expanded)

Important: The pipEnabled field needs to be set to 'true' to make the pipWindow visible.

Note: If the pipExpandedContent field is left blank, the pipWidget will fill the entire screen when expanded.

Taking an analogy of the YouTube app:

The backgroundWidget would be the master list of all videos.

The pipWidget would be the video player which would be shrinkable and expandable.

The pipExpandedContent would be the list of recommended videos.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[0.0.2] - 31/07/2018

  • Corrected required params.
  • Fixed annotations.
  • Corrected examples.
  • Better documentation.

example/lib/main.dart

// Copyright 2017 Deven Joshi. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

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

void main() {
  runApp(new MaterialApp(
    home: new MyHomePage(),
  ));
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var isEnabled = true;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(),
      body: PIPStack(
        backgroundWidget: Center(
          child: RaisedButton(
            onPressed: () {
              setState(() {
                isEnabled = !isEnabled;
              });
            },
            child: Text("Click here to enable PIP"),
          ),
        ),
        pipWidget: isEnabled
            ? Container(
          color: Colors.pink,
        )
            : Container(),
        pipEnabled: isEnabled,
        pipExpandedContent: Card(
          color: Colors.white,
          child: Column(
            children: <Widget>[Text("Hello World"), Row()],
          ),
        ),
        onClosed: () {
          setState(() {
            isEnabled = !isEnabled;
          });
        },
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  easy_pip: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:easy_pip/easy_pip.dart';
  
Version Uploaded Documentation Archive
0.0.2 Jul 31, 2018 Go to the documentation of easy_pip 0.0.2 Download easy_pip 0.0.2 archive
0.0.1 Jul 30, 2018 Go to the documentation of easy_pip 0.0.1 Download easy_pip 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
54
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
85
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-5 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

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

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test