flet 0.70.0.dev5774__py3-none-any.whl → 0.70.0.dev5835__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flet might be problematic. Click here for more details.

Files changed (96) hide show
  1. flet/__init__.py +32 -4
  2. flet/components/__init__.py +0 -0
  3. flet/components/component.py +346 -0
  4. flet/components/component_decorator.py +24 -0
  5. flet/components/component_owned.py +22 -0
  6. flet/components/hooks/__init__.py +0 -0
  7. flet/components/hooks/hook.py +12 -0
  8. flet/components/hooks/use_callback.py +28 -0
  9. flet/components/hooks/use_context.py +91 -0
  10. flet/components/hooks/use_effect.py +104 -0
  11. flet/components/hooks/use_memo.py +52 -0
  12. flet/components/hooks/use_state.py +58 -0
  13. flet/components/memo.py +34 -0
  14. flet/components/observable.py +269 -0
  15. flet/components/public_utils.py +10 -0
  16. flet/components/utils.py +85 -0
  17. flet/controls/base_control.py +34 -10
  18. flet/controls/base_page.py +44 -40
  19. flet/controls/context.py +22 -1
  20. flet/controls/control.py +12 -6
  21. flet/controls/control_event.py +19 -2
  22. flet/controls/core/animated_switcher.py +3 -2
  23. flet/controls/core/autofill_group.py +6 -2
  24. flet/controls/core/column.py +5 -0
  25. flet/controls/core/dismissible.py +12 -10
  26. flet/controls/core/drag_target.py +20 -10
  27. flet/controls/core/draggable.py +9 -9
  28. flet/controls/core/icon.py +16 -12
  29. flet/controls/core/interactive_viewer.py +24 -23
  30. flet/controls/core/pagelet.py +3 -2
  31. flet/controls/core/reorderable_draggable.py +3 -2
  32. flet/controls/core/row.py +5 -0
  33. flet/controls/core/safe_area.py +3 -2
  34. flet/controls/core/text_span.py +5 -3
  35. flet/controls/core/view.py +6 -6
  36. flet/controls/core/window_drag_area.py +3 -2
  37. flet/controls/cupertino/cupertino_action_sheet.py +10 -5
  38. flet/controls/cupertino/cupertino_action_sheet_action.py +3 -4
  39. flet/controls/cupertino/cupertino_activity_indicator.py +4 -3
  40. flet/controls/cupertino/cupertino_alert_dialog.py +6 -3
  41. flet/controls/cupertino/cupertino_button.py +6 -5
  42. flet/controls/cupertino/cupertino_context_menu.py +8 -4
  43. flet/controls/cupertino/cupertino_context_menu_action.py +3 -4
  44. flet/controls/cupertino/cupertino_date_picker.py +44 -28
  45. flet/controls/cupertino/cupertino_dialog_action.py +3 -4
  46. flet/controls/cupertino/cupertino_list_tile.py +3 -4
  47. flet/controls/cupertino/cupertino_navigation_bar.py +6 -5
  48. flet/controls/cupertino/cupertino_picker.py +14 -10
  49. flet/controls/cupertino/cupertino_segmented_button.py +6 -5
  50. flet/controls/cupertino/cupertino_slider.py +16 -12
  51. flet/controls/cupertino/cupertino_sliding_segmented_button.py +6 -5
  52. flet/controls/cupertino/cupertino_timer_picker.py +38 -31
  53. flet/controls/id_counter.py +24 -0
  54. flet/controls/material/alert_dialog.py +6 -5
  55. flet/controls/material/app_bar.py +17 -14
  56. flet/controls/material/banner.py +13 -11
  57. flet/controls/material/bottom_app_bar.py +5 -4
  58. flet/controls/material/bottom_sheet.py +5 -4
  59. flet/controls/material/button.py +12 -4
  60. flet/controls/material/chip.py +13 -12
  61. flet/controls/material/circle_avatar.py +17 -13
  62. flet/controls/material/datatable.py +48 -41
  63. flet/controls/material/divider.py +30 -14
  64. flet/controls/material/dropdown.py +5 -3
  65. flet/controls/material/expansion_tile.py +11 -22
  66. flet/controls/material/floating_action_button.py +32 -23
  67. flet/controls/material/icon_button.py +7 -3
  68. flet/controls/material/navigation_rail.py +14 -11
  69. flet/controls/material/outlined_button.py +7 -3
  70. flet/controls/material/progress_bar.py +18 -10
  71. flet/controls/material/radio_group.py +5 -1
  72. flet/controls/material/range_slider.py +13 -13
  73. flet/controls/material/segmented_button.py +21 -17
  74. flet/controls/material/selection_area.py +3 -2
  75. flet/controls/material/slider.py +16 -12
  76. flet/controls/material/snack_bar.py +18 -10
  77. flet/controls/material/switch.py +6 -5
  78. flet/controls/material/tabs.py +18 -14
  79. flet/controls/material/textfield.py +32 -15
  80. flet/controls/material/vertical_divider.py +20 -12
  81. flet/controls/object_patch.py +434 -197
  82. flet/controls/page.py +205 -85
  83. flet/controls/services/haptic_feedback.py +0 -3
  84. flet/controls/services/shake_detector.py +0 -3
  85. flet/messaging/flet_socket_server.py +13 -6
  86. flet/messaging/session.py +103 -10
  87. flet/{controls/session_storage.py → messaging/session_store.py} +2 -2
  88. flet/version.py +1 -1
  89. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/METADATA +5 -5
  90. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/RECORD +93 -80
  91. flet/controls/cache.py +0 -87
  92. flet/controls/control_id.py +0 -22
  93. flet/controls/core/state_view.py +0 -60
  94. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/WHEEL +0 -0
  95. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/entry_points.txt +0 -0
  96. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ from enum import Enum
