Skip to content

Commit 414cf65

Browse files
authored
Remove Flet v0.25 deprecations (#5155)
* py end * dart end * expose more types
1 parent 33ef997 commit 414cf65

File tree

17 files changed

+51
-11234
lines changed

17 files changed

+51
-11234
lines changed

packages/flet/lib/src/controls/cupertino_navigation_bar.dart

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class _CupertinoNavigationBarControlState
5858
}
5959
var navBar = withControls(
6060
widget.children
61-
.where((c) => c.isVisible && c.name == null)
61+
.where((c) => c.isVisible)
6262
.map((c) => c.id), (content, viewModel) {
6363
return CupertinoTabBar(
6464
backgroundColor: widget.control.attrColor("bgColor", context),
@@ -75,24 +75,10 @@ class _CupertinoNavigationBarControlState
7575
var iconStr = parseIcon(destView.control.attrString("icon"));
7676
var iconCtrls =
7777
destView.children.where((c) => c.name == "icon" && c.isVisible);
78-
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
79-
// the line below needs to be deleted after icon_content is deprecated
80-
iconCtrls = iconCtrls.isEmpty
81-
? destView.children
82-
.where((c) => c.name == "icon_content" && c.isVisible)
83-
: iconCtrls;
84-
8578
var selectedIconStr =
8679
parseIcon(destView.control.attrString("selectedIcon"));
8780
var selectedIconCtrls = destView.children
8881
.where((c) => c.name == "selected_icon" && c.isVisible);
89-
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
90-
// the line below needs to be deleted after selected_icon_content is deprecated
91-
selectedIconCtrls = selectedIconCtrls.isEmpty
92-
? destView.children.where(
93-
(c) => c.name == "selected_icon_content" && c.isVisible)
94-
: selectedIconCtrls;
95-
9682
var destinationDisabled = disabled || destView.control.isDisabled;
9783
var destinationTooltip = destView.control.attrString("tooltip");
9884
return BottomNavigationBarItem(

packages/flet/lib/src/controls/navigation_bar.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,10 @@ class _NavigationBarControlState extends State<NavigationBarControl>
9999
var iconStr = parseIcon(destView.control.attrString("icon"));
100100
var iconCtrls = destView.children
101101
.where((c) => c.name == "icon" && c.isVisible);
102-
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
103-
// the line below needs to be deleted after icon_content is deprecated
104-
iconCtrls = iconCtrls.isEmpty
105-
? destView.children
106-
.where((c) => c.name == "icon_content" && c.isVisible)
107-
: iconCtrls;
108102
var selectedIconStr =
109103
parseIcon(destView.control.attrString("selectedIcon"));
110104
var selectedIconCtrls = destView.children
111105
.where((c) => c.name == "selected_icon" && c.isVisible);
112-
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
113-
// the line below needs to be deleted after selected_icon_content is deprecated
114-
selectedIconCtrls = selectedIconCtrls.isEmpty
115-
? destView.children.where(
116-
(c) => c.name == "selected_icon_content" && c.isVisible)
117-
: selectedIconCtrls;
118106
var destinationDisabled = disabled || destView.control.isDisabled;
119107
var destinationAdaptive = destView.control.isAdaptive ?? adaptive;
120108
var destinationTooltip = destView.control.attrString("tooltip");

packages/flet/lib/src/controls/navigation_drawer.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,11 @@ class _NavigationDrawerControlState extends State<NavigationDrawerControl>
6363
var iconStr = parseIcon(destView.control.attrString("icon"));
6464
var iconCtrls = destView.children
6565
.where((c) => c.name == "icon" && c.isVisible);
66-
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
67-
// the line below needs to be deleted after icon_content is deprecated
68-
iconCtrls = iconCtrls.isEmpty? destView.children
69-
.where((c) => c.name == "icon_content" && c.isVisible) : iconCtrls;
7066

7167
var selectedIconStr =
7268
parseIcon(destView.control.attrString("selectedIcon"));
7369
var selectedIconCtrls = destView.children
7470
.where((c) => c.name == "selected_icon" && c.isVisible);
75-
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
76-
// the line below needs to be deleted after selected_icon_content is deprecated
77-
selectedIconCtrls = selectedIconCtrls.isEmpty? destView.children
78-
.where((c) => c.name == "selected_icon_content" && c.isVisible): selectedIconCtrls;
7971
return NavigationDrawerDestination(
8072
enabled: !(disabled || destView.control.isDisabled),
8173
backgroundColor: destView.control.attrColor("bgColor", context),

packages/flet/lib/src/controls/navigation_rail.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,10 @@ class _NavigationRailControlState extends State<NavigationRailControl>
123123
var iconStr = parseIcon(destView.control.attrString("icon"));
124124
var iconCtrls = destView.children
125125
.where((c) => c.name == "icon" && c.isVisible);
126-
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
127-
// the line below needs to be deleted after icon_content is deprecated
128-
iconCtrls = iconCtrls.isEmpty? destView.children
129-
.where((c) => c.name == "icon_content" && c.isVisible) : iconCtrls;
130-
131126
var selectedIconStr =
132127
parseIcon(destView.control.attrString("selectedIcon"));
133128
var selectedIconCtrls = destView.children
134129
.where((c) => c.name == "selected_icon" && c.isVisible);
135-
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
136-
// the line below needs to be deleted after selected_icon_content is deprecated
137-
selectedIconCtrls = selectedIconCtrls.isEmpty? destView.children
138-
.where((c) => c.name == "selected_icon_content" && c.isVisible): selectedIconCtrls;
139-
140130
return NavigationRailDestination(
141131
disabled: disabled || destView.control.isDisabled,
142132
padding: parseEdgeInsets(destView.control, "padding"),

sdk/python/packages/flet/src/flet/__init__.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
11
from flet.app import app, app_async
2-
from flet.core import (
3-
ads,
4-
alignment,
5-
animation,
6-
audio,
7-
border,
8-
border_radius,
9-
colors,
10-
cupertino_colors,
11-
cupertino_icons,
12-
dropdown,
13-
dropdownm2,
14-
icons,
15-
margin,
16-
padding,
17-
painting,
18-
size,
19-
transform,
20-
)
212
from flet.core.adaptive_control import AdaptiveControl
223
from flet.core.alert_dialog import AlertDialog
234
from flet.core.alignment import Alignment, Axis
@@ -97,7 +78,7 @@
9778
from flet.core.checkbox import Checkbox
9879
from flet.core.chip import Chip
9980
from flet.core.circle_avatar import CircleAvatar
100-
from flet.core.colors import Colors, colors
81+
from flet.core.colors import Colors
10182
from flet.core.column import Column
10283
from flet.core.container import Container, ContainerTapEvent
10384
from flet.core.control import Control
@@ -110,7 +91,7 @@
11091
from flet.core.cupertino_bottom_sheet import CupertinoBottomSheet
11192
from flet.core.cupertino_button import CupertinoButton
11293
from flet.core.cupertino_checkbox import CupertinoCheckbox
113-
from flet.core.cupertino_colors import CupertinoColors, cupertino_colors
94+
from flet.core.cupertino_colors import CupertinoColors
11495
from flet.core.cupertino_context_menu import CupertinoContextMenu
11596
from flet.core.cupertino_context_menu_action import CupertinoContextMenuAction
11697
from flet.core.cupertino_date_picker import (
@@ -120,7 +101,7 @@
120101
)
121102
from flet.core.cupertino_dialog_action import CupertinoDialogAction
122103
from flet.core.cupertino_filled_button import CupertinoFilledButton
123-
from flet.core.cupertino_icons import CupertinoIcons, cupertino_icons
104+
from flet.core.cupertino_icons import CupertinoIcons
124105
from flet.core.cupertino_list_tile import CupertinoListTile
125106
from flet.core.cupertino_navigation_bar import CupertinoNavigationBar
126107
from flet.core.cupertino_picker import CupertinoPicker
@@ -215,7 +196,7 @@
215196
from flet.core.haptic_feedback import HapticFeedback
216197
from flet.core.icon import Icon
217198
from flet.core.icon_button import IconButton
218-
from flet.core.icons import Icons, icons
199+
from flet.core.icons import Icons
219200
from flet.core.image import Image
220201
from flet.core.interactive_viewer import (
221202
InteractiveViewer,
@@ -232,8 +213,6 @@
232213
MarkdownCodeTheme,
233214
MarkdownCustomCodeTheme,
234215
MarkdownExtensionSet,
235-
MarkdownSelectionChangeCause,
236-
MarkdownSelectionChangeEvent,
237216
MarkdownStyleSheet,
238217
)
239218
from flet.core.menu_bar import MenuBar, MenuStyle
@@ -400,28 +379,47 @@
400379
AppLifecycleState,
401380
AppView,
402381
BlendMode,
382+
BorderRadiusValue,
403383
Brightness,
404384
ClipBehavior,
385+
ColorEnums,
386+
ColorValue,
387+
ControlEventType,
405388
ControlState,
389+
ControlStateValue,
406390
CrossAxisAlignment,
391+
DateTimeValue,
407392
Duration,
393+
DurationValue,
394+
EventType,
408395
FloatingActionButtonLocation,
409396
FontWeight,
397+
IconEnums,
398+
IconValue,
399+
IconValueOrControl,
410400
ImageFit,
411401
ImageRepeat,
412402
LabelPosition,
413403
Locale,
414404
LocaleConfiguration,
415405
MainAxisAlignment,
406+
MarginValue,
416407
MouseCursor,
417408
NotchShape,
418409
Number,
410+
OffsetValue,
419411
OnFocusEvent,
412+
OptionalControlEventCallable,
420413
OptionalEventCallable,
421414
OptionalNumber,
415+
OptionalString,
422416
Orientation,
423417
PaddingValue,
424418
PagePlatform,
419+
PointerDeviceType,
420+
ResponsiveNumber,
421+
RotateValue,
422+
ScaleValue,
425423
ScrollMode,
426424
StrokeCap,
427425
StrokeJoin,

0 commit comments

Comments
 (0)