-
Notifications
You must be signed in to change notification settings - Fork 639
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
A budget tracker app (Flet 0.82.2) works perfectly on Windows desktop but has 3 rendering issues when built as Android APK with flet build apk:
Initial view doesn't load — content area stays empty until user manually taps a tab
Buttons in rebuilt views don't refresh UI — handlers execute (data changes, saves work) but no visual update. Affects: font scale (A-/A+), language toggle, and all buttons in the Config view (WebDAV save/test/clear, currency save, profile add/switch/delete)
SnackBar toasts don't appear from these same buttons
The theme toggle button works perfectly on Android — it's the only button that produces instant visual feedback.
The confusing part
I built a flat test app (test_android_working.py attached) using the exact same patterns — controls.clear() + extend + update(), SnackBar via overlay, run_task, ElevatedButton handlers — and all 6 tests pass on the same Android device.
The only structural difference is nesting depth:
Working test:
pythonpage.add(Column([...sections with buttons...]))
Failing app:
pythonpage.add(SafeArea(Column([
Container(Column([Row([title, badge, profile]), Row([A-, A+, lang, theme]), Container(tab_row)])),
Container(content_col), # ← rebuilt by render()
])))
Code
Full source attached as zip. Key files:
main.py — app entry point, contains render() which rebuilds tab_row + content_col
views/special_views.py — Config view with WebDAV Save/Test/Clear buttons that don't respond on Android
test_android_working.py — flat test with same patterns that passes on Android
The render() pattern (main.py):
pythondef render():
# rebuild tab bar
tab_row.controls.clear()
tab_row.controls.extend(new_tabs)
tab_row.update()
# rebuild content
view = build_month_view(...) or build_config_view(...) etc.
content_col.controls.clear()
content_col.controls.append(Container(view, ...))
content_col.update()
page.update()
Initial load (main.py):
python# Content pre-filled before page.add (placeholder)
tab_row.controls.extend(initial_tabs)
content_col.controls.append(Container(Text("Chargement…"), ...))
page.add(SafeArea(Column([top_bar, Container(content_col)])))
Async load AFTER page.add
async def _start():
await asyncio.get_event_loop().run_in_executor(None, storage.load)
render() # ← this doesn't visually update on Android
page.run_task(_start)
Config buttons that don't respond (special_views.py):
pythondef save_cfg_profile(e):
storage.save_profile_dav(...)
status_txt.value = "Saved ✓" # ← value changes but not visible on Android
status_txt.color = "#7BC47F"
on_toast("Saved ✓") # ← toast doesn't appear on Android
page.update()
def test_cfg_profile(e):
storage.save_profile_dav(...)
ok, msg = storage.test_dav() # blocking network call
status_txt.value = msg # ← not visible on Android
on_toast(f"✓ {msg}" if ok else ...) # ← not visible on Android
page.update()
SnackBar implementation (main.py):
python_snack = ft.SnackBar(ft.Text(''), bgcolor='#7BC47F', duration=2500)
page.overlay.append(_snack) # before page.add
def show_toast(msg):
_snack.content.value = msg
_snack.open = True
page.update()
Note: page.open() doesn't exist in 0.82.2 — using overlay pattern instead.
Code sample
Oxycash.zip
test_android_working.py
Code
[Paste your code here]To reproduce
Extract the attached zip
flet build apk
Install on Android device
Bug 1: App opens — top bar with tabs is visible but content area is empty. Expected: monthly budget view should load automatically.
Tap any tab (e.g. "Config") — content now appears
Bug 2: In Config, fill WebDAV fields and tap "Save" or "Test" — no status text appears, no toast. On Windows the same buttons show "Saved ✓" and a green toast.
Tap A- or A+ (font scale buttons in top bar) — no visible change on Android, works instantly on Windows
Contrast: Tap the theme toggle (🌙/☀️) — works perfectly on Android, instant dark/light switch
Expected behavior
All 3 should work on Android exactly like on Windows:
Initial view loads on startup
All buttons produce instant visual feedback
Toasts appear on every action
Screenshots / Videos
Captures
[Upload media here]
Operating System
Windows
Operating system details
11
Flet version
0.82.2
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
[Paste your logs here]Additional details
Flet: 0.82.2
Python: 3.14 (Windows), 3.10+ (APK build)
Build: flet build apk
Android: Samsung physical device
Windows 11: works perfectly
Entry point: ft.run(main)
Attached files
Source zip — full Oxycash project (all .py files needed to build)
test_android_working.py — flat test app where all 6 patterns pass on Android
Additional context
The theme toggle works because _apply_theme() only mutates page.bgcolor and top_bar.bgcolor — persistent widgets, no controls.clear(). Then render() is called which does the full rebuild — but somehow this specific call path works while all others don't.
on_save() (which persists data to disk) uses page.run_thread(storage.save) and works silently — data IS saved, it's just the visual feedback that's missing.
Tested extensively over 3 days with various approaches: async/sync handlers, page.update() placement, run_task vs run_thread, try/except removal — none fixed the Android-specific rendering issue.