caduandrade / multi_split_view

Provides horizontal or vertical multiple split view for Flutter.
MIT License
152 stars 29 forks source link

can we use fix width? by now only percentage is supported #1

Closed xiaosongmao123 closed 3 years ago

xiaosongmao123 commented 3 years ago

can we use px width? by now only percentage is supported

// setting 10% of weight for the first child
MultiSplitViewController(weights: [0.1]))

// setting 40% of minweight for the first child
MultiSplitView(children: [child1, child2], minimalWeight: .40),

i want this:

// setting 250px of weight for the first child
MultiSplitViewController(width: [250]))

// setting 250px of minweight for the first child
MultiSplitView(children: [child1, child2], minimalWidth: 250),
caduandrade commented 3 years ago

I remember I already thought about that. I may have to make a lot of internal changes, but I agree that it is a good feature. I'll check this out for you at night, okay?

caduandrade commented 3 years ago

Well, I found the first challenge that needs to be considered:

What to do when there are no parent pixels available for the declared values? Ignore pixels above the limit?

How to do it if I declare multiple values like:

MultiSplitViewController (width: [250, 300]))

xiaosongmao123 commented 3 years ago

Thanks alot ,it`s useful to me

xiaosongmao123 commented 3 years ago

Thank for you help by now , i use split_view can set minwidth

@override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SplitView(
            gripSize: 6,
            gripColor: MColors.pageLeftDividerColor,
            minWidthSidebar: 270,
            maxWidthSidebar: 440,
            initialWeight: 0.25,
            viewMode: SplitViewMode.Horizontal,
            view1: PageLeft(),
            view2: PageRight()));
  }

for you ask

MultiSplitViewController (width: [250, 300])) when i use minwidth,

It means that I know exactly the total width of the parent node

And I just need to set the minwidth of some child node,There will be at least one auto sized child node

So I don't care if the parent node can accommodate all the child node widths

无标题2

caduandrade commented 3 years ago

No problem. This solution works for you.

I understood that you don't need fixed widths for each column. You only need to define a minimum width in pixels. Well, I already had minimalWeight. In that case, it will be easy to have a minimalWidth that can be internally converted to minimalWeight. I'm closing the issue ok? Thank you, I will be developing this functionality in the next few days.