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

Remove Flet v0.25 deprecations #5155

Merged
merged 3 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 1 addition & 15 deletions packages/flet/lib/src/controls/cupertino_navigation_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _CupertinoNavigationBarControlState
}
var navBar = withControls(
widget.children
.where((c) => c.isVisible && c.name == null)
.where((c) => c.isVisible)
.map((c) => c.id), (content, viewModel) {
return CupertinoTabBar(
backgroundColor: widget.control.attrColor("bgColor", context),
Expand All @@ -75,24 +75,10 @@ class _CupertinoNavigationBarControlState
var iconStr = parseIcon(destView.control.attrString("icon"));
var iconCtrls =
destView.children.where((c) => c.name == "icon" && c.isVisible);
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
// the line below needs to be deleted after icon_content is deprecated
iconCtrls = iconCtrls.isEmpty
? destView.children
.where((c) => c.name == "icon_content" && c.isVisible)
: iconCtrls;

var selectedIconStr =
parseIcon(destView.control.attrString("selectedIcon"));
var selectedIconCtrls = destView.children
.where((c) => c.name == "selected_icon" && c.isVisible);
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
// the line below needs to be deleted after selected_icon_content is deprecated
selectedIconCtrls = selectedIconCtrls.isEmpty
? destView.children.where(
(c) => c.name == "selected_icon_content" && c.isVisible)
: selectedIconCtrls;

var destinationDisabled = disabled || destView.control.isDisabled;
var destinationTooltip = destView.control.attrString("tooltip");
return BottomNavigationBarItem(
Expand Down
12 changes: 0 additions & 12 deletions packages/flet/lib/src/controls/navigation_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,10 @@ class _NavigationBarControlState extends State<NavigationBarControl>
var iconStr = parseIcon(destView.control.attrString("icon"));
var iconCtrls = destView.children
.where((c) => c.name == "icon" && c.isVisible);
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
// the line below needs to be deleted after icon_content is deprecated
iconCtrls = iconCtrls.isEmpty
? destView.children
.where((c) => c.name == "icon_content" && c.isVisible)
: iconCtrls;
var selectedIconStr =
parseIcon(destView.control.attrString("selectedIcon"));
var selectedIconCtrls = destView.children
.where((c) => c.name == "selected_icon" && c.isVisible);
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
// the line below needs to be deleted after selected_icon_content is deprecated
selectedIconCtrls = selectedIconCtrls.isEmpty
? destView.children.where(
(c) => c.name == "selected_icon_content" && c.isVisible)
: selectedIconCtrls;
var destinationDisabled = disabled || destView.control.isDisabled;
var destinationAdaptive = destView.control.isAdaptive ?? adaptive;
var destinationTooltip = destView.control.attrString("tooltip");
Expand Down
8 changes: 0 additions & 8 deletions packages/flet/lib/src/controls/navigation_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,11 @@ class _NavigationDrawerControlState extends State<NavigationDrawerControl>
var iconStr = parseIcon(destView.control.attrString("icon"));
var iconCtrls = destView.children
.where((c) => c.name == "icon" && c.isVisible);
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
// the line below needs to be deleted after icon_content is deprecated
iconCtrls = iconCtrls.isEmpty? destView.children
.where((c) => c.name == "icon_content" && c.isVisible) : iconCtrls;

var selectedIconStr =
parseIcon(destView.control.attrString("selectedIcon"));
var selectedIconCtrls = destView.children
.where((c) => c.name == "selected_icon" && c.isVisible);
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
// the line below needs to be deleted after selected_icon_content is deprecated
selectedIconCtrls = selectedIconCtrls.isEmpty? destView.children
.where((c) => c.name == "selected_icon_content" && c.isVisible): selectedIconCtrls;
return NavigationDrawerDestination(
enabled: !(disabled || destView.control.isDisabled),
backgroundColor: destView.control.attrColor("bgColor", context),
Expand Down
10 changes: 0 additions & 10 deletions packages/flet/lib/src/controls/navigation_rail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,10 @@ class _NavigationRailControlState extends State<NavigationRailControl>
var iconStr = parseIcon(destView.control.attrString("icon"));
var iconCtrls = destView.children
.where((c) => c.name == "icon" && c.isVisible);
// if no control provided in "icon" property, replace iconCtrls with control provided in icon_content, if any
// the line below needs to be deleted after icon_content is deprecated
iconCtrls = iconCtrls.isEmpty? destView.children
.where((c) => c.name == "icon_content" && c.isVisible) : iconCtrls;

var selectedIconStr =
parseIcon(destView.control.attrString("selectedIcon"));
var selectedIconCtrls = destView.children
.where((c) => c.name == "selected_icon" && c.isVisible);
// if no control provided in "selected_icon" property, replace selectedIconCtrls with control provided in selected_icon_content, if any
// the line below needs to be deleted after selected_icon_content is deprecated
selectedIconCtrls = selectedIconCtrls.isEmpty? destView.children
.where((c) => c.name == "selected_icon_content" && c.isVisible): selectedIconCtrls;

return NavigationRailDestination(
disabled: disabled || destView.control.isDisabled,
padding: parseEdgeInsets(destView.control, "padding"),
Expand Down
48 changes: 23 additions & 25 deletions sdk/python/packages/flet/src/flet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
from flet.app import app, app_async
from flet.core import (
ads,
alignment,
animation,
audio,
border,
border_radius,
colors,
cupertino_colors,
cupertino_icons,
dropdown,
dropdownm2,
icons,
margin,
padding,
painting,
size,
transform,
)
from flet.core.adaptive_control import AdaptiveControl
from flet.core.alert_dialog import AlertDialog
from flet.core.alignment import Alignment, Axis
Expand Down Expand Up @@ -97,7 +78,7 @@
from flet.core.checkbox import Checkbox
from flet.core.chip import Chip
from flet.core.circle_avatar import CircleAvatar
from flet.core.colors import Colors, colors
from flet.core.colors import Colors
from flet.core.column import Column
from flet.core.container import Container, ContainerTapEvent
from flet.core.control import Control
Expand All @@ -110,7 +91,7 @@
from flet.core.cupertino_bottom_sheet import CupertinoBottomSheet
from flet.core.cupertino_button import CupertinoButton
from flet.core.cupertino_checkbox import CupertinoCheckbox
from flet.core.cupertino_colors import CupertinoColors, cupertino_colors
from flet.core.cupertino_colors import CupertinoColors
from flet.core.cupertino_context_menu import CupertinoContextMenu
from flet.core.cupertino_context_menu_action import CupertinoContextMenuAction
from flet.core.cupertino_date_picker import (
Expand All @@ -120,7 +101,7 @@
)
from flet.core.cupertino_dialog_action import CupertinoDialogAction
from flet.core.cupertino_filled_button import CupertinoFilledButton
from flet.core.cupertino_icons import CupertinoIcons, cupertino_icons
from flet.core.cupertino_icons import CupertinoIcons
from flet.core.cupertino_list_tile import CupertinoListTile
from flet.core.cupertino_navigation_bar import CupertinoNavigationBar
from flet.core.cupertino_picker import CupertinoPicker
Expand Down Expand Up @@ -215,7 +196,7 @@
from flet.core.haptic_feedback import HapticFeedback
from flet.core.icon import Icon
from flet.core.icon_button import IconButton
from flet.core.icons import Icons, icons
from flet.core.icons import Icons
from flet.core.image import Image
from flet.core.interactive_viewer import (
InteractiveViewer,
Expand All @@ -232,8 +213,6 @@
MarkdownCodeTheme,
MarkdownCustomCodeTheme,
MarkdownExtensionSet,
MarkdownSelectionChangeCause,
MarkdownSelectionChangeEvent,
MarkdownStyleSheet,
)
from flet.core.menu_bar import MenuBar, MenuStyle
Expand Down Expand Up @@ -400,28 +379,47 @@
AppLifecycleState,
AppView,
BlendMode,
BorderRadiusValue,
Brightness,
ClipBehavior,
ColorEnums,
ColorValue,
ControlEventType,
ControlState,
ControlStateValue,
CrossAxisAlignment,
DateTimeValue,
Duration,
DurationValue,
EventType,
FloatingActionButtonLocation,
FontWeight,
IconEnums,
IconValue,
IconValueOrControl,
ImageFit,
ImageRepeat,
LabelPosition,
Locale,
LocaleConfiguration,
MainAxisAlignment,
MarginValue,
MouseCursor,
NotchShape,
Number,
OffsetValue,
OnFocusEvent,
OptionalControlEventCallable,
OptionalEventCallable,
OptionalNumber,
OptionalString,
Orientation,
PaddingValue,
PagePlatform,
PointerDeviceType,
ResponsiveNumber,
RotateValue,
ScaleValue,
ScrollMode,
StrokeCap,
StrokeJoin,
Expand Down
Loading