Sfoglia il codice sorgente

introduce ui.page_sticky for adding sticky elements to the page

Falko Schindler 2 anni fa
parent
commit
78bfa8744a
3 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 2 0
      api_docs_and_examples.py
  2. 7 0
      nicegui/page_layout.py
  3. 1 0
      nicegui/ui.py

+ 2 - 0
api_docs_and_examples.py

@@ -668,6 +668,8 @@ The `fixed` argument controls whether the element should scroll or stay fixed on
 The `top_corner` and `bottom_corner` arguments indicate whether a drawer should expand to the top or bottom of the page.
 See <https://quasar.dev/layout/header-and-footer> and <https://quasar.dev/layout/drawer> for more information about possible props like
 `elevated`, `bordered` and many more.
+With `ui.page_sticky` you can place an element "sticky" on the screen.
+See <https://quasar.dev/layout/page-sticky> for more information.
     '''
     with example(page_layout):
         @ui.page('/page_layout')

+ 7 - 0
nicegui/page_layout.py

@@ -59,3 +59,10 @@ class Footer(Group):
         code = list(find_parent_page().layout.view)
         code[1] = 'F' if fixed else 'f'
         find_parent_page().layout.view = ''.join(code)
+
+
+class PageSticky(Group):
+
+    def __init__(self) -> None:
+        view = jp.QPageSticky(temp=False)
+        super().__init__(view)

+ 1 - 0
nicegui/ui.py

@@ -10,6 +10,7 @@ class Ui:
     from .page_layout import Footer as footer
     from .page_layout import LeftDrawer as left_drawer
     from .page_layout import RightDrawer as right_drawer
+    from .page_layout import PageSticky as page_sticky
     from .update import update
 
     from .elements.button import Button as button