検索バーをトップツールバーに収容
This commit is contained in:
parent
ccd549dc0c
commit
8f9634fdf2
1 changed files with 50 additions and 2 deletions
52
main.py
52
main.py
|
|
@ -848,7 +848,6 @@ class FlutterStyleDashboard:
|
||||||
self._search_field.value = self.explorer_state.query
|
self._search_field.value = self.explorer_state.query
|
||||||
self.search_overlay.visible = True
|
self.search_overlay.visible = True
|
||||||
self.page.update()
|
self.page.update()
|
||||||
self.page.set_focus(self._search_field)
|
|
||||||
|
|
||||||
def close_search_overlay(self, _=None):
|
def close_search_overlay(self, _=None):
|
||||||
if not hasattr(self, "search_overlay"):
|
if not hasattr(self, "search_overlay"):
|
||||||
|
|
@ -869,7 +868,56 @@ class FlutterStyleDashboard:
|
||||||
return
|
return
|
||||||
self._search_field.value = keyword
|
self._search_field.value = keyword
|
||||||
self.page.update()
|
self.page.update()
|
||||||
self.page.set_focus(self._search_field)
|
|
||||||
|
def _clear_search_query(self, _=None):
|
||||||
|
self._search_field.value = ""
|
||||||
|
self.explorer_state.query = ""
|
||||||
|
self.explorer_state.offset = 0
|
||||||
|
self.close_search_overlay()
|
||||||
|
self.update_main_content()
|
||||||
|
|
||||||
|
def _build_search_overlay(self) -> ft.Container:
|
||||||
|
command_palette = ft.Container(
|
||||||
|
width=420,
|
||||||
|
padding=ft.Padding.symmetric(horizontal=12, vertical=8),
|
||||||
|
bgcolor=ft.Colors.WHITE,
|
||||||
|
border_radius=12,
|
||||||
|
shadow=[ft.BoxShadow(blur_radius=20, color=ft.Colors.BLACK26)],
|
||||||
|
content=ft.Column(
|
||||||
|
[
|
||||||
|
ft.Row(
|
||||||
|
[
|
||||||
|
ft.Icon(ft.Icons.SEARCH, size=22, color=ft.Colors.BLUE_GREY_500),
|
||||||
|
ft.Container(expand=True, content=self._search_field),
|
||||||
|
ft.IconButton(ft.Icons.CLOSE, tooltip="閉じる", on_click=self.close_search_overlay),
|
||||||
|
],
|
||||||
|
vertical_alignment=ft.CrossAxisAlignment.CENTER,
|
||||||
|
),
|
||||||
|
ft.Text(
|
||||||
|
"Enterで検索、ESCで閉じる",
|
||||||
|
size=11,
|
||||||
|
color=ft.Colors.BLUE_GREY_400,
|
||||||
|
),
|
||||||
|
ft.Row(
|
||||||
|
[
|
||||||
|
ft.TextButton("すべて表示に戻す", on_click=self._clear_search_query),
|
||||||
|
ft.TextButton("閉じる", on_click=self.close_search_overlay),
|
||||||
|
],
|
||||||
|
alignment=ft.MainAxisAlignment.END,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
spacing=6,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
return ft.Container(
|
||||||
|
visible=False,
|
||||||
|
expand=True,
|
||||||
|
bgcolor=ft.Colors.BLACK54,
|
||||||
|
alignment=ft.Alignment(0, 0),
|
||||||
|
content=command_palette,
|
||||||
|
on_click=lambda _: self.close_search_overlay(),
|
||||||
|
)
|
||||||
|
|
||||||
@log_wrap("_build_invoice_detail_screen")
|
@log_wrap("_build_invoice_detail_screen")
|
||||||
def _build_invoice_detail_screen(self) -> ft.Column:
|
def _build_invoice_detail_screen(self) -> ft.Column:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue