Skip to content

chore!: remove deprecated module-level margin/padding/border/border_radius helpers#6425

Open
ndonkoHenri wants to merge 4 commits intorelease/v0.85.0from
remove-overdue-deprecations
Open

chore!: remove deprecated module-level margin/padding/border/border_radius helpers#6425
ndonkoHenri wants to merge 4 commits intorelease/v0.85.0from
remove-overdue-deprecations

Conversation

@ndonkoHenri
Copy link
Copy Markdown
Contributor

@ndonkoHenri ndonkoHenri commented Apr 17, 2026

Summary by Sourcery

Remove deprecated module-level margin, padding, border, and border_radius helper functions and update usage across examples and docs to the class-based APIs.

Enhancements:

  • Clean up control modules by deleting long-deprecated module-level helpers for Margin, Padding, Border, and BorderRadius.

Documentation:

  • Update tutorials, cookbook recipes, and blog examples to use the new Border and BorderRadius class helpers and current Alignment API names instead of deprecated module-level helpers.

Chores:

  • Tidy solitaire and example code by reordering imports and improving docstrings and comments around drag-and-drop behavior.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 17, 2026

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: b3ac558
Status: ✅  Deploy successful!
Preview URL: https://ccdaecfa.flet-website-v2.pages.dev
Branch Preview URL: https://remove-overdue-deprecations.flet-website-v2.pages.dev

View logs

Copy link
Copy Markdown
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

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 17, 2026

Deploying flet-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: b3ac558
Status: ✅  Deploy successful!
Preview URL: https://a61fe508.flet-examples.pages.dev
Branch Preview URL: https://remove-overdue-deprecations.flet-examples.pages.dev

View logs

Copy link
Copy Markdown
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

Removes long-deprecated module-level margin/padding/border/border_radius helper functions from the Python SDK and updates docs/examples to use the corresponding class-based APIs.

Changes:

  • Delete deprecated module-level helper functions from flet.controls (Margin, Padding, Border, BorderRadius modules).
  • Update documentation, blog posts, and SDK examples to use ft.Margin.*, ft.Padding.*, ft.Border.*, ft.BorderRadius.* and newer ft.Alignment.* constants.
  • Minor tutorial/example cleanups (import reorder, docstring/comment formatting).

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
website/docs/types/borderradius.md Updates docs snippet to use ft.BorderRadius.all()
website/docs/tutorials/solitaire.md Replaces deprecated border/border_radius helpers with class-based APIs
website/docs/tutorials/chat.md Updates border helper usage to ft.Border.all()
website/docs/extend/user-extensions.md Updates deprecated alignment constant usage
website/docs/cookbook/large-lists.md Updates alignment/border/border_radius usage to class-based APIs
website/docs/cookbook/drag-and-drop.md Updates Row usage and alignment/border helper usage in snippets
website/docs/cookbook/colors.md Updates border helper usage to ft.Border.all()
website/blog/2023-05-12-theming-and-scrollables.md Updates border helper usage in blog example
sdk/python/packages/flet/src/flet/controls/padding.py Removes deprecated module-level padding.* helpers and export entries
sdk/python/packages/flet/src/flet/controls/material/container.py Updates embedded doc example to ft.Border.all()
sdk/python/packages/flet/src/flet/controls/margin.py Removes deprecated module-level margin.* helpers and export entries
sdk/python/packages/flet/src/flet/controls/border_radius.py Removes deprecated module-level border_radius.* helpers and export entries
sdk/python/packages/flet/src/flet/controls/border.py Removes deprecated module-level border.* helpers and export entries
sdk/python/examples/tutorials/solitaire/solitaire-game-setup/solitaire.py Updates border helper usage; reorders imports
sdk/python/examples/tutorials/solitaire/solitaire-game-setup/slot.py Updates border radius helper usage
sdk/python/examples/tutorials/solitaire/solitaire-game-setup/card.py Updates border radius helper usage
sdk/python/examples/tutorials/solitaire/solitaire-game-rules/solitaire.py Updates border helper usage; reorders imports
sdk/python/examples/tutorials/solitaire/solitaire-game-rules/slot.py Updates border radius helper usage; import ordering tweak
sdk/python/examples/tutorials/solitaire/solitaire-game-rules/card.py Updates border radius helper usage; docstring/comment edits
sdk/python/examples/tutorials/solitaire/solitaire-final/solitaire.py Updates border helper usage; reorders imports
sdk/python/examples/tutorials/solitaire/solitaire-final/slot.py Updates border radius helper usage
sdk/python/examples/tutorials/solitaire/solitaire-final/settings.py Updates border/border radius helper usage
sdk/python/examples/tutorials/solitaire/solitaire-final/card.py Updates border radius helper usage; docstring edit
sdk/python/examples/tutorials/solitaire/solitaire-final-part1/solitaire.py Updates border helper usage; reorders imports
sdk/python/examples/tutorials/solitaire/solitaire-final-part1/slot.py Updates border radius helper usage
sdk/python/examples/tutorials/solitaire/solitaire-final-part1/card.py Updates border radius helper usage
sdk/python/examples/tutorials/solitaire/solitaire-fanned-piles/slot.py Updates border helper usage; import ordering tweak
sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step4.py Updates border helper usage
sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step3.py Updates border helper usage
sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step2.py Updates border helper usage
sdk/python/examples/tutorials/solitaire/solitaire-classes/slot.py Updates border helper usage; import ordering tweak
sdk/python/examples/controls/types/border/container/main.py Updates border_radius helpers to ft.BorderRadius.*
CHANGELOG.md Adds changelog entry for the breaking removal of deprecated helpers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 3 to +7
from card import Card
from slot import Slot

