macosui / macos_ui

Flutter widgets and themes implementing the current macOS design language.
https://macosui.github.io/macos_ui/#/
MIT License
1.81k stars 178 forks source link

Fix: use the `sidebar` and `endSidebar` key parameter #400

Closed Maksimka101 closed 1 year ago

Maksimka101 commented 1 year ago

Why?

It wasn't possible to properly implement a tab bar in sidebar. Because when I have a few tabs and on each tab I have a scroll view two scrolls are connected to one controller when I switch between tabs

Pre-launch Checklist

GroovinChip commented 1 year ago

@Maksimka101 Is there an open issue for this? Can you please upload a gif or screenshots demonstrating your changes?

Maksimka101 commented 1 year ago

No, there is no issues for this.

Video with fix:

https://user-images.githubusercontent.com/35934153/229212647-629a4353-e0fd-41ef-abd0-47f993625d3a.mov

Video without fix:

https://user-images.githubusercontent.com/35934153/229212946-6f76722b-99a4-4c4e-93d8-c0d181601777.mov

Error stacktrace: ═══════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building LayoutBuilder: ScrollController attached to multiple scroll views. 'package:flutter/src/widgets/scroll_controller.dart': scroll_controller.dart:1 Failed assertion: line 108 pos 12: '_positions.length == 1' 2 Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. In either case, please report this assertion by filing a bug on GitHub: https://github.com/flutter/flutter/issues/new?template=2_bug.md The relevant error-causing widget was MacosWindow desktop_home_tab_body_builder.dart:12 When the exception was thrown, this was the stack #2 ScrollController.position scroll_controller.dart:108 #3 ScrollController.offset scroll_controller.dart:115 #4 _MacosWindowState.build. window.dart:221 #5 _LayoutBuilderElement._layout.layoutCallback layout_builder.dart:119 #6 BuildOwner.buildScope framework.dart:2682 #7 _LayoutBuilderElement._layout layout_builder.dart:153 #8 RenderObject.invokeLayoutCallback. object.dart:2300 #9 PipelineOwner._enableMutationsToDirtySubtrees object.dart:1056 #10 RenderObject.invokeLayoutCallback object.dart:2300 #11 RenderConstrainedLayoutBuilder.rebuildIfNecessary layout_builder.dart:228 #12 _RenderLayoutBuilder.performLayout layout_builder.dart:313 #13 RenderObject.layout object.dart:2189 #14 RenderBox.layout box.dart:2430 #15 ChildLayoutHelper.layoutChild layout_helper.dart:56 #16 RenderStack._computeSize stack.dart:595 #17 RenderStack.performLayout stack.dart:622 #18 RenderObject._layoutWithoutResize object.dart:2027 #19 PipelineOwner.flushLayout object.dart:1020 #20 RendererBinding.drawFrame binding.dart:516 #21 WidgetsBinding.drawFrame binding.dart:865 #22 RendererBinding._handlePersistentFrameCallback binding.dart:381 #23 SchedulerBinding._invokeFrameCallback binding.dart:1289 #24 SchedulerBinding.handleDrawFrame binding.dart:1218 #25 SchedulerBinding._handleDrawFrame binding.dart:1076 #29 _invoke (dart:ui/hooks.dart:147:10)
GroovinChip commented 1 year ago

Are you using a CupertinoTabView for that?

Maksimka101 commented 1 year ago

I use stack. The problem is in the scroll controller. When I change a tab, I can't change scroll controller so I face this issue

Maksimka101 commented 1 year ago

@GroovinChip hey. Do I need to do anything else to merge it?🙂