3
3
  from typing import Optional, Union
4
4
 
5
5
  from flet.controls.adaptive_control import AdaptiveControl
6
- from flet.controls.base_control import control
6
+ from flet.controls.base_control import BaseControl, control
7
7
  from flet.controls.control_event import ControlEventHandler
8
8
  from flet.controls.core.autofill_group import AutofillHint
9
9
  from flet.controls.material.form_field_control import FormFieldControl
@@ -133,6 +133,12 @@ class TextField(FormFieldControl, AdaptiveControl):
133
133
  """
134
134
  A text field lets the user enter text, either with hardware keyboard or with an
135
135
  onscreen keyboard.
136
+
137
+ Raises:
138
+ ValueError: If [`min_lines`][(c).] is not positive.
139
+ ValueError: If [`max_lines`][(c).] is not positive.
140
+ ValueError: If [`min_lines`][(c).] is greater than [`max_lines`][(c).].
141
+ ValueError: If [`max_length`][(c).] is not -1 or positive.
136
142
  """
137
143
 
138
144
  value: str = ""
@@ -418,22 +424,33 @@ class TextField(FormFieldControl, AdaptiveControl):
418
424
  TBD
419
425
  """
420
426
 
427
+ def _migrate_state(self, other: BaseControl):
428
+ super()._migrate_state(other)
429
+ if (
430
+ isinstance(other, TextField)
431
+ and self.value is None
432
+ and self.value != other.value
433
+ ):
434
+ self.value = other.value
435
+
421
436
  def before_update(self):
422
437
  super().before_update()
423
- assert self.min_lines is None or self.min_lines > 0, (
424
- "min_lines must be greater than 0"
425
- )
426
- assert self.max_lines is None or self.max_lines > 0, (
427
- "min_lines must be greater than 0"
428
- )
429
- assert (
430
- self.max_lines is None
431
- or self.min_lines is None
432
- or self.min_lines <= self.max_lines
433
- ), "min_lines can't be greater than max_lines"
434
- assert (
435
- self.max_length is None or self.max_length == -1 or self.max_length > 0
436
- ), "max_length must be either equal to -1 or greater than 0"
438
+ if self.min_lines is not None and self.min_lines <= 0:
439
+ raise ValueError("min_lines must be greater than 0")
440
+ if self.max_lines is not None and self.max_lines <= 0:
441
+ raise ValueError("max_lines must be greater than 0")
442
+ if (
443
+ self.max_lines is not None
444
+ and self.min_lines is not None
445
+ and self.min_lines > self.max_lines
446
+ ):
447
+ raise ValueError("min_lines can't be greater than max_lines")
448
+ if (
449
+ self.max_length is not None
450
+ and self.max_length != -1
451
+ and self.max_length <= 0
452
+ ):
453
+ raise ValueError("max_length must be either equal to -1 or greater than 0")
437
454
  if (
438
455
  self.bgcolor is not None
439
456
  or self.fill_color is not None
@@ -1,6 +1,7 @@
1
1
  from typing import Optional
2
2
 
3
3
  from flet.controls.base_control import control
4
+ from flet.controls.border_radius import BorderRadiusValue
4
5
  from flet.controls.control import Control
5
6
  from flet.controls.types import ColorValue, Number
6
7
 
@@ -13,6 +14,12 @@ class VerticalDivider(Control):
13
14
  A thin vertical line, with padding on either side.
14
15
 
15
16
  In the material design language, this represents a divider.
17
+
18
+ Raises:
19
+ ValueError: If [`width`][(c).] is negative.
20
+ ValueError: If [`thickness`][(c).] is negative.
21
+ ValueError: If [`leading_indent`][(c).] is negative.
22
+ ValueError: If [`trailing_indent`][(c).] is negative.
16
23
  """
17
24
 
18
25
  width: Optional[Number] = None
@@ -61,17 +68,18 @@ class VerticalDivider(Control):
61
68
  If that's is also `None`, defaults to `0.0`.
62
69
  """
63
70
 
71
+ radius: Optional[BorderRadiusValue] = None
72
+ """
73
+ The border radius of the divider.
74
+ """
75
+
64
76
  def before_update(self):
65
77
  super().before_update()
66
- assert self.width is None or self.width >= 0, (
67
- "width must be greater than or equal to 0"
68
- )
69
- assert self.thickness is None or self.thickness >= 0, (
70
- "thickness must be greater than or equal to 0"
71
- )
72
- assert self.leading_indent is None or self.leading_indent >= 0, (
73
- "leading_indent must be greater than or equal to 0"
74
- )
75
- assert self.trailing_indent is None or self.trailing_indent >= 0, (
76
- "trailing_indent must be greater than or equal to 0"
77
- )
78
+ if self.width is not None and self.width < 0:
79
+ raise ValueError("width must be greater than or equal to 0")
80
+ if self.thickness is not None and self.thickness < 0:
81
+ raise ValueError("thickness must be greater than or equal to 0")
82
+ if self.leading_indent is not None and self.leading_indent < 0:
83
+ raise ValueError("leading_indent must be greater than or equal to 0")
84
+ if self.trailing_indent is not None and self.trailing_indent < 0:
85
+ raise ValueError("trailing_indent must be greater than or equal to 0")