Skip to content

Commit 562dde9

Browse files
Fixes for Flet 0.7.1 (#1393)
* Fix button styles crashing UI Fix #1390 * Bump Flet version to 0.7.1
1 parent 46c522c commit 562dde9

File tree

12 files changed

+29
-10
lines changed

12 files changed

+29
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Flet changelog
22

3+
## 0.7.1
4+
5+
* `ButtonStyle` with `shape` or `side` params failed in flet 0.7.0 ([#1390](https://github.com/flet-dev/flet/issues/1390)).
6+
37
## 0.7.0
48

59
* Programmatically [control scroll position](https://flet.dev/blog/scrolling-controls-and-theming#controlling-scroll-position) and subscribe to [scrolling notifications](https://flet.dev/blog/scrolling-controls-and-theming#receiving-scroll-notifications) in Page, View, Column, Row, ListView and GridView controls.

client/lib/main.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ void main([List<String>? args]) async {
2020
//debugPrint("Uri.base: ${Uri.base}");
2121

2222
if (kDebugMode) {
23-
if (kIsWeb) {
24-
pageUrl = "http://localhost:8550";
25-
} else {
26-
pageUrl = "tcp://localhost:8550";
27-
}
23+
pageUrl = "http://localhost:8550";
2824
}
2925

3026
if (kIsWeb) {

client/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ packages:
175175
path: "../package"
176176
relative: true
177177
source: path
178-
version: "0.7.0"
178+
version: "0.7.1"
179179
flutter:
180180
dependency: "direct main"
181181
description: flutter

package/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.1
2+
3+
* `ButtonStyle` with `shape` or `side` params failed in flet 0.7.0 ([#1390](https://github.com/flet-dev/flet/issues/1390)).
4+
15
## 0.7.0
26

37
* Programmatically [control scroll position](https://flet.dev/blog/scrolling-controls-and-theming#controlling-scroll-position) and subscribe to [scrolling notifications](https://flet.dev/blog/scrolling-controls-and-theming#receiving-scroll-notifications) in Page, View, Column, Row, ListView and GridView controls.

package/lib/src/utils/material_state.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ import 'package:flutter/material.dart';
22

33
MaterialStateProperty<T?>? getMaterialStateProperty<T>(dynamic jsonDictValue,
44
T Function(dynamic) converterFromJson, T defaultValue) {
5-
debugPrint("jsonDictValue: $jsonDictValue");
65
if (jsonDictValue == null) {
76
return null;
87
}
98
var j = jsonDictValue;
109
if (j is! Map<String, dynamic>) {
1110
j = {"": j};
12-
debugPrint("jsonDictValue DICT: $j");
1311
}
1412
return MaterialStateFromJSON(j, converterFromJson, defaultValue);
1513
}

package/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: flet
22
description: Write entire Flutter app in Python or add server-driven UI experience into existing Flutter app.
33
homepage: https://flet.dev
44
repository: https://github.com/flet-dev/flet
5-
version: 0.7.0
5+
version: 0.7.1
66

77
# This package supports all platforms listed below.
88
platforms:

sdk/python/packages/flet-core/src/flet_core/control.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ def _convert_attr_json(self, value):
145145
else None
146146
)
147147

148+
def _wrap_attr_dict(self, value):
149+
if value is None or isinstance(value, Dict):
150+
return value
151+
return {"": value}
152+
148153
def __str__(self):
149154
attrs = {}
150155
for k, v in self.__attrs.items():

sdk/python/packages/flet-core/src/flet_core/elevated_button.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def _before_build_command(self):
154154
self.__style.bgcolor = self.__bgcolor
155155
if self.__style.elevation != self.__elevation:
156156
self.__style.elevation = self.__elevation
157+
if self.__style is not None:
158+
self.__style.side = self._wrap_attr_dict(self.__style.side)
159+
self.__style.shape = self._wrap_attr_dict(self.__style.shape)
157160
self._set_attr_json("style", self.__style)
158161

159162
def _get_children(self):

sdk/python/packages/flet-core/src/flet_core/icon_button.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ def _get_control_name(self):
151151

152152
def _before_build_command(self):
153153
super()._before_build_command()
154+
if self.__style is not None:
155+
self.__style.side = self._wrap_attr_dict(self.__style.side)
156+
self.__style.shape = self._wrap_attr_dict(self.__style.shape)
154157
self._set_attr_json("style", self.__style)
155158

156159
def _get_children(self):

sdk/python/packages/flet-core/src/flet_core/outlined_button.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ def _get_control_name(self):
131131

132132
def _before_build_command(self):
133133
super()._before_build_command()
134+
if self.__style is not None:
135+
self.__style.side = self._wrap_attr_dict(self.__style.side)
136+
self.__style.shape = self._wrap_attr_dict(self.__style.shape)
134137
self._set_attr_json("style", self.__style)
135138

136139
def _get_children(self):

0 commit comments

Comments
 (0)