Skip to content

Conversation

@ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Dec 14, 2025

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:

  • Add a reusable control context wrapper that combines control reactivity and per-control theming for all controls.
  • Expose a Control extension method to build widgets within the standardized control context.

Bug Fixes:

  • Fix inconsistent Tab display by ensuring TabBar sees tab widgets as Tab instances and by aligning icon/text hints and sizing behavior.

Enhancements:

  • Refactor ControlWidget to use the new control context helper, simplifying widget construction and theme application.
  • Introduce a TabControl that extends Flutter's Tab to provide better integration with TabBar sizing and icon/label heuristics while still using Flet controls for content.
  • Ensure TabBar tabs created from arbitrary controls are wrapped in Tab widgets for consistent hover and splash behavior.
  • Add per-control theme resolution that respects theme, dark_theme, and theme_mode properties, falling back to the parent theme and system brightness as appropriate.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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

Copy link
Contributor

Copilot AI left a 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 ControlWidget into reusable withControlNotifier, withControlContext, and withControlTheme functions
  • Modified TabControl to extend Tab and provide size hints to Flutter's TabBar while building custom content
  • Enhanced tab building in TabBarControl to 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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 14, 2025

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e1254b6
Status: ✅  Deploy successful!
Preview URL: https://69dd125b.flet-docs.pages.dev
Branch Preview URL: https://fix-tabs.flet-docs.pages.dev

View logs

@FeodorFitsner FeodorFitsner merged commit f87f90d into main Dec 21, 2025
27 of 42 checks passed
@FeodorFitsner FeodorFitsner deleted the fix-tabs branch December 21, 2025 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v1: Tabs looks wrong compared to Flutter

3 participants