Skip to content

v1: reorganize files and folders #219

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

Open
wants to merge 11 commits into
base: v1
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def list_github_repositories():
for repo in user_repos:
repos_view.controls.append(
ft.ListTile(
leading=ft.Icon(ft.icons.FOLDER_ROUNDED),
leading=ft.Icon(ft.Icons.FOLDER_ROUNDED),
title=ft.Text(repo["full_name"]),
)
)
Expand Down
4 changes: 2 additions & 2 deletions python/apps/authentication/github-oauth-with-listing-repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def list_github_repositories():
for repo in user_repos:
repos_view.controls.append(
ft.ListTile(
leading=ft.Icon(ft.icons.FOLDER_ROUNDED),
leading=ft.Icon(ft.Icons.FOLDER_ROUNDED),
title=ft.Text(repo["full_name"]),
)
)
Expand Down Expand Up @@ -96,4 +96,4 @@ def toggle_login_buttons():
page.add(ft.Row([logged_user, login_button, logout_button]), repos_view)


ft.app(main)
ft.app(main)
14 changes: 8 additions & 6 deletions python/apps/autocomplete-searcher/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@


def printer(e):
print('Yellow!')
print("Yellow!")


def main(page: ft.Page):
page.title = "Autocomplete search names"

def textbox_changed(string):
str_lower = string.control.value.lower()
list_view.controls = [
list_items.get(n) for n in NAMES if str_lower in n.lower()
] if str_lower else []
list_view.controls = (
[list_items.get(n) for n in NAMES if str_lower in n.lower()]
if str_lower
else []
)
page.update()

