Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When setting minimal size and weight, it appears to not function properly。 #46

Closed
leavky opened this issue May 11, 2023 · 5 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@leavky
Copy link

leavky commented May 11, 2023

First of all, thank you very much for creating this package. I want to create three windows, all of which require a minimum width to be set, and I would like the first and third ones to have an initial size set as well.When I set it up, I found that the third window is not displaying properly.

  1. set controller
  final MultiSplitViewController _controller = MultiSplitViewController(areas: [
    Area(weight: 0.1, minimalSize: 150),
    Area(minimalSize: 150),
    Area(weight: 0.1, minimalSize: 150),
  ]);
  1. set children
    final List<Widget> children = [
      Container(
        color: Colors.blue,
        child: const Center(
          child: Text("1"),
        ),
      ),
      Container(
        color: Colors.purple,
        child: const Center(
          child: Text("2"),
        ),
      ),
      Container(
        color: Colors.green,
        child: const Center(
          child: Text("3"),
        ),
      ),
    ];

    MultiSplitView multiSplitView = MultiSplitView(
        controller: _controller,
        children: children);
  1. result
    image
@caduandrade caduandrade self-assigned this May 12, 2023
@caduandrade caduandrade added the bug Something isn't working label May 12, 2023
@caduandrade
Copy link
Owner

Thanks @leavky !

I'll have to review the algorithm. I think maybe it needs to be a little more complex.

Simplifying the current algorithm:

  1. Every area will always have a weight even if you don't define it. The component is based on weights.
    1.1) In your example the second area was .8.
  2. Minimum size is applied area by area after weights are applied given the screen size.
  3. When increasing an area because of the minimalSize, this extra weight needs to be removed from the other areas. In this case, it is also removed using the weight (weight of the weight) to maintain proportionality.
  4. When removing from other areas, you also need to respect their minimum size! 😵‍💫

I think the problem is occurring at point 4.

@leavky
Copy link
Author

leavky commented May 13, 2023

I think it would be better to do it this way: 1. Each area can set an initial ratio, but when a minimalSize is set, the ratio can be changed appropriately.

@caduandrade
Copy link
Owner

Will be resolved by #54

@leavky
Copy link
Author

leavky commented Mar 13, 2024

thanks.

@caduandrade
Copy link
Owner

Better late than never (version 3.0.0) 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants