スナック見えない

This commit is contained in:
joe 2026-02-23 20:41:05 +09:00
parent 50aa460064
commit 27fb3d7286
2 changed files with 23 additions and 6 deletions

19
main.py
View file

@ -723,7 +723,9 @@ class FlutterStyleDashboard:
self.open_invoice_edit(slip)
def on_long_press(_):
self.show_context_menu(slip)
# 長押しは直接編集画面へ(ビューワではなく編集)
logging.info(f"long_press -> open_invoice_edit: {getattr(slip, 'invoice_number', 'unknown')}")
self.open_invoice_edit(slip)
show_offset_button = isinstance(slip, Invoice) and self.can_create_offset_invoice(slip)
@ -972,7 +974,9 @@ class FlutterStyleDashboard:
self.selected_customer = invoice.customer
self.selected_document_type = invoice.document_type
self.amount_value = str(invoice.items[0].unit_price if invoice.items else "0")
self.is_detail_edit_mode = False # 初期はビューモード
self.is_detail_edit_mode = True # 編集モードで開く
self.is_customer_picker_open = False
self.is_new_customer_form_open = False
self.current_tab = 1 # 詳細編集タブに切り替え
self.update_main_content()
@ -1623,9 +1627,14 @@ class FlutterStyleDashboard:
def _show_snack(self, message: str, color=ft.Colors.BLUE_GREY_800):
try:
self.page.snack_bar = ft.SnackBar(content=ft.Text(message), bgcolor=color)
self.page.snack_bar.open = True
self.page.update()
snack = ft.SnackBar(content=ft.Text(message), bgcolor=color)
# prefer show_snack_bar API if available (more reliable on web)
if hasattr(self.page, "show_snack_bar"):
self.page.show_snack_bar(snack)
else:
self.page.snack_bar = snack
self.page.snack_bar.open = True
self.page.update()
except Exception as e:
logging.warning(f"snack_bar表示失敗: {e}")
def create_new_customer_screen(self) -> ft.Container:

View file

@ -402,7 +402,15 @@ class CustomerService:
else:
logging.error(f"新規顧客登録失敗: {formal_name}")
return 0 # 失敗時は0を返す
def update_customer(self, customer: Customer) -> bool:
"""顧客を更新し、キャッシュをリフレッシュ"""
success = self.customer_repo.update_customer(customer)
if success:
# キャッシュを再読み込み
self._load_customers()
return success
def _load_customers(self):
"""顧客データを読み込み"""
self._customer_cache = self.customer_repo.get_all_customers()