import flet as ft

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import grouping/order is inconsistent with other solitaire tutorial examples: third-party imports (e.g., import flet as ft) are typically placed before local imports (from card import Card, from slot import Slot). Consider reordering to match the established pattern used in sdk/python/examples/tutorials/solitaire/solitaire-classes/solitaire.py and solitaire-fanned-piles/solitaire.py.

Suggested change
from card import Card
from slot import Slot
import flet as ft
import flet as ft
from card import Card
from slot import Slot

Copilot uses AI. Check for mistakes.
Comment on lines 3 to +7
from card import Card
from slot import Slot

import flet as ft

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import grouping/order is inconsistent with other solitaire tutorial examples: third-party imports (e.g., import flet as ft) are typically placed before local imports (from card import Card, from slot import Slot). Consider reordering to match the established pattern used in sdk/python/examples/tutorials/solitaire/solitaire-classes/solitaire.py and solitaire-fanned-piles/solitaire.py.

Suggested change
from card import Card
from slot import Slot
import flet as ft
import flet as ft
from card import Card
from slot import Slot

Copilot uses AI. Check for mistakes.
Comment on lines 4 to 9
from card import Card
from slot import Slot

import flet as ft


Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import grouping/order is inconsistent with other solitaire tutorial examples: third-party imports (e.g., import flet as ft) are typically placed before local imports (from card import Card, from slot import Slot). Consider reordering to match the established pattern used in sdk/python/examples/tutorials/solitaire/solitaire-classes/solitaire.py and solitaire-fanned-piles/solitaire.py.

Suggested change
from card import Card
from slot import Slot
import flet as ft
import flet as ft
from card import Card
from slot import Slot

Copilot uses AI. Check for mistakes.
Comment on lines 3 to +7
from card import Card
from slot import Slot

import flet as ft

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import grouping/order is inconsistent with other solitaire tutorial examples: third-party imports (e.g., import flet as ft) are typically placed before local imports (from card import Card, from slot import Slot). Consider reordering to match the established pattern used in sdk/python/examples/tutorials/solitaire/solitaire-classes/solitaire.py and solitaire-fanned-piles/solitaire.py.

Suggested change
from card import Card
from slot import Slot
import flet as ft
import flet as ft
from card import Card
from slot import Slot

Copilot uses AI. Check for mistakes.
Comment on lines 36 to 39
border_radius=5,
content=ft.Text("1", size=20),
alignment=ft.alignment.center,
alignment=ft.Alignment.CENTER,
),
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s still a later code snippet in this doc using the deprecated ft.alignment.center (around line 88). For consistency with the updated snippets (and to avoid showing deprecated API in the cookbook), update that remaining occurrence to ft.Alignment.CENTER as well.

Copilot uses AI. Check for mistakes.
else: # slot == None when the cards are dealt and need to be place in slot for the first time
else:
# slot == None when the cards are dealt and
# need to be place in slot for the first time
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the comment: “need to be place” should be “need to be placed”.

Suggested change
# need to be place in slot for the first time
# need to be placed in slot for the first time

Copilot uses AI. Check for mistakes.
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.

2 participants