list_items = {
name: ft.ListTile(
title=ft.Text(name),
leading=ft.Icon(ft.icons.ACCESSIBILITY),
on_click=printer
leading=ft.Icon(ft.Icons.ACCESSIBILITY),
on_click=printer,
)
for name in NAMES
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
def example():
c1 = ft.Container(
ft.Text("Hello!", theme_style=ft.TextThemeStyle.HEADLINE_MEDIUM),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
width=200,
height=200,
bgcolor=ft.Colors.GREEN,
)
c2 = ft.Container(
ft.Text("Bye!", size=50),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
width=200,
height=200,
bgcolor=ft.Colors.YELLOW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def example():
menubar = ft.MenuBar(
expand=True,
style=ft.MenuStyle(
alignment=ft.Alignment.top_left(),
alignment=ft.Alignment.TOP_LEFT,
bgcolor=ft.Colors.RED_100,
mouse_cursor={
ft.ControlState.HOVERED: ft.MouseCursor.WAIT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def copy_to_clipboard(e):
swatch_colors.controls.append(
ft.Container(
height=50,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
bgcolor=color.name,
on_click=copy_to_clipboard,
content=ft.Text(color.display_name, weight=ft.FontWeight.W_500),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def example():
ft.Tab(
label="Tab 1",
content=ft.Container(
content=ft.Text("This is Tab 1"), alignment=ft.Alignment.center()
content=ft.Text("This is Tab 1"), alignment=ft.Alignment.CENTER
),
),
ft.Tab(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def copy_to_clipboard(e):
height=50,
bgcolor=color[1],
content=ft.Text(color[0], color=text_color),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
on_click=copy_to_clipboard,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def copy_to_clipboard(e):
height=50,
bgcolor=color.name,
content=ft.Text(color.display_name, color=text_color),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
on_click=copy_to_clipboard,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def example():
ft.TextStyle(italic=True, color=ft.Colors.GREEN, size=20),
)
],
alignment=ft.Alignment.top_center(),
alignment=ft.Alignment.top_CENTER,
rotate=math.pi * 0.15,
),
cv.Circle(400, 100, 2, ft.Paint(color=ft.Colors.RED)),
Expand All @@ -32,7 +32,7 @@ def example():
100,
"Rotated around top_left",
ft.TextStyle(size=20),
alignment=ft.Alignment.top_left(),
alignment=ft.Alignment.TOP_LEFT,
rotate=math.pi * -0.15,
),
cv.Circle(600, 200, 2, ft.Paint(color=ft.Colors.RED)),
Expand All @@ -41,7 +41,7 @@ def example():
200,
"Rotated around center",
ft.TextStyle(size=20),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
rotate=math.pi / 2,
),
cv.Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def example():
src="logo.svg",
width=100,
height=100,
fit=ft.ImageFit.CONTAIN,
fit=ft.BoxFit.CONTAIN,
)
images = ft.Row(width=600, wrap=False, scroll="always")

Expand All @@ -18,7 +18,7 @@ def example():
src=f"https://picsum.photos/200/200?{i}",
width=200,
height=200,
fit=ft.ImageFit.NONE,
fit=ft.BoxFit.NONE,
repeat=ft.ImageRepeat.NO_REPEAT,
border_radius=ft.BorderRadius.all(10),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def example():
border_radius=10,
text_style=ft.TextStyle(size=20, color=ft.Colors.WHITE),
gradient=ft.LinearGradient(
begin=ft.Alignment.top_left(),
begin=ft.Alignment.TOP_LEFT,
end=ft.Alignment(0.8, 1),
# end=ft.Alignment.bottom_left(),
# colors=[ft.Colors.BLUE, ft.Colors.YELLOW],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def items(count):
items.append(
ft.Container(
content=ft.Text(value=str(i)),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
width=50,
height=50,
bgcolor=ft.Colors.AMBER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def items(count):
items.append(
ft.Container(
content=ft.Text(value=str(i)),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
width=30,
height=30,
bgcolor=ft.Colors.AMBER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def items(count):
items.append(
ft.Container(
content=ft.Text(value=str(i)),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
width=50,
height=50,
bgcolor=ft.Colors.AMBER_500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def items(count):
items.append(
ft.Container(
content=ft.Text(value=str(i)),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
width=50,
height=50,
bgcolor=ft.Colors.AMBER_500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ def example():
controls=[
ft.Container(
ft.Text("Section A"),
alignment=ft.Alignment.top_left(),
alignment=ft.Alignment.TOP_LEFT,
bgcolor=ft.Colors.YELLOW_200,
height=100,
scroll_key="A",
),
ft.Container(
ft.Text("Section B"),
alignment=ft.Alignment.top_left(),
alignment=ft.Alignment.TOP_LEFT,
bgcolor=ft.Colors.GREEN_200,
height=100,
scroll_key="B",
),
ft.Container(
ft.Text("Section C"),
alignment=ft.Alignment.top_left(),
alignment=ft.Alignment.TOP_LEFT,
bgcolor=ft.Colors.BLUE_200,
height=100,
scroll_key="C",
),
ft.Container(
ft.Text("Section D"),
alignment=ft.Alignment.top_left(),
alignment=ft.Alignment.TOP_LEFT,
bgcolor=ft.Colors.PINK_200,
height=100,
scroll_key="D",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def example():
content=ft.Text("Non clickable"),
margin=10,
padding=10,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
bgcolor=ft.Colors.AMBER,
width=150,
height=150,
Expand All @@ -21,7 +21,7 @@ def example():
content=ft.Text("Clickable without Ink"),
margin=10,
padding=10,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
bgcolor=ft.Colors.GREEN_200,
width=150,
height=150,
Expand All @@ -32,7 +32,7 @@ def example():
content=ft.Text("Clickable with Ink"),
margin=10,
padding=10,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
bgcolor=ft.Colors.CYAN_200,
width=150,
height=150,
Expand All @@ -44,7 +44,7 @@ def example():
content=ft.Text("Clickable transparent with Ink"),
margin=10,
padding=10,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
width=150,
height=150,
border_radius=10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ def example():

container_1 = ft.Container(
content=ft.Text("Center"),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
bgcolor=ft.Colors.BLUE_GREY_100,
width=150,
height=150,
)

container_2 = ft.Container(
content=ft.Text("Top left"),
alignment=ft.Alignment.top_left(),
alignment=ft.Alignment.TOP_LEFT,
bgcolor=ft.Colors.BLUE_GREY_200,
width=150,
height=150,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def example():

container_1 = ft.Container(
content=ft.Text("LinearGradient"),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
gradient=ft.LinearGradient(
begin=ft.Alignment.top_center(),
end=ft.Alignment.bottom_center(),
begin=ft.Alignment.top_CENTER,
end=ft.Alignment.bottom_CENTER,
colors=[ft.Colors.BLUE, ft.Colors.YELLOW],
),
width=150,
Expand All @@ -22,7 +22,7 @@ def example():

container_2 = ft.Container(
content=ft.Text("RadialGradient"),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
gradient=ft.RadialGradient(
colors=[ft.Colors.YELLOW, ft.Colors.BLUE],
),
Expand All @@ -33,9 +33,9 @@ def example():

container_3 = ft.Container(
content=ft.Text("SweepGradient"),
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
gradient=ft.SweepGradient(
center=ft.Alignment.center(),
center=ft.Alignment.CENTER,
start_angle=0.0,
end_angle=math.pi * 2,
colors=[ft.Colors.YELLOW, ft.Colors.BLUE],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ def example():
[
ft.Container(
bgcolor=ft.Colors.AMBER,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
expand=1,
),
ft.Divider(),
ft.Container(
bgcolor=ft.Colors.PINK, alignment=ft.Alignment.center(), expand=1
bgcolor=ft.Colors.PINK, alignment=ft.Alignment.CENTER, expand=1
),
ft.Divider(height=1, color="white"),
ft.Container(
bgcolor=ft.Colors.BLUE_300,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
expand=1,
),
ft.Divider(height=9, thickness=3),
ft.Container(
bgcolor=ft.Colors.DEEP_PURPLE_200,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
expand=1,
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def show_draggable_cursor(e: ft.HoverEvent):

c = ft.Container(
bgcolor=ft.Colors.AMBER,
alignment=ft.Alignment.center(),
alignment=ft.Alignment.CENTER,
height=100,
# expand=1,
)
Expand All @@ -29,7 +29,7 @@ def show_draggable_cursor(e: ft.HoverEvent):
on_hover=show_draggable_cursor,
),
ft.Container(
bgcolor=ft.Colors.PINK, alignment=ft.Alignment.center(), expand=1
bgcolor=ft.Colors.PINK, alignment=ft.Alignment.CENTER, expand=1
),
],
spacing=0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def example():
images.controls.append(
ft.Image(
src=f"https://picsum.photos/150/150?{i}",
fit=ft.ImageFit.NONE,
fit=ft.BoxFit.NONE,
repeat=ft.ImageRepeat.NO_REPEAT,
border_radius=ft.BorderRadius.all(10),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def example():
selected=True,
),
ft.ListTile(
leading=ft.Image(src="/logo.svg", fit=ft.ImageFit.CONTAIN),
leading=ft.Image(src="/logo.svg", fit=ft.BoxFit.CONTAIN),
title=ft.Text("One-line with leading control"),
),
ft.ListTile(
Expand Down
Loading