Giter Site home page Giter Site logo

pip_view's Introduction

pip_view

Widget to allow the presentation of a widget below a floating one. It supports moving the floating widget around which sticks to the corners.

Example GIF

If the GIF does not work, you can check the example here: https://youtu.be/jOvRqJRq8O0

Usage

Create a PIPView widget, the prop builder will be the view rendered floating when requested. To present a view below the floating view use PIPView.of(context).presentBelow(MyWidget()).

Props:

  • avoidKeyboard: whether the floating view should avoid the keyboard;
  • builder: a builder for the widget to float, the second parameter indicates if the view is floating;
  • initialCorner: the corner in which the floating view will be sticked initially
    • Possible values are: PIPViewCorner.topLeft, PIPViewCorner.topRight, PIPViewCorner.bottomLeft, PIPViewCorner.bottomRight;
  • floatingHeight: the height of the foreground view when floating. If not set is calculated from the floatingWidth to keep aspect ratio of the screen;
  • floatingWidth: the width of the foreground view when floating. If not set and floatingHeight is set, it is calculated from the floatingHeight value to keep aspect ratio of the screen. If not set and floatingHeight is not set, defaults to 100.0;

Example:

class MyScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return PIPView(
      builder: (context, isFloating) {
        return Scaffold(
          body: Column(
            children: [
              Text('This is the screen that will float!');
              MaterialButton(
                child: Text('Start floating');
                onPressed: () {
                  PIPView.of(context).presentBelow(MyBackgroundScreen());
                },
              ),
            ],
          );
        );
      },
    );
  }
}

class MyBackgroundScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Text('This is my background screen!');
    );
  }
}

pip_view's People

Contributors

hasanalyazidi avatar leonardosilva-asaas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.