Skip to content

Conversation

@ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Nov 22, 2025

Fix #3017

Example

import flet as ft


def main(page: ft.Page):
    page.platform = ft.PagePlatform.MACOS
    page.adaptive = True

    page.add(
        ft.ElevatedButton(
            "Open SnackBar",
            on_click=lambda: page.show_dialog(ft.SnackBar("Hello, World!")),
        )
    )


ft.run(main)

Summary by Sourcery

Fix SnackBar visibility on Cupertino pages and improve responsive layout and segmented button documentation, including new examples and tests.

New Features:

  • Add a custom breakpoint ResponsiveRow example demonstrating non-standard breakpoint usage.

Bug Fixes:

  • Ensure SnackBar (and other ScaffoldMessenger-based overlays) work correctly on Cupertino pages by injecting a Material ScaffoldMessenger into the app builder.

Enhancements:

  • Document ResponsiveRowBreakpoint values and responsive breakpoint configuration more clearly in code and docs.
  • Refine segmented button documentation structure, separating Segment docs into their own page and adjusting images and options accordingly.

Documentation:

  • Expand ResponsiveRow documentation with a custom breakpoint example and clearer explanations of breakpoint configuration.
  • Add a dedicated documentation page for the Segment control and link it from the SegmentedButton docs.

Tests:

  • Add an integration test verifying that SnackBar displays correctly on a Cupertino page.

@ndonkoHenri ndonkoHenri requested a review from Copilot November 22, 2025 21:30
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

@ndonkoHenri ndonkoHenri linked an issue Nov 22, 2025 that may be closed by this pull request
Copilot finished reviewing on behalf of ndonkoHenri November 22, 2025 21:32
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 fixes an issue where SnackBar and Banner controls were not opening in Cupertino (iOS/macOS style) pages. The fix wraps CupertinoApp with a ScaffoldMessenger widget using the builder parameter, which provides the necessary Material infrastructure for these Material Design components to function in Cupertino apps.

Key changes:

  • Added a scaffoldMessengerBuilder function that wraps the app with Material theme and ScaffoldMessenger
  • Applied this builder to both CupertinoApp and CupertinoApp.router variants
  • Added test coverage for SnackBar in Cupertino pages
  • Includes additional documentation improvements for ResponsiveRow and SegmentedButton controls

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/flet/lib/src/controls/page.dart Core fix: Adds ScaffoldMessenger wrapper to CupertinoApp via builder parameter to enable Material components (SnackBar/Banner) in Cupertino pages
sdk/python/packages/flet/integration_tests/controls/material/test_snack_bar.py Adds test case to verify SnackBar works in Cupertino pages with adaptive=True
sdk/python/packages/flet/integration_tests/controls/material/golden/macos/snack_bar/cupertino_page.png Golden screenshot for Cupertino page SnackBar test
sdk/python/packages/flet/src/flet/controls/types.py Improves documentation for ResponsiveRowBreakpoint enum with detailed descriptions
sdk/python/packages/flet/src/flet/controls/core/responsive_row.py Enhances documentation for ResponsiveRow.breakpoints property
sdk/python/packages/flet/docs/controls/segmentedbutton.md Refactors documentation to separate Segment class into its own page
sdk/python/packages/flet/docs/controls/segment.md Adds dedicated documentation page for Segment class
sdk/python/packages/flet/docs/controls/responsiverow.md Adds custom breakpoints example section
sdk/python/examples/controls/responsive_row/custom_breakpoint.py Adds new example demonstrating custom breakpoints usage
sdk/python/examples/controls/responsive_row/basic.py Updates example to use ResponsiveRowBreakpoint enum instead of string literals
sdk/python/packages/flet/mkdocs.yml Updates navigation to include Segment as a nested item under SegmentedButton

💡 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 Nov 22, 2025

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 461a5ed
Status: ✅  Deploy successful!
Preview URL: https://24b2ad54.flet-docs.pages.dev
Branch Preview URL: https://fix-snackbar-in-cupertino-pa.flet-docs.pages.dev

View logs

@ndonkoHenri ndonkoHenri linked an issue Nov 23, 2025 that may be closed by this pull request
1 task
@ndonkoHenri ndonkoHenri linked an issue Nov 23, 2025 that may be closed by this pull request
1 task
@FeodorFitsner FeodorFitsner merged commit 77a1958 into main Nov 25, 2025
25 of 46 checks passed
@FeodorFitsner FeodorFitsner deleted the fix-snackbar-in-cupertino-page branch November 25, 2025 02:37
nimaxin pushed a commit to nimaxin/flet that referenced this pull request Nov 25, 2025
…#5848)

* Segment docs

* Fix flet-dev#2944: add ResponsiveRow custom breakpoint example

* fix: host snack bars in adaptive cupertino page

* add test for snackbar in adaptive cupertino page

* update test image

* fix flet-dev#5370: add input formatters in dropdown

* fix flet-dev#5562: `Pagelet` integration tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants