Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
10 changes: 5 additions & 5 deletions client/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ packages:
path: "../packages/flet"
relative: true
source: path
version: "0.83.0"
version: "0.83.1"
flet_ads:
dependency: "direct main"
description:
Expand Down Expand Up @@ -911,10 +911,10 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev"
source: hosted
version: "0.12.18"
version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
Expand Down Expand Up @@ -1628,10 +1628,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
url: "https://pub.dev"
source: hosted
version: "0.7.9"
version: "0.7.10"
torch_light:
dependency: transitive
description:
Expand Down
8 changes: 8 additions & 0 deletions packages/flet/lib/src/controls/responsive_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ class ResponsiveRowControl extends StatelessWidget with FletStoreMixin {
return withPageSize((context, view) {
var result = LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
if (!constraints.hasBoundedWidth) {
return const ErrorControl(
"Error displaying ResponsiveRow: width is unbounded.",
description:
"Set a fixed width, a non-zero expand, or place it inside a control with bounded width.",
);
}

// breakpoints
final rawBreakpoints =
control.get<Map>("breakpoints", view.breakpoints)!;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import pytest
import pytest_asyncio

import flet as ft
import flet.testing as ftt


@pytest.mark.asyncio(loop_scope="module")
# Create a new flet_app instance for each test method
@pytest_asyncio.fixture(scope="function", autouse=True)
def flet_app(flet_app_function):
return flet_app_function


@pytest.mark.asyncio(loop_scope="function")
async def test_basic(flet_app: ftt.FletTestApp, request):
await flet_app.assert_control_screenshot(
request.node.name,
Expand All @@ -30,3 +37,29 @@ async def test_basic(flet_app: ftt.FletTestApp, request):
],
),
)


@pytest.mark.asyncio(loop_scope="function")
async def test_unbounded_height(flet_app: ftt.FletTestApp, request):
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
await flet_app.assert_control_screenshot(
request.node.name,
ft.Column(
controls=[
ft.PageView(
controls=[
ft.Container(
bgcolor=ft.Colors.PURPLE,
alignment=ft.Alignment.CENTER,
content=ft.Text("One", color=ft.Colors.WHITE),
),
ft.Container(
bgcolor=ft.Colors.TEAL,
alignment=ft.Alignment.CENTER,
content=ft.Text("Two", color=ft.Colors.WHITE),
),
],
)
]
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,19 @@ async def test_cupertino_adaptive(flet_app: ftt.FletTestApp, request):
),
),
)


@pytest.mark.asyncio(loop_scope="function")
async def test_unbounded_height(flet_app: ftt.FletTestApp, request):
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
await flet_app.assert_control_screenshot(
request.node.name,
ft.Column(
controls=[
ft.Pagelet(
appbar=ft.AppBar(title="Pagelet AppBar"),
content=ft.Text("Pagelet Content"),
)
]
),
)
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import pytest
import pytest_asyncio

import flet as ft
import flet.testing as ftt


@pytest.mark.asyncio(loop_scope="module")
# Create a new flet_app instance for each test method
@pytest_asyncio.fixture(scope="function", autouse=True)
def flet_app(flet_app_function):
return flet_app_function


@pytest.mark.asyncio(loop_scope="function")
async def test_responsive_row_basic(flet_app: ftt.FletTestApp, request):
await flet_app.assert_control_screenshot(
request.node.name,
Expand All @@ -16,3 +23,21 @@ async def test_responsive_row_basic(flet_app: ftt.FletTestApp, request):
],
),
)


@pytest.mark.asyncio(loop_scope="function")
async def test_unbounded_width(flet_app: ftt.FletTestApp, request):
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
await flet_app.assert_control_screenshot(
request.node.name,
ft.Row(
controls=[
ft.ResponsiveRow(
controls=[
ft.Text("Item 1"),
ft.Text("Item 2"),
]
)
]
),
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,32 @@ async def test_no_selected_icon(flet_app: ftt.FletTestApp, request):
),
),
)


@pytest.mark.asyncio(loop_scope="function")
async def test_unbounded_height(flet_app: ftt.FletTestApp, request):
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
await flet_app.assert_control_screenshot(
request.node.name,
ft.Column(
controls=[
ft.NavigationRail(
selected_index=0,
label_type=ft.NavigationRailLabelType.ALL,
min_width=100,
destinations=[
ft.NavigationRailDestination(
icon=ft.Icons.FAVORITE_BORDER,
selected_icon=ft.Icons.FAVORITE,
label="First",
),
ft.NavigationRailDestination(
icon=ft.Icons.SETTINGS_OUTLINED,
selected_icon=ft.Icon(ft.Icons.SETTINGS),
label=ft.Text("Settings"),
),
],
)
]
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,35 @@ async def test_disabled_tabs(flet_app: ftt.FletTestApp):
await flet_app.tester.pump_and_settle()
assert tabs.selected_index == 1
assert clicked_indexes == [1]


@pytest.mark.asyncio(loop_scope="function")
async def test_unbounded_tabbarview_height(flet_app: ftt.FletTestApp, request):
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
await flet_app.assert_control_screenshot(
name=request.node.name,
control=ft.Column(
controls=[
ft.Tabs(
length=1,
content=ft.Column(
controls=[
ft.TabBar(
tabs=[
ft.Tab(label="Tab 1"),
]
),
ft.TabBarView(
controls=[
ft.Container(
content=ft.Text("Tab 1 content"),
alignment=ft.Alignment.CENTER,
)
],
),
],
),
)
]
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class NavigationRailDestination(Control):
Represents a destination in a `NavigationRail`.
"""

icon: Optional[IconDataOrControl] = None
icon: IconDataOrControl
"""
The [name of the icon](https://docs.flet.dev/types/icons) or `Control` of the \
destination.
Expand Down
Loading