fix loading
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import flet as ft
|
||||
from flet_core.types import OptionalControlEventCallable
|
||||
from flet.core.types import OptionalControlEventCallable
|
||||
import json
|
||||
import requests
|
||||
|
||||
@@ -46,21 +46,27 @@ class Loger(ft.SnackBar):
|
||||
)
|
||||
|
||||
class Field(ft.TextField):
|
||||
def __init__(self, label: str = "", password: bool = False):
|
||||
def __init__(self, label: str = "", password: bool = False,width:int=0):
|
||||
|
||||
super().__init__(
|
||||
max_lines=1,
|
||||
border_color=color[3],
|
||||
color=color[3],
|
||||
text_size=24,
|
||||
label=label,
|
||||
expand=True,
|
||||
password=password,
|
||||
can_reveal_password=password,
|
||||
label_style=ft.TextStyle(
|
||||
color=color[3],
|
||||
size=24
|
||||
),
|
||||
|
||||
)
|
||||
if width == 0:
|
||||
self.expand=True,
|
||||
else:
|
||||
self.expand=False
|
||||
self.width=width
|
||||
|
||||
class Button(ft.ElevatedButton):
|
||||
def __init__(self, text: str = "", on_click: OptionalControlEventCallable = None):
|
||||
|
||||
@@ -25,8 +25,8 @@ class Add_new_data(ft.View):
|
||||
expand=True,
|
||||
controls=[
|
||||
Button(text="профиль"),
|
||||
Button(text="мои данные"),
|
||||
Button(text="заполнить данные"),
|
||||
Button(text="мои данные",on_click = self.go_to_my_data),
|
||||
Button(text="заполнить данные", on_click=self.go_to_data),
|
||||
]
|
||||
)
|
||||
),
|
||||
@@ -119,3 +119,11 @@ class Add_new_data(ft.View):
|
||||
print("Данные успешно отправлены")
|
||||
else:
|
||||
print(f"Ошибка при отправке данных: {response.status_code}")
|
||||
|
||||
|
||||
def go_to_info(self,e):
|
||||
self.page.go("/user_info")
|
||||
def go_to_my_data(self,e):
|
||||
self.page.go("/my_data")
|
||||
def go_to_data(self,e):
|
||||
self.page.go("/add_new_data")
|
||||
@@ -1,5 +1,5 @@
|
||||
import flet as ft
|
||||
import designer as des
|
||||
import designer as des
|
||||
|
||||
class Add_user_data(ft.View):
|
||||
def __init__(self,page:ft.Page,route:str=""):
|
||||
@@ -11,10 +11,20 @@ class Add_user_data(ft.View):
|
||||
controls=[
|
||||
ft.Row(
|
||||
controls=[
|
||||
|
||||
des.Button(text="профиль"),
|
||||
des.Button(text="мои данные",on_click = self.go_to_my_data),
|
||||
des.Button(text="заполнить данные", on_click=self.go_to_data),
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def go_to_info(self,e):
|
||||
self.page.go("/user_info")
|
||||
def go_to_my_data(self,e):
|
||||
self.page.go("/my_data")
|
||||
def go_to_data(self,e):
|
||||
self.page.go("/add_new_data")
|
||||
@@ -5,18 +5,24 @@ import requests
|
||||
class Login(ft.Column):
|
||||
def __init__(self, page: ft.Page = None):
|
||||
self.page = page
|
||||
self.login = Field(label="Login"),
|
||||
self.password = Field(label="Password", password=True)
|
||||
self.login = Field(label="Login",width=300),
|
||||
self.password = Field(label="Password", password=True,width=300)
|
||||
super().__init__(
|
||||
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
|
||||
expand=True,
|
||||
controls=[
|
||||
ft.Row(
|
||||
expand=True
|
||||
),
|
||||
ft.Row(
|
||||
alignment=ft.MainAxisAlignment.CENTER,
|
||||
controls=[
|
||||
ft.Text(color=color[1], size=42, value="Copp")
|
||||
]
|
||||
),
|
||||
ft.Row(
|
||||
expand=True
|
||||
),
|
||||
ft.Row(
|
||||
alignment=ft.MainAxisAlignment.CENTER,
|
||||
controls=[
|
||||
@@ -29,12 +35,18 @@ class Login(ft.Column):
|
||||
self.password
|
||||
]
|
||||
),
|
||||
ft.Row(
|
||||
height=12
|
||||
),
|
||||
ft.Row(
|
||||
alignment=ft.MainAxisAlignment.CENTER,
|
||||
controls=[
|
||||
Button(text="Enter", on_click=self.enter_go_to_next_page)
|
||||
]
|
||||
)
|
||||
),
|
||||
ft.Row(
|
||||
expand=True
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -29,4 +29,10 @@ class My_data(ft.View):
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
def go_to_my_data(self):
|
||||
pass
|
||||
|
||||
def go_to_data(self):
|
||||
pass
|
||||
Reference in New Issue
Block a user