Coder Social home page Coder Social logo

schabanbo / overlayment Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 5.0 297 KB

This package will help you to manage the overlays in your projects. Show a dialog, notification, window, or a panel easily. or use one of the helping widgets like AutoComplete, Expander(Dropdown).

License: MIT License

Dart 100.00%
dialog flutter overlay panel

overlayment's People

Contributors

schabanbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

overlayment's Issues

Position of window in OverWindow getting unnecessarily adjusted ?

I can't seem to get my Window overlays to appear where they should. It seems like the code below may be unnecessarily adjusting the position of the overlay from what is passed in the position parameter. Can you verify this and fix if you agree?

@OverRide
Future<T?> show({BuildContext? context}) => Overlayment.show(this, context: context);

Offset _calcPosition(Size screen, Size? size, Offset? moveDelta) {
if (moveDelta != null) return moveDelta;

if (position != null) {
  if (size == null) return position!;

  var xPercent = position!.dx / screen.width;
  var yPercent = position!.dy / screen.height;
  return Offset(
    position!.dx - size.width * xPercent,
    position!.dy - size.height * yPercent,
  );
}

size = size ?? const Size(0, 0);
final x = (screen.width / 2 + screen.width / 2 * alignment!.x) - (size.width * 0.5 + size.width * 0.5 * alignment!.x);
final y = (screen.height / 2 + screen.height / 2 * alignment!.y) - (size.height * 0.5 + size.height * 0.5 * alignment!.y);
return Offset(x, y);

}

[Feature Request] Instead of overlapping the notifications, show the notifications like a list

Hi @SchabanBo, can you tell me whether the package supports the feature where if we trigger two notifications at one single time can the notifications will appear in the list view fashion instead of overlapping the notifications on top of each other. Because with this what is happening 1st notification is not being visible as 2nd notifications is showing on top of the first one in a stack manner, so it would be great if the notifications shows in a listview manner like the below package. I was trying the Simple notification that is present in your online demo

https://www.npmjs.com/package/react-toastify

How to handle OverlayActions?

Hi~ @SchabanBo

I tried to set onClose's callback but got type trouble.

actions: OverlayActions( onClose: () { // do some thing }, ),

show below error:
The argument type 'Future Function()' can't be assigned to the parameter type 'Future Function(dynamic)?'

May you provide overlayActions use case sample ?

Sometime error and can't do anything to close

hi, thanks for your work, this flexible and awesome package..

i have problem, so currently i play in desktop app.
so i use this package to open some OverPanel using shortcut, when i spam the shortcut key, i got some error like this

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field 'overlayAnimation' has not been initialized.

sample code:

class SomeView extends StatelessWidget {
  const SomeView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CallbackShortcuts(
        bindings: {
          const SingleActivator(LogicalKeyboardKey.keyI): () async => await openPanelInfo(),
        },
        child: Focus(
          autofocus: true,
          focusNode: FocusNode(canRequestFocus: true),
          child: VStack([
            ///...
          ]),
        ),
      ),
    );
  }
}

Future<void> openPanelInfo() async {
    //....
    await Overlayment.show(
      context: context,
      OverPanel(
        actions: OverlayActions(
          onOpen: () async {
            try {
              if (Overlayment.count > 1) await Overlayment.dismissAll();
            } catch (_) {
              await Overlayment.dismissAll();
            }
          },
        ),
        alignment: Alignment.centerRight,
        child: 
            ///...
      ),
    );
  }

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.