easy_pip 0.1.0 copy "easy_pip: ^0.1.0" to clipboard
easy_pip: ^0.1.0 copied to clipboard

A widget for creating a YouTube like Picture-In-Picture interface in Flutter.

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;
          });
        },
      ),
    );
  }
}
39
likes
40
pub points
11%
popularity

Publisher

verified publisherjoshi.dev

A widget for creating a YouTube like Picture-In-Picture interface in Flutter.

Repository

License

BSD-2-Clause (license)

Dependencies

flutter

More

Packages that depend on easy_pip