The FloatingView package enables you to create a floating window similar to YouTube's floating video feature. This allows the window to float on the screen and be draggable while scrolling.
Note:FloatingView will disappear when changing routes. To display it across routes, wrap your desired route screen with the FloatingView and use the same controller. The controller can be passed down in the widget tree or stored in state management solutions such as BLoC, Provider, etc. The FloatingView will be passed down across the screen using the Hero widget, which is currently the only option available.
Initialize the controller and store the widget you want to display, such as a video, screen, or text. Here is an example of using FloatingView with a Video Player or a simple screen:
Note:controller.initialize() will run the previous onDispose() method to clear the previous controller data if you initialize another FloatingView while having an active one.
Using the APIs:
You can use the passed-down controller to control the FloatingView state like this: