Repository: flet-dev/flet
Issue category: Bug Report

Using `ft.colors.with_opacity` returns exception, should be warning 
### Duplicate Check

- [X] I have searched the [opened issues](https://github.com/flet-dev/flet/issues) and there are no duplicates

### Describe the bug

This code used to work before:
```
tooltip_bgcolor=ft.Colors.with_opacity(0.5, ft.Colors.GREY_300)
```
Now it returns exception:

ERROR:asyncio:Future exception was never retrieved
future: <Future finished exception=TypeError("'<=' not supported between instances of 'int' and 'Colors'")>
Traceback (most recent call last):
  File "/Users/inesa/.pyenv/versions/3.12.6/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/Library/Caches/pypoetry/virtualenvs/controls-gallery-WumZyC-d-py3.12/lib/python3.12/site-packages/flet/core/page.py", line 944, in wrapper
    handler(*args)
  File "/Users/inesa/projects/flet-dev/examples/python/apps/controls-gallery/main.py", line 36, in route_change
    gallery_view.display_control_examples(route_list[0], route_list[1])
  File "/Users/inesa/projects/flet-dev/examples/python/apps/controls-gallery/components/gallery_view.py", line 30, in display_control_examples
    self.examples_view.display(
  File "/Users/inesa/projects/flet-dev/examples/python/apps/controls-gallery/components/examples_view.py", line 55, in display
    content=example.example(),
            ^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/examples/python/apps/controls-gallery/examples/charts/barchart/01_barchart_1.py", line 87, in example
    tooltip_bgcolor=ft.colors.with_opacity(0.5, ft.Colors.GREY_300),
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/Library/Caches/pypoetry/virtualenvs/controls-gallery-WumZyC-d-py3.12/lib/python3.12/site-packages/flet/core/colors.py", line 60, in with_opacity
    assert 0 <= opacity <= 1, "opacity must be between 0 and 1"

### Code sample

<details open><summary>Code</summary>

```python
import flet as ft

def main(page: ft.Page):
    chart = ft.BarChart(
        bar_groups=[
            ft.BarChartGroup(
                x=0,
                bar_rods=[
                    ft.BarChartRod(
                        from_y=0,
                        to_y=40,
                        width=40,
                        color=ft.colors.AMBER,
                        tooltip="Apple",
                        border_radius=0,
                    ),
                ],
            ),
            ft.BarChartGroup(
                x=1,
                bar_rods=[
                    ft.BarChartRod(
                        from_y=0,
                        to_y=100,
                        width=40,
                        color=ft.colors.BLUE,
                        tooltip="Blueberry",
                        border_radius=0,
                    ),
                ],
            ),
            ft.BarChartGroup(
                x=2,
                bar_rods=[
                    ft.BarChartRod(
                        from_y=0,
                        to_y=30,
                        width=40,
                        color=ft.colors.RED,
                        tooltip="Cherry",
                        border_radius=0,
                    ),
                ],
            ),
            ft.BarChartGroup(
                x=3,
                bar_rods=[
                    ft.BarChartRod(
                        from_y=0,
                        to_y=60,
                        width=40,
                        color=ft.colors.ORANGE,
                        tooltip="Orange",
                        border_radius=0,
                    ),
                ],
            ),
        ],
        border=ft.border.all(1, ft.colors.GREY_400),
        left_axis=ft.ChartAxis(
            labels_size=40, title=ft.Text("Fruit supply"), title_size=40
        ),
        bottom_axis=ft.ChartAxis(
            labels=[
                ft.ChartAxisLabel(
                    value=0, label=ft.Container(ft.Text("Apple"), padding=10)
                ),
                ft.ChartAxisLabel(
                    value=1, label=ft.Container(ft.Text("Blueberry"), padding=10)
                ),
                ft.ChartAxisLabel(
                    value=2, label=ft.Container(ft.Text("Cherry"), padding=10)
                ),
                ft.ChartAxisLabel(
                    value=3, label=ft.Container(ft.Text("Orange"), padding=10)
                ),
            ],
            labels_size=40,
        ),
        horizontal_grid_lines=ft.ChartGridLines(
            color=ft.colors.GREY_300, width=1, dash_pattern=[3, 3]
        ),
        tooltip_bgcolor=ft.colors.with_opacity(0.5, ft.colors.GREY_300),
        max_y=110,
        interactive=True,
        expand=True,
    )

    page.add(chart)

ft.app(main)
```

</details>


### To reproduce

Run the repro code -> BarChart is not displayed, error in in log:
Unhandled error processing page session : Traceback (most recent call last):
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/app.py", line 247, in on_session_created
    await asyncio.get_running_loop().run_in_executor(
  File "/Users/inesa/.pyenv/versions/3.12.6/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/playground/bar_chart_test.py", line 84, in main
    tooltip_bgcolor=ft.colors.with_opacity(0.5, ft.colors.GREY_300),
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/colors.py", line 60, in with_opacity
    assert 0 <= opacity <= 1, "opacity must be between 0 and 1"
           ^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'int' and 'colors`

### Expected behavior

Expected to see a warning

### Screenshots / Videos

<details open>
<summary>Captures</summary>

[Upload media here]

</details>


### Operating System

macOS

### Operating system details

15

### Flet version

0.25.0.dev3679

### Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

### Suggestions

_No response_

### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Additional details

_No response_


Functions to edit:
sdk/python/packages/flet/src/flet/core/colors.py:colors.with_opacity
sdk/python/packages/flet/src/flet/core/colors.py:colors
sdk/python/packages/flet/src/flet/core/colors.py:Colors.with_opacity
sdk/python/packages/flet/src/flet/core/colors.py:Colors
Functions added: sdk/python/packages/flet/src/flet/core/colors.py:colors

Patch:
diff --git a/sdk/python/packages/flet/src/flet/core/colors.py b/sdk/python/packages/flet/src/flet/core/colors.py
index 0fb695878..66b4293e8 100644
--- a/sdk/python/packages/flet/src/flet/core/colors.py
+++ b/sdk/python/packages/flet/src/flet/core/colors.py
@@ -37,9 +37,12 @@
 
 import random
 from enum import Enum, EnumMeta
-from typing import Dict, List, Optional, Union
+from typing import TYPE_CHECKING, Dict, List, Optional, Union
 from warnings import warn
 
+if TYPE_CHECKING:
+    from flet.core.types import ColorValue
+
 from flet.utils import deprecated
 
 
@@ -56,9 +59,16 @@ def __getattribute__(self, item):
 
 
 class colors(str, Enum, metaclass=ColorsDeprecated):
-    def with_opacity(self, opacity: Union[int, float]) -> str:
+    @staticmethod
+    @deprecated(
+        reason="Use Colors.with_opacity() method instead.",
+        version="0.25.0",
+        delete_version="0.28.0",
+    )
+    def with_opacity(opacity: Union[int, float], color: "ColorValue") -> str:
         assert 0 <= opacity <= 1, "opacity must be between 0 and 1"
-        return f"{self.value},{opacity}"
+        color_str = color.value if isinstance(color, Enum) else color
+        return f"{color_str},{opacity}"
 
     @staticmethod
     def random():
@@ -416,21 +426,11 @@ def random_color():
 
 
 class Colors(str, Enum):
-    def with_opacity(self, opacity: Union[int, float]) -> str:
-        """
-        Returns the color with the specified opacity.
-
-        Args:
-            opacity: The opacity value, which must be between 0 and 1.
-
-        Returns:
-            A string representing the color value with the specified opacity appended.
-
-        Raises:
-            AssertionError: If the opacity is not between 0 and 1 (inclusive).
-        """
+    @staticmethod
+    def with_opacity(opacity: Union[int, float], color: "ColorValue") -> str:
         assert 0 <= opacity <= 1, "opacity must be between 0 and 1"
-        return f"{self.value},{opacity}"
+        color_str = color.value if isinstance(color, Enum) else color
+        return f"{color_str},{opacity}"
 
     @staticmethod
     def random(