rename users

This commit is contained in:
2026-03-31 18:10:12 +05:00
parent 59b3bcd0f4
commit 4e9b89fbe5
22 changed files with 1262 additions and 163 deletions

View File

@@ -0,0 +1,53 @@
import flet as ft
import designer as ds
import api_client
class TakeTestPage(ft.Column):
def __init__(self, page: ft.Page):
self._page = page
self._loading = ft.ProgressRing(width=40, height=40, color=ds.clolors.laer1)
super().__init__(
alignment=ft.MainAxisAlignment.CENTER,
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
controls=[self._loading],
)
async def load(self):
await self._load_polls()
async def _load_polls(self):
polls = await api_client.get_polls()
if polls:
self._render_polls(polls)
else:
self.controls = [ds.CastomText(text="Тестов пока нет", size=16)]
self.update()
def _render_polls(self, polls: list):
self.controls = [
ft.Container(
border_radius=12,
padding=16,
bgcolor=ds.clolors.laer2,
content=ft.Column(
spacing=6,
controls=[
ds.CastomText(
text=poll.get("title", ""),
size=16,
weight=ft.FontWeight.BOLD,
),
ds.CastomText(
text=poll.get("description") or "",
size=13,
),
],
),
on_click=lambda e, pid=poll["id"]: self._page.go(
f"/poll/{self._page.session.store.get('url_key') or ''}/{pid}"
),
ink=True,
)
for poll in polls
]