Skip to content

Commit 2650b25

Browse files
committed
Fix list handling for Uint8List and update canvas tests
Updated Control model to avoid treating Uint8List as a generic list. Refactored matplotlib chart examples for consistent import style. Added and updated integration tests and golden images for canvas, including a new test for drawing images from bytes. Also enabled the test for Image control with src_bytes.
1 parent 151309d commit 2650b25

File tree

17 files changed

+26
-10
lines changed

17 files changed

+26
-10
lines changed

packages/flet/lib/src/models/control.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ class Control extends ChangeNotifier {
435435
MapEntry(key, _transformIfControl(entryValue, parent, backend)),
436436
);
437437
}
438-
if (value is List) {
438+
if (value is List && value is! Uint8List) {
439439
return value
440440
.map((element) => _transformIfControl(element, parent, backend))
441441
.toList(growable: true);

sdk/python/examples/controls/charts/matplotlib_chart/3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import logging
22

3-
import flet_charts
43
import matplotlib.pyplot as plt
54
import numpy as np
65

76
import flet as ft
7+
import flet_charts
88

99
logging.basicConfig(level=logging.INFO)
1010

sdk/python/examples/controls/charts/matplotlib_chart/animate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import logging
22

3-
import flet_charts
43
import matplotlib.pyplot as plt
54
import numpy as np
65

76
import flet as ft
7+
import flet_charts
88

99
logging.basicConfig(level=logging.INFO)
1010

sdk/python/examples/controls/charts/matplotlib_chart/bar_chart.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import flet_charts as fch
2-
import matplotlib
31
import matplotlib.pyplot as plt
42

53
import flet as ft
4+
import flet_charts as fch
65

76

87
def main(page: ft.Page):

sdk/python/examples/controls/charts/matplotlib_chart/handle_events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import flet_charts
21
import matplotlib.pyplot as plt
32
import numpy as np
43

54
import flet as ft
5+
import flet_charts
66

77
state = {}
88

@@ -86,7 +86,7 @@ def update(self):
8686
self.selected.set_visible(True)
8787
self.selected.set_data([xs[dataind]], [ys[dataind]])
8888

89-
self.text.set_text("selected: %d" % dataind)
89+
self.text.set_text(f"selected: {dataind:d}")
9090
fig.canvas.draw()
9191

9292
browser = PointBrowser()

sdk/python/examples/controls/charts/matplotlib_chart/toolbar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import flet_charts as fch
2-
import matplotlib
31
import matplotlib.pyplot as plt
42
import numpy as np
53

64
import flet as ft
5+
import flet_charts as fch
76

87

98
def main(page: ft.Page):
-27 Bytes
Loading
-42 Bytes
Loading
1.84 KB
Loading
-335 Bytes
Loading

0 commit comments

Comments
 (0)