Git Product home page Git Product logo

Comments (3)

esDotDev avatar esDotDev commented on June 28, 2024

On this topic, I recently got a pretty solid "universal" drag going, using the window_size plugin (which supports all 3 desktop platforms).

This is some ugly code, and it's not quite perfect (dragging is not 1:1, more like 1:0.99), but it's really close:

onPointerMove: (d) async {
  if (_ignoreNext) {
    // Have to skip each 2nd event, cause flutter generates one when we move
    _ignoreNext = false;
    return;
  }
  _windowPos += d.delta * 2; // Note sure why we need to double this, but it gets us real close
  Window.setWindowFrame(_windowPos & _windowSize);
  _ignoreNext = true;
},

// Also called on each build:
void _updateWindowSize() async => _windowSize = (await Window.getWindowInfo()).frame.size;

Seems like there might be some opportunity to build on the base API's from WindowSize, and just add on what is really unique to this package (prefab'd Windows btns, maximize/minimize methods, and ability to hide native title bar). Though I think max/min probably best belong in the core as well, maybe we can try and land a PR for that.

We had to remove BitDojo for now just cause it prevents us from building on Web, but luckily this works ok across all platforms.

from bitsdojo_window.

cbenhagen avatar cbenhagen commented on June 28, 2024

Haven't had the chance to test this on a non-retina screen but I guess you'd might want to do:

_windowPos += d.delta * MediaQuery.of(context).devicePixelRatio;

Related issue: flutter/flutter#71680

from bitsdojo_window.

geocine avatar geocine commented on June 28, 2024

With regards to dragging, isn't the MoveWindow widget enough for your use case @esDotDev ?

from bitsdojo_window.

Related Issues (20)

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.