Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions packages/flet/lib/src/utils/widget_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ WidgetStateProperty<T?>? getWidgetStateProperty<T>(
if (j is! Map<dynamic, dynamic> || j.isEmpty) {
j = {"default": j};
}
if (j.containsKey("")) {
j["default"] = j.remove("");
}
if (!j.keys.every(
(k) => k == "default" || WidgetState.values.any((v) => v.name == k))) {
// wrap into another dict
Expand All @@ -35,8 +32,6 @@ class WidgetStateFromJSON<T> extends WidgetStateProperty<T?> {
_states = LinkedHashMap<String, T>.from(
jsonDictValue?.map((k, v) {
var key = k.trim().toLowerCase();
// "" is deprecated and renamed to "default"
if (key == "") key = "default";
return MapEntry(key, converterFromJson(v));
}) ??
{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async def do_login(_: ft.Event):
error_text.value = "Please provide username and password"
ft.context.page.update()
return
await ft.context.page.shared_preferences.set("current_user", user)
await ft.SharedPreferences().set("current_user", user)
app.user = user
ft.context.page.pop_dialog()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def main(page: ft.Page):
}

async def navigate_md_link(e: ft.Event[ft.Markdown]):
await page.launch_url(e.data)
await ft.UrlLauncher().launch_url(e.data)

page.add(
ft.SafeArea(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

def main(page: ft.Page):
async def navigate_md_link(e: ft.Event[ft.Markdown]):
await page.launch_url(e.data)
await ft.UrlLauncher().launch_url(e.data)

page.add(
ft.SafeArea(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def main(page: ft.Page):
page.scroll = ft.ScrollMode.AUTO

async def handle_link_tap(e: ft.Event[ft.Markdown]):
await page.launch_url(e.data)
await ft.UrlLauncher().launch_url(e.data)

page.add(
ft.SafeArea(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
async def main(page: ft.Page):
# on web, disable default browser context menu
if page.web:
await page.browser_context_menu.disable()
await ft.BrowserContextMenu().disable()

def handle_item_click(e: ft.Event[ft.PopupMenuItem]):
action = e.control.content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def handle_recording_stop(e: ft.Event[ft.Button]):
output_path = await recorder.stop_recording()
show_snackbar(f"Stopped recording. Output Path: {output_path}")
if page.web and output_path is not None:
await page.launch_url(output_path)
await ft.UrlLauncher().launch_url(output_path)

async def handle_list_devices(e: ft.Event[ft.Button]):
o = await recorder.get_input_devices()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def main(page: ft.Page):
),
)

def toggle_data(e: ft.Event[ft.ElevatedButton]):
def toggle_data(e: ft.Event[ft.Button]):
if state.toggled:
chart.data_series = data_2
chart.interactive = False
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/examples/extensions/map/camera_controls/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
def main(page: ft.Page):
page.padding = 16

async def open_attribution(e: ft.Event[ftm.SimpleAttribution]):
await ft.UrlLauncher().launch_url("https://www.openstreetmap.org/copyright")

async def update_camera_status(trigger: str):
camera = await my_map.get_camera()
camera_status.value = (
Expand Down Expand Up @@ -81,9 +84,7 @@ async def set_world_zoom(e: ft.Event[ft.Button]):
),
ftm.SimpleAttribution(
text="OpenStreetMap contributors",
on_click=lambda e: e.page.launch_url(
"https://www.openstreetmap.org/copyright"
),
on_click=open_attribution,
),
ftm.MarkerLayer(
markers=[
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/examples/extensions/map/idle_camera/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
def main(page: ft.Page):
page.padding = 16

async def open_attribution(e: ft.Event[ftm.SimpleAttribution]):
await ft.UrlLauncher().launch_url("https://www.openstreetmap.org/copyright")

async def handle_map_event(e: ftm.MapEvent):
last_event.value = (
"Last event: "
Expand Down Expand Up @@ -68,9 +71,7 @@ async def handle_map_event(e: ftm.MapEvent):
),
ftm.SimpleAttribution(
text="OpenStreetMap contributors",
on_click=lambda e: e.page.launch_url(
"https://www.openstreetmap.org/copyright"
),
on_click=open_attribution,
),
],
),
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/examples/extensions/map/interaction_flags/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
def main(page: ft.Page):
page.padding = 16

async def open_attribution(e: ft.Event[ftm.SimpleAttribution]):
await ft.UrlLauncher().launch_url("https://www.openstreetmap.org/copyright")

def get_selected_flags() -> ftm.InteractionFlag:
flags = ftm.InteractionFlag.NONE
for checkbox in checkboxes:
Expand Down Expand Up @@ -62,9 +65,7 @@ def handle_map_event(e: ftm.MapEvent):
),
ftm.SimpleAttribution(
text="OpenStreetMap contributors",
on_click=lambda e: e.page.launch_url(
"https://www.openstreetmap.org/copyright"
),
on_click=open_attribution,
),
],
)
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/examples/extensions/map/multi_layers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@


def main(page: ft.Page):
async def open_attribution(e: ft.Event[ftm.SimpleAttribution]):
await ft.UrlLauncher().launch_url("https://www.openstreetmap.org/copyright")

def handle_tap(e: ftm.MapTapEvent):
if e.name == "tap":
marker_layer.markers.append(
Expand Down Expand Up @@ -56,9 +59,7 @@ def handle_tap(e: ftm.MapTapEvent):
),
ftm.SimpleAttribution(
text="OpenStreetMap contributors",
on_click=lambda e: e.page.launch_url(
"https://www.openstreetmap.org/copyright"
),
on_click=open_attribution,
),
marker_layer := ftm.MarkerLayer(
markers=[
Expand Down
56 changes: 0 additions & 56 deletions sdk/python/packages/flet-cli/src/flet_cli/commands/build_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import flet.version
import flet_cli.utils.processes as processes
from flet.utils import copy_tree, slugify
from flet.utils.deprecated import deprecated_warning
from flet_cli.commands.flutter_base import (
BaseFlutterCommand,
console,
Expand Down Expand Up @@ -287,14 +286,6 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
help="Files and/or directories to exclude from the package"
"; can be used multiple times",
)
parser.add_argument(
"--clear-cache",
dest="clear_cache",
action="store_true",
default=None,
help="Remove any existing build cache before starting the build process. "
"Deprecated: use the `flet clean` command instead",
)
parser.add_argument(
"--project",
dest="project_name",
Expand Down Expand Up @@ -772,21 +763,6 @@ def handle(self, options: argparse.Namespace) -> None:

super().handle(options)

if getattr(self.options, "clear_cache", None):
deprecated_warning(
name="--clear-cache",
reason="Use the `flet clean` command instead.",
version="0.86.0",
delete_version="0.89.0",
type="flag",
)
console.print(
"Warning: the `--clear-cache` flag is deprecated since version "
"0.86.0 and will be removed in version 0.89.0. "
"Use the `flet clean` command instead.",
style=warning_style,
)

if "target_platform" in self.options:
self.target_platform = self.options.target_platform

Expand Down Expand Up @@ -1539,29 +1515,8 @@ def merged(key):
name = boot_screen.get("name", "flet")
options = boot_screen.get(name) or {}
else:
# backward compatibility with the legacy app.boot_screen /
# app.startup_screen settings
name = "flet"
options = {}
legacy_boot = merged("app.boot_screen")
legacy_startup = merged("app.startup_screen")
if legacy_boot or legacy_startup:
console.log(
"[tool.flet.app.boot_screen] and "
"[tool.flet.app.startup_screen] are deprecated; use "
"[tool.flet.boot_screen] with a named screen instead.",
style=warning_style,
)
if legacy_boot.get("show"):
options["spinner_size"] = 30
message = legacy_boot.get("message")
if message:
options["prepare_message"] = message
if legacy_startup.get("show"):
options["spinner_size"] = 30
message = legacy_startup.get("message")
if message:
options["startup_message"] = message

return {
"name": name,
Expand Down Expand Up @@ -1639,17 +1594,6 @@ def create_flutter_project(self, second_pass=False):
hash_changed = hash.has_changed()

if hash_changed:
# if options.clear_cache is set, delete any existing Flutter bootstrap
# project directory
if (
self.options.clear_cache
and self.flutter_dir.exists()
and not second_pass
):
if self.verbose > 1:
console.log(f"Deleting {self.flutter_dir}", style=verbose2_style)
shutil.rmtree(self.flutter_dir, ignore_errors=True)

# create a new Flutter bootstrap project directory, if non-existent
if not second_pass:
self.flutter_dir.mkdir(parents=True, exist_ok=True)
Expand Down
6 changes: 6 additions & 0 deletions sdk/python/packages/flet-video/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 1.0.0

### Removed

- `Video.show_controls` (deprecated in 0.85.0); set `Video.controls` to `None` to hide controls ([#6693](https://github.com/flet-dev/flet/pull/6693)) by @ndonkoHenri.
- `Video.playlist_add()` and `Video.playlist_remove()` (deprecated in 0.85.0); mutate `Video.playlist` directly with list methods such as `append()` and `pop()` ([#6693](https://github.com/flet-dev/flet/pull/6693)) by @ndonkoHenri.
## 0.86.2

### Fixed
Expand Down
50 changes: 1 addition & 49 deletions sdk/python/packages/flet-video/src/flet_video/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
"""

from dataclasses import field
from typing import Annotated, Optional, Union
from typing import Optional, Union

import flet as ft
from flet.utils.deprecated import deprecated
from flet.utils.validation import V
from flet_video.types import (
AdaptiveVideoControls,
PlaylistMode,
Expand Down Expand Up @@ -61,19 +59,6 @@ class Video(ft.LayoutControl):
Whether the video should start playing automatically.
"""

show_controls: Annotated[
Optional[bool],
V.deprecated(
version="0.85.0",
delete_version="0.88.0",
reason="Use controls=None to hide controls.",
docs_reason="To hide controls, instead set :attr:`controls` to `None`.",
),
] = None
"""
Whether to show the video player :attr:`controls`.
"""

controls: Optional[
Union[
VideoControls,
Expand All @@ -96,10 +81,6 @@ class Video(ft.LayoutControl):
:attr:`VideoControlsMode.NORMAL` controls are reused before
falling back to :attr:`VideoControlsMode.DEFAULT`. A mode value of
`None` hides controls for that mode only.

Note:
During the :attr:`show_controls` deprecation period, `show_controls=False`
hides controls even when this property is set.
"""

fullscreen: bool = False
Expand Down Expand Up @@ -297,35 +278,6 @@ async def jump_to(self, media_index: int):
arguments={"media_index": media_index},
)

@deprecated(
reason="Use playlist.append(media) instead.",
docs_reason="Use :attr:`playlist` directly, for example `video.playlist.append(media)`.", # noqa: E501
version="0.85.0",
delete_version="0.88.0",
show_parentheses=True,
)
async def playlist_add(self, media: VideoMedia):
"""Appends/Adds the provided `media` to the `playlist`."""
if not media.resource:
raise ValueError("media has no resource")
self.playlist.append(media)

@deprecated(
reason="Use playlist.pop(media_index) instead.",
docs_reason="Use :attr:`playlist` directly, for example `video.playlist.pop(media_index)`.", # noqa: E501
version="0.85.0",
delete_version="0.88.0",
show_parentheses=True,
)
async def playlist_remove(self, media_index: int):
"""Removes the provided `media` from the `playlist`."""
playlist_length = len(self.playlist)
if not (-playlist_length <= media_index < playlist_length):
raise IndexError("media_index is out of range")
if media_index < 0:
media_index = playlist_length + media_index
self.playlist.pop(media_index)

async def is_playing(self) -> bool:
"""
Returns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,7 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin {
var playbackRate = widget.control.getDouble("playback_rate");
var playlist = widget.control.get("playlist");
var shufflePlaylist = widget.control.getBool("shuffle_playlist");
var controls = widget.control.getBool("show_controls", true)!
? widget.control.get("controls")
: null;
var controls = widget.control.get("controls");
var playlistMode =
parsePlaylistMode(widget.control.getString("playlist_mode"));
var fullscreen = widget.control.getBool("fullscreen", false)!;
Expand Down
Loading
Loading