-
Notifications
You must be signed in to change notification settings - Fork 597
fix: Improve Tabdisplay
#5904
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
base: main
Are you sure you want to change the base?
fix: Improve Tabdisplay
#5904
Conversation
…mization and clarity.
…fier` argument for streamlined semantics.
…nt `context` parameter.
…`control_wrappers` to `control_inherited_notifier`, and updated imports accordingly.
…er`, add comments explaining key functionalities and behaviors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the Tab control rendering to better integrate with Flutter's TabBar widget while extracting reusable control context and theme utilities.
Key Changes:
- Extracted control context/theme logic from
ControlWidgetinto reusablewithControlNotifier,withControlContext, andwithControlThemefunctions - Modified
TabControlto extendTaband provide size hints to Flutter's TabBar while building custom content - Enhanced tab building in
TabBarControlto explicitly handle Tab-type controls vs. arbitrary controls
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/flet/lib/src/widgets/control_inherited_notifier.dart |
Added reusable utility functions for wrapping widgets with ControlInheritedNotifier and per-control theme support; includes extension method for convenient access |
packages/flet/lib/src/controls/tabs.dart |
Refactored TabControl to extend Tab for proper TabBar integration; improved tab building logic to set notifyParent and handle non-Tab controls |
packages/flet/lib/src/controls/control_widget.dart |
Simplified by delegating to new control context utilities; removed duplicate theme/notifier wrapping logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Widget withControlContext( | ||
| Control control, | ||
| WidgetBuilder builder, | ||
| ) { | ||
| return Builder(builder: (context) { | ||
| final child = withControlNotifier(control, builder); | ||
| return withControlTheme(control, context, child); | ||
| }); | ||
| } |
Copilot
AI
Dec 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When skip_inherited_notifier is true, the new code path wraps the widget with two Builder widgets (one from withControlContext at line 59, and one from withControlNotifier at line 40), whereas the old code had no wrapper. While Builder widgets are lightweight, this introduces extra widget layers that didn't exist before for controls opting out of the inherited notifier pattern. Consider optimizing withControlContext to avoid the extra Builder when skip_inherited_notifier is true.
Deploying flet-docs with
|
| Latest commit: |
78d2be1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://849bd354.flet-docs.pages.dev |
| Branch Preview URL: | https://fix-tabs.flet-docs.pages.dev |
…Flutter's TabBar heuristics
…arity and update references in `withControlContext`.
Fix #5599
Summary by Sourcery
Improve tab rendering and per-control theming by centralizing control context handling and aligning Tabs with Flutter's Tab heuristics.
New Features:
Bug Fixes:
Enhancements: