diff --git a/.appveyor.yml b/.appveyor.yml index 5638e4dda..f2272a5c5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -259,7 +259,6 @@ for: provider: GitHub auth_token: $(GITHUB_TOKEN) release: $(APPVEYOR_REPO_TAG_NAME) - artifact: flet_windows on: APPVEYOR_REPO_TAG: true @@ -510,3 +509,10 @@ for: artifacts: - path: sdk/python/packages/flet-cli/dist/* - path: sdk/python/packages/flet/dist/* + + deploy: + provider: GitHub + auth_token: $(GITHUB_TOKEN) + release: $(APPVEYOR_REPO_TAG_NAME) + on: + APPVEYOR_REPO_TAG: true \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc322239..8414923fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Flet changelog +## 0.25.2 + +### Bug fixes + +* Fix `flet publish` creates broken website if no `requirements.txt` or `pyproject.toml` found ([#4493](https://github.com/flet-dev/flet/pull/4493)). +* Fix PyInstaller hook to avoid download Flet app bundle on first run ([#4549](https://github.com/flet-dev/flet/pull/4549)). +* Support `git`, `path`, `url` Poetry-style dependencies in `pyproject.toml` ([#4554](https://github.com/flet-dev/flet/pull/4554)). +* Fixed broken `Map.center_on()` and default animations ([#4519](https://github.com/flet-dev/flet/pull/4519)). +* Fixed Tooltip corruption in `Segment` and `BarChartRod` on `update()` ([#4525](https://github.com/flet-dev/flet/pull/4525)). +* Fixed Setting `CheckBox.border_side.stroke_align` to an Enum fails ([#4526](https://github.com/flet-dev/flet/pull/4526)). +* Fixed `ControlState should` be resolved based on user-defined order ([#4556](https://github.com/flet-dev/flet/pull/4556)). +* Fixed broken `Dismissible.dismiss_direction` ([#4557](https://github.com/flet-dev/flet/pull/4557)). + ## 0.25.1 ### Changes diff --git a/packages/flet/CHANGELOG.md b/packages/flet/CHANGELOG.md index be63396c8..98493e5b7 100644 --- a/packages/flet/CHANGELOG.md +++ b/packages/flet/CHANGELOG.md @@ -1,3 +1,16 @@ +# 0.25.2 + +## Bug fixes + +* Fix `flet publish` creates broken website if no `requirements.txt` or `pyproject.toml` found ([#4493](https://github.com/flet-dev/flet/pull/4493)). +* Fix PyInstaller hook to avoid download Flet app bundle on first run ([#4549](https://github.com/flet-dev/flet/pull/4549)). +* Support `git`, `path`, `url` Poetry-style dependencies in `pyproject.toml` ([#4554](https://github.com/flet-dev/flet/pull/4554)). +* Fixed broken `Map.center_on()` and default animations ([#4519](https://github.com/flet-dev/flet/pull/4519)). +* Fixed Tooltip corruption in `Segment` and `BarChartRod` on `update()` ([#4525](https://github.com/flet-dev/flet/pull/4525)). +* Fixed Setting `CheckBox.border_side.stroke_align` to an Enum fails ([#4526](https://github.com/flet-dev/flet/pull/4526)). +* Fixed `ControlState should` be resolved based on user-defined order ([#4556](https://github.com/flet-dev/flet/pull/4556)). +* Fixed broken `Dismissible.dismiss_direction` ([#4557](https://github.com/flet-dev/flet/pull/4557)). + # 0.25.1 ## Changes diff --git a/packages/flet/lib/src/controls/barchart.dart b/packages/flet/lib/src/controls/barchart.dart index f3f3f2e01..ae585a451 100644 --- a/packages/flet/lib/src/controls/barchart.dart +++ b/packages/flet/lib/src/controls/barchart.dart @@ -263,9 +263,8 @@ class _BarChartControlState extends State { getTooltipItem: (group, groupIndex, rod, rodIndex) { var dp = viewModel.barGroups[groupIndex].barRods[rodIndex]; - var tooltip = dp.control.attrString("tooltip") != null - ? jsonDecode(dp.control.attrString("tooltip")!) - : dp.control.attrDouble("toY", 0)!.toString(); + var tooltip = dp.control.attrString("tooltip", + dp.control.attrDouble("toY", 0)!.toString())!; var tooltipStyle = parseTextStyle( Theme.of(context), dp.control, "tooltipStyle"); tooltipStyle ??= const TextStyle(); diff --git a/packages/flet/lib/src/controls/dismissible.dart b/packages/flet/lib/src/controls/dismissible.dart index ea156cf85..582e97e30 100644 --- a/packages/flet/lib/src/controls/dismissible.dart +++ b/packages/flet/lib/src/controls/dismissible.dart @@ -56,7 +56,7 @@ class _DismissibleControlState extends State { parseDismissThresholds(widget.control, "dismissThresholds"); DismissDirection direction = parseDismissDirection( - widget.control.attrString("direction"), DismissDirection.horizontal)!; + widget.control.attrString("dismissDirection"), DismissDirection.horizontal)!; widget.backend.subscribeMethods(widget.control.id, (methodName, args) async { diff --git a/packages/flet/lib/src/controls/segmented_button.dart b/packages/flet/lib/src/controls/segmented_button.dart index 35763d530..f838c9288 100644 --- a/packages/flet/lib/src/controls/segmented_button.dart +++ b/packages/flet/lib/src/controls/segmented_button.dart @@ -49,7 +49,6 @@ class _SegmentedButtonControlState extends State defaultSurfaceTintColor: theme.colorScheme.surfaceTint, defaultElevation: 1, defaultPadding: const EdgeInsets.symmetric(horizontal: 8), - defaultBorderSide: BorderSide.none, defaultShape: theme.useMaterial3 ? const StadiumBorder() : RoundedRectangleBorder(borderRadius: BorderRadius.circular(4))); @@ -124,9 +123,7 @@ class _SegmentedButtonControlState extends State return ButtonSegment( value: segmentView.control.attrString("value")!, enabled: !segmentDisabled, - tooltip: !segmentDisabled && segmentTooltip != null - ? jsonDecode(segmentTooltip) - : null, + tooltip: segmentDisabled ? null : segmentTooltip, icon: iconCtrls.isNotEmpty ? createControl(segmentView.control, iconCtrls.first.id, segmentDisabled) diff --git a/packages/flet/lib/src/utils/form_field.dart b/packages/flet/lib/src/utils/form_field.dart index 720dc5816..b476ee1f1 100644 --- a/packages/flet/lib/src/utils/form_field.dart +++ b/packages/flet/lib/src/utils/form_field.dart @@ -154,7 +154,9 @@ InputDecoration buildInputDecoration(BuildContext context, Control control, label: label != null ? createControl(control, label.id, control.isDisabled, parentAdaptive: adaptive) - : Text(control.attrString("label", "")!), + : control.attrString("label") != null + ? Text(control.attrString("label")!) + : null, labelStyle: parseTextStyle(Theme.of(context), control, "labelStyle"), border: border, enabledBorder: border, diff --git a/packages/flet/lib/src/utils/material_state.dart b/packages/flet/lib/src/utils/material_state.dart index c6c19dbc4..65421197c 100644 --- a/packages/flet/lib/src/utils/material_state.dart +++ b/packages/flet/lib/src/utils/material_state.dart @@ -1,3 +1,4 @@ +import 'dart:collection'; import 'package:flutter/material.dart'; WidgetStateProperty? getWidgetStateProperty( @@ -8,43 +9,42 @@ WidgetStateProperty? getWidgetStateProperty( } var j = jsonDictValue; if (j is! Map) { - j = {"": j}; + j = {"default": j}; } return WidgetStateFromJSON(j, converterFromJson, defaultValue); } class WidgetStateFromJSON extends WidgetStateProperty { - late final Map _states; + late final LinkedHashMap _states; late final T? _defaultValue; WidgetStateFromJSON(Map? jsonDictValue, T Function(dynamic) converterFromJson, T? defaultValue) { _defaultValue = defaultValue; - _states = {}; - if (jsonDictValue != null) { - jsonDictValue.forEach((stateStr, jv) { - stateStr.split(",").map((s) => s.trim().toLowerCase()).forEach((state) { - _states[state] = converterFromJson(jv); - }); - }); - } + + // preserve user-defined order + _states = LinkedHashMap.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)); + }) ?? + {}, + ); } @override T? resolve(Set states) { - //debugPrint("WidgetStateFromJSON states: $states, _states: $_states"); - // find specific state - for (var state in states) { - if (_states.containsKey(state.name)) { - return _states[state.name]!; + // Resolve using user-defined order in _states + for (var stateName in _states.keys) { + if (stateName == "default") continue; // Skip "default"; handled last + if (states.any((state) => state.name == stateName)) { + return _states[stateName]; } } - // catch-all value - if (_states.containsKey("")) { - return _states[""]; - } - - return _defaultValue; + // Default state + return _states["default"] ?? _defaultValue; } } diff --git a/packages/flet/pubspec.yaml b/packages/flet/pubspec.yaml index d73bd7284..fa2c213c6 100644 --- a/packages/flet/pubspec.yaml +++ b/packages/flet/pubspec.yaml @@ -2,7 +2,7 @@ name: flet description: Write entire Flutter app in Python or add server-driven UI experience into existing Flutter app. homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet -version: 0.25.1 +version: 0.25.2 # This package supports all platforms listed below. platforms: diff --git a/packages/flet_ads/CHANGELOG.md b/packages/flet_ads/CHANGELOG.md index 2a3bd1cd7..fe83091a5 100644 --- a/packages/flet_ads/CHANGELOG.md +++ b/packages/flet_ads/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_ads/pubspec.yaml b/packages/flet_ads/pubspec.yaml index 82756fb9b..a0a75409e 100644 --- a/packages/flet_ads/pubspec.yaml +++ b/packages/flet_ads/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_ads description: Flet Ads control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_ads -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_audio/CHANGELOG.md b/packages/flet_audio/CHANGELOG.md index af6dd06f8..274b01373 100644 --- a/packages/flet_audio/CHANGELOG.md +++ b/packages/flet_audio/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_audio/pubspec.yaml b/packages/flet_audio/pubspec.yaml index 556b6245b..344172378 100644 --- a/packages/flet_audio/pubspec.yaml +++ b/packages/flet_audio/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_audio description: Flet Audio control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_audio -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_audio_recorder/CHANGELOG.md b/packages/flet_audio_recorder/CHANGELOG.md index af6dd06f8..274b01373 100644 --- a/packages/flet_audio_recorder/CHANGELOG.md +++ b/packages/flet_audio_recorder/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_audio_recorder/pubspec.yaml b/packages/flet_audio_recorder/pubspec.yaml index 76d5963dd..85b779678 100644 --- a/packages/flet_audio_recorder/pubspec.yaml +++ b/packages/flet_audio_recorder/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_audio_recorder description: Flet AudioRecorder control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_audio_recorder -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_flashlight/CHANGELOG.md b/packages/flet_flashlight/CHANGELOG.md index ac77602d9..eabc6d9a3 100644 --- a/packages/flet_flashlight/CHANGELOG.md +++ b/packages/flet_flashlight/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_flashlight/pubspec.yaml b/packages/flet_flashlight/pubspec.yaml index 52d747842..87567f65e 100644 --- a/packages/flet_flashlight/pubspec.yaml +++ b/packages/flet_flashlight/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_flashlight description: Flet Flashlight control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_flashlight -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_geolocator/CHANGELOG.md b/packages/flet_geolocator/CHANGELOG.md index ac77602d9..eabc6d9a3 100644 --- a/packages/flet_geolocator/CHANGELOG.md +++ b/packages/flet_geolocator/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_geolocator/pubspec.yaml b/packages/flet_geolocator/pubspec.yaml index 97af3c702..913e57bda 100644 --- a/packages/flet_geolocator/pubspec.yaml +++ b/packages/flet_geolocator/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_geolocator description: Flet Geolocator control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_geolocator -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_lottie/CHANGELOG.md b/packages/flet_lottie/CHANGELOG.md index 27662d8f5..180e0f277 100644 --- a/packages/flet_lottie/CHANGELOG.md +++ b/packages/flet_lottie/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_lottie/pubspec.yaml b/packages/flet_lottie/pubspec.yaml index f6f1b320e..6ffcf7f8e 100644 --- a/packages/flet_lottie/pubspec.yaml +++ b/packages/flet_lottie/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_lottie description: Flet Lottie control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_lottie -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_map/CHANGELOG.md b/packages/flet_map/CHANGELOG.md index ac77602d9..eabc6d9a3 100644 --- a/packages/flet_map/CHANGELOG.md +++ b/packages/flet_map/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_map/lib/src/map.dart b/packages/flet_map/lib/src/map.dart index f82db9b75..73c7e0ca3 100644 --- a/packages/flet_map/lib/src/map.dart +++ b/packages/flet_map/lib/src/map.dart @@ -54,8 +54,10 @@ class _MapControlState extends State .where((c) => c.isVisible && (acceptedChildrenTypes.contains(c.type))) .toList(); - Curve? defaultAnimationCurve; - Duration? defaultAnimationDuration; + Curve? defaultAnimationCurve = + parseCurve(widget.control.attrString("animationCurve")); + Duration? defaultAnimationDuration = + parseDuration(widget.control, "animationDuration"); var configuration = parseConfiguration( widget.control, widget.backend, context, const MapOptions())!; @@ -76,7 +78,7 @@ class _MapControlState extends State if (degree != null) { _animatedMapController.animatedRotateFrom( degree, - curve: parseCurve(args["curve"]) ?? defaultAnimationCurve, + curve: parseCurve(args["curve"], defaultAnimationCurve), ); } case "reset_rotation": diff --git a/packages/flet_map/pubspec.yaml b/packages/flet_map/pubspec.yaml index da1d032f5..05c117870 100644 --- a/packages/flet_map/pubspec.yaml +++ b/packages/flet_map/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_map description: Flet Map control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_map -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_permission_handler/CHANGELOG.md b/packages/flet_permission_handler/CHANGELOG.md index ac77602d9..eabc6d9a3 100644 --- a/packages/flet_permission_handler/CHANGELOG.md +++ b/packages/flet_permission_handler/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_permission_handler/pubspec.yaml b/packages/flet_permission_handler/pubspec.yaml index 374e2f330..0ba91e1ec 100644 --- a/packages/flet_permission_handler/pubspec.yaml +++ b/packages/flet_permission_handler/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_permission_handler description: Flet PermissionHandler control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_permission_handler -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_rive/CHANGELOG.md b/packages/flet_rive/CHANGELOG.md index 3b5383736..35f904ae5 100644 --- a/packages/flet_rive/CHANGELOG.md +++ b/packages/flet_rive/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_rive/pubspec.yaml b/packages/flet_rive/pubspec.yaml index 85c07d48f..91f20ba1a 100644 --- a/packages/flet_rive/pubspec.yaml +++ b/packages/flet_rive/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_rive description: Flet Rive control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_rive -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_video/CHANGELOG.md b/packages/flet_video/CHANGELOG.md index af6dd06f8..274b01373 100644 --- a/packages/flet_video/CHANGELOG.md +++ b/packages/flet_video/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_video/pubspec.yaml b/packages/flet_video/pubspec.yaml index 95d0e479d..fd8b33eaf 100644 --- a/packages/flet_video/pubspec.yaml +++ b/packages/flet_video/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_video description: Flet Video control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_video -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/packages/flet_webview/CHANGELOG.md b/packages/flet_webview/CHANGELOG.md index af6dd06f8..274b01373 100644 --- a/packages/flet_webview/CHANGELOG.md +++ b/packages/flet_webview/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.2 + +Version follows parent `flet` package. + # 0.25.1 Version follows parent `flet` package. diff --git a/packages/flet_webview/pubspec.yaml b/packages/flet_webview/pubspec.yaml index 9cbafcb75..63bcaf653 100644 --- a/packages/flet_webview/pubspec.yaml +++ b/packages/flet_webview/pubspec.yaml @@ -2,7 +2,7 @@ name: flet_webview description: Flet WebView control homepage: https://flet.dev repository: https://github.com/flet-dev/flet/packages/flet_webview -version: 0.25.1 +version: 0.25.2 environment: sdk: '>=3.2.3 <4.0.0' diff --git a/sdk/python/packages/flet/src/flet/core/border.py b/sdk/python/packages/flet/src/flet/core/border.py index 3f01866e5..74d20c218 100644 --- a/sdk/python/packages/flet/src/flet/core/border.py +++ b/sdk/python/packages/flet/src/flet/core/border.py @@ -1,11 +1,11 @@ -from dataclasses import dataclass, field +from dataclasses import dataclass from enum import Enum from typing import Optional, Union from flet.core.types import ColorValue, OptionalNumber -class BorderSideStrokeAlign(Enum): +class BorderSideStrokeAlign(float, Enum): INSIDE = -1.0 CENTER = 0.0 OUTSIDE = 1.0 @@ -14,16 +14,16 @@ class BorderSideStrokeAlign(Enum): @dataclass class BorderSide: width: OptionalNumber - color: Optional[ColorValue] = field(default=None) - stroke_align: Union[BorderSideStrokeAlign, OptionalNumber] = field(default=None) + color: Optional[ColorValue] = None + stroke_align: Union[BorderSideStrokeAlign, OptionalNumber] = None @dataclass class Border: - top: Optional[BorderSide] = field(default=None) - right: Optional[BorderSide] = field(default=None) - bottom: Optional[BorderSide] = field(default=None) - left: Optional[BorderSide] = field(default=None) + top: Optional[BorderSide] = None + right: Optional[BorderSide] = None + bottom: Optional[BorderSide] = None + left: Optional[BorderSide] = None def all(width: Optional[float] = None, color: Optional[ColorValue] = None) -> Border: diff --git a/sdk/python/packages/flet/src/flet/core/charts/bar_chart_rod.py b/sdk/python/packages/flet/src/flet/core/charts/bar_chart_rod.py index d0728f25f..48c99f724 100644 --- a/sdk/python/packages/flet/src/flet/core/charts/bar_chart_rod.py +++ b/sdk/python/packages/flet/src/flet/core/charts/bar_chart_rod.py @@ -68,7 +68,7 @@ def __init__( self.tooltip_style = tooltip_style def _get_control_name(self): - return "rod" + return "bar_chart_rod" def before_update(self): super().before_update() diff --git a/sdk/python/packages/flet/src/flet/core/chip.py b/sdk/python/packages/flet/src/flet/core/chip.py index 6d6a5626b..8a909277e 100644 --- a/sdk/python/packages/flet/src/flet/core/chip.py +++ b/sdk/python/packages/flet/src/flet/core/chip.py @@ -210,6 +210,7 @@ def before_update(self): self._set_attr_json("labelStyle", self.__label_style) self._set_attr_json("padding", self.__padding) self._set_attr_json("shape", self.__shape) + self._set_attr_json("borderSide", self.__border_side) self._set_attr_json("color", self.__color, wrap_attr_dict=True) def _get_children(self): diff --git a/sdk/python/packages/flet/src/flet/core/control.py b/sdk/python/packages/flet/src/flet/core/control.py index 142bb31ba..cb2514d0e 100644 --- a/sdk/python/packages/flet/src/flet/core/control.py +++ b/sdk/python/packages/flet/src/flet/core/control.py @@ -91,10 +91,12 @@ def before_update(self): pass def _before_build_command(self) -> None: - self._set_attr_json("col", self.__col) - self._set_attr_json("tooltip", self.tooltip) + if self._get_control_name() not in ["segment", "bar_chart_rod"]: + # see https://github.com/flet-dev/flet/pull/4525 + self._set_attr_json("tooltip", self.tooltip) if isinstance(self.badge, (Badge, str)): self._set_attr_json("badge", self.badge) + self._set_attr_json("col", self.__col) def did_mount(self): pass diff --git a/sdk/python/packages/flet/src/flet/core/map/map.py b/sdk/python/packages/flet/src/flet/core/map/map.py index 05410cd68..59019e747 100644 --- a/sdk/python/packages/flet/src/flet/core/map/map.py +++ b/sdk/python/packages/flet/src/flet/core/map/map.py @@ -366,7 +366,7 @@ def center_on( animation_duration: DurationValue = None, ): self.invoke_method( - "animate_to", + "center_on", arguments={ "lat": str(point.latitude) if point else None, "long": str(point.longitude) if point else None, @@ -609,15 +609,6 @@ class MapEventSource(Enum): CURSOR_KEYBOARD_ROTATION = "cursorKeyboardRotation" -class MapPointerDeviceType(Enum): - TOUCH = "touch" - MOUSE = "mouse" - STYLUS = "stylus" - INVERTED_STYLUS = "invertedStylus" - TRACKPAD = "trackpad" - UNKNOWN = "unknown" - - class MapTapEvent(ControlEvent): def __init__(self, e: ControlEvent) -> None: super().__init__(e.target, e.name, e.data, e.control, e.page) diff --git a/sdk/python/packages/flet/src/flet/core/popup_menu_button.py b/sdk/python/packages/flet/src/flet/core/popup_menu_button.py index 811101672..e6847de33 100644 --- a/sdk/python/packages/flet/src/flet/core/popup_menu_button.py +++ b/sdk/python/packages/flet/src/flet/core/popup_menu_button.py @@ -286,7 +286,6 @@ def __init__( self.items = items self.icon = icon self.on_cancel = on_cancel - self.on_cancelled = on_cancelled self.on_open = on_open self.shape = shape self.padding = padding diff --git a/sdk/python/packages/flet/src/flet/core/theme.py b/sdk/python/packages/flet/src/flet/core/theme.py index e9a0711d4..f8ce4b0b8 100644 --- a/sdk/python/packages/flet/src/flet/core/theme.py +++ b/sdk/python/packages/flet/src/flet/core/theme.py @@ -888,6 +888,4 @@ class Theme: text_theme: Optional[TextTheme] = None time_picker_theme: Optional[TimePickerTheme] = None tooltip_theme: Optional[TooltipTheme] = None - visual_density: Union[VisualDensity, ThemeVisualDensity] = field( - default=VisualDensity.STANDARD - ) + visual_density: Union[VisualDensity, ThemeVisualDensity] = None diff --git a/sdk/python/packages/flet/src/flet/core/types.py b/sdk/python/packages/flet/src/flet/core/types.py index 791351a24..26456972c 100644 --- a/sdk/python/packages/flet/src/flet/core/types.py +++ b/sdk/python/packages/flet/src/flet/core/types.py @@ -170,7 +170,7 @@ class ControlState(Enum): SCROLLED_UNDER = "scrolledUnder" DISABLED = "disabled" ERROR = "error" - DEFAULT = "" + DEFAULT = "default" class MainAxisAlignment(Enum): diff --git a/sdk/python/packages/flet/tests/test_datatable.py b/sdk/python/packages/flet/tests/test_datatable.py index fd15969d6..1b0864576 100644 --- a/sdk/python/packages/flet/tests/test_datatable.py +++ b/sdk/python/packages/flet/tests/test_datatable.py @@ -1,6 +1,7 @@ -import flet as ft from flet.core.protocol import Command +import flet as ft + def test_datatable_instance_no_attrs_set(): r = ft.DataTable(columns=[ft.DataColumn(label=ft.Text("Header"))]) @@ -38,7 +39,7 @@ def test_datarow_color_literal_material_state_as_string(): indent=0, name=None, values=["datarow"], - attrs={"color": '{"":"yellow"}'}, + attrs={"color": '{"default":"yellow"}'}, commands=[], ), Command(indent=2, name=None, values=["datacell"], attrs={}, commands=[]), @@ -51,7 +52,11 @@ def test_datarow_color_literal_material_state_as_string(): def test_datarow_color_multiple_material_states_as_strings(): r = ft.DataRow( cells=[ft.DataCell(content=ft.Text("Cell"))], - color={"selected": "red", "hovered": "blue", "": "yellow"}, + color={ + ft.ControlState.SELECTED: "red", + ft.ControlState.HOVERED: "blue", + ft.ControlState.DEFAULT: "yellow", + }, ) assert isinstance(r, ft.Control) assert r._build_add_commands() == [ @@ -59,7 +64,7 @@ def test_datarow_color_multiple_material_states_as_strings(): indent=0, name=None, values=["datarow"], - attrs={"color": '{"selected":"red","hovered":"blue","":"yellow"}'}, + attrs={"color": '{"selected":"red","hovered":"blue","default":"yellow"}'}, commands=[], ), Command(indent=2, name=None, values=["datacell"], attrs={}, commands=[]), @@ -84,7 +89,7 @@ def test_datarow_color_multiple_material_states(): indent=0, name=None, values=["datarow"], - attrs={"color": '{"selected":"red","hovered":"blue","":"yellow"}'}, + attrs={"color": '{"selected":"red","hovered":"blue","default":"yellow"}'}, commands=[], ), Command(indent=2, name=None, values=["datacell"], attrs={}, commands=[]),