Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare Flet 0.25.2 #4541

Merged
merged 18 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
8 changes: 7 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ for:
provider: GitHub
auth_token: $(GITHUB_TOKEN)
release: $(APPVEYOR_REPO_TAG_NAME)
artifact: flet_windows
on:
APPVEYOR_REPO_TAG: true

Expand Down Expand Up @@ -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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 13 additions & 0 deletions packages/flet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions packages/flet/lib/src/controls/barchart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,8 @@ class _BarChartControlState extends State<BarChartControl> {
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();
Expand Down
2 changes: 1 addition & 1 deletion packages/flet/lib/src/controls/dismissible.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _DismissibleControlState extends State<DismissibleControl> {
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 {
Expand Down
5 changes: 1 addition & 4 deletions packages/flet/lib/src/controls/segmented_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class _SegmentedButtonControlState extends State<SegmentedButtonControl>
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)));
Expand Down Expand Up @@ -124,9 +123,7 @@ class _SegmentedButtonControlState extends State<SegmentedButtonControl>
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)
Expand Down
4 changes: 3 additions & 1 deletion packages/flet/lib/src/utils/form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
42 changes: 21 additions & 21 deletions packages/flet/lib/src/utils/material_state.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:collection';
import 'package:flutter/material.dart';

WidgetStateProperty<T?>? getWidgetStateProperty<T>(
Expand All @@ -8,43 +9,42 @@ WidgetStateProperty<T?>? getWidgetStateProperty<T>(
}
var j = jsonDictValue;
if (j is! Map<String, dynamic>) {
j = {"": j};
j = {"default": j};
}
return WidgetStateFromJSON(j, converterFromJson, defaultValue);
}

class WidgetStateFromJSON<T> extends WidgetStateProperty<T?> {
late final Map<String, T> _states;
late final LinkedHashMap<String, T> _states;
late final T? _defaultValue;

WidgetStateFromJSON(Map<String, dynamic>? 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<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));
}) ??
{},
);
}

@override
T? resolve(Set<WidgetState> 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;
}
}
2 changes: 1 addition & 1 deletion packages/flet/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_ads/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_ads/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_audio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_audio/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_audio_recorder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_audio_recorder/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_flashlight/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_flashlight/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_geolocator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_geolocator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_lottie/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_lottie/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_map/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
8 changes: 5 additions & 3 deletions packages/flet_map/lib/src/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ class _MapControlState extends State<MapControl>
.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())!;

Expand All @@ -76,7 +78,7 @@ class _MapControlState extends State<MapControl>
if (degree != null) {
_animatedMapController.animatedRotateFrom(
degree,
curve: parseCurve(args["curve"]) ?? defaultAnimationCurve,
curve: parseCurve(args["curve"], defaultAnimationCurve),
);
}
case "reset_rotation":
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_map/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_permission_handler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_permission_handler/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_rive/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_rive/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_video/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_video/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions packages/flet_webview/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.25.2

Version follows parent `flet` package.

# 0.25.1

Version follows parent `flet` package.
Expand Down
2 changes: 1 addition & 1 deletion packages/flet_webview